From b02eb6430837bc76c040d91e64a3f84ccd9e7ce4 Mon Sep 17 00:00:00 2001 From: Michael D Toguchi Date: Tue, 4 Apr 2023 16:03:42 -0700 Subject: [PATCH] [Driver][SYCL] Update option for undefined symbols for hostdep link When performing the host link for dependencies, we added '-z undefs' to the link command line. This is fine for the bfd linker, but the option is not supported for gold. Update the option used to use the common --unresolved-symbols=ignore-all instead. --- clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++---- clang/test/Driver/sycl-offload-intelfpga-link.cpp | 2 +- clang/test/Driver/sycl-offload-static-lib-2.cpp | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index d3546be3c3da6..062e255f4a0a5 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -595,10 +595,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Performing link for dependency file information, undefined symbols are OK. // True link time errors for symbols will be captured at host link. - if (JA.getType() == types::TY_Host_Dependencies_Image) { - CmdArgs.push_back("-z"); - CmdArgs.push_back("undefs"); - } + if (JA.getType() == types::TY_Host_Dependencies_Image) + CmdArgs.push_back("--unresolved-symbols=ignore-all"); Args.AddAllArgs(CmdArgs, options::OPT_L); Args.AddAllArgs(CmdArgs, options::OPT_u); diff --git a/clang/test/Driver/sycl-offload-intelfpga-link.cpp b/clang/test/Driver/sycl-offload-intelfpga-link.cpp index ae143a8258a9e..bf8b4926ff8e1 100644 --- a/clang/test/Driver/sycl-offload-intelfpga-link.cpp +++ b/clang/test/Driver/sycl-offload-intelfpga-link.cpp @@ -110,7 +110,7 @@ // RUN: -target x86_64-unknown-linux-gnu %S/Inputs/SYCL/liblin64.a \ // RUN: %s -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHK-FPGA-LINK-UNDEFS -// CHK-FPGA-LINK-UNDEFS: ld{{.*}} "-z" "undefs" +// CHK-FPGA-LINK-UNDEFS: ld{{.*}} "--unresolved-symbols=ignore-all" // CHK-FPGA-LINK-UNDEFS: clang-offload-deps{{.*}} /// -fintelfpga -fsycl-link from source diff --git a/clang/test/Driver/sycl-offload-static-lib-2.cpp b/clang/test/Driver/sycl-offload-static-lib-2.cpp index 7332b487e677b..614c8725af482 100644 --- a/clang/test/Driver/sycl-offload-static-lib-2.cpp +++ b/clang/test/Driver/sycl-offload-static-lib-2.cpp @@ -150,7 +150,7 @@ // RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda %t_lib.a -o output_name -lOpenCL -### %s 2>&1 \ // RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda-sm_50 -DDEPS_TRIPLE=sycl-nvptx64-nvidia-cuda-sm_50 // STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]" -// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "-o" "[[HOSTEXE:.+\.out]]" {{.*}}"-z" "undefs" +// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "-o" "[[HOSTEXE:.+\.out]]" {{.*}}"--unresolved-symbols=ignore-all" // STATIC_LIB_SRC2: clang-offload-deps{{.*}} "-targets=[[DEPS_TRIPLE]]" "-outputs=[[OUTDEPS:.+\.bc]]" "[[HOSTEXE]]" // STATIC_LIB_SRC2_DEF: clang-offload-bundler{{.*}} "-type=aoo" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-output=[[OUTLIB:.+\.txt]]" // STATIC_LIB_SRC2_NVPTX: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-output=[[OUTLIB:.+\.a]]"