Skip to content

Commit 554ed21

Browse files
authored
[Driver][SYCL] Update option for undefined symbols for hostdep link (#8947)
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.
1 parent b6b01b4 commit 554ed21

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

clang/lib/Driver/ToolChains/Gnu.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,8 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
595595

596596
// Performing link for dependency file information, undefined symbols are OK.
597597
// True link time errors for symbols will be captured at host link.
598-
if (JA.getType() == types::TY_Host_Dependencies_Image) {
599-
CmdArgs.push_back("-z");
600-
CmdArgs.push_back("undefs");
601-
}
598+
if (JA.getType() == types::TY_Host_Dependencies_Image)
599+
CmdArgs.push_back("--unresolved-symbols=ignore-all");
602600

603601
Args.AddAllArgs(CmdArgs, options::OPT_L);
604602
Args.AddAllArgs(CmdArgs, options::OPT_u);

clang/test/Driver/sycl-offload-intelfpga-link.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
// RUN: -target x86_64-unknown-linux-gnu %S/Inputs/SYCL/liblin64.a \
111111
// RUN: %s -### 2>&1 \
112112
// RUN: | FileCheck %s --check-prefix=CHK-FPGA-LINK-UNDEFS
113-
// CHK-FPGA-LINK-UNDEFS: ld{{.*}} "-z" "undefs"
113+
// CHK-FPGA-LINK-UNDEFS: ld{{.*}} "--unresolved-symbols=ignore-all"
114114
// CHK-FPGA-LINK-UNDEFS: clang-offload-deps{{.*}}
115115

116116
/// -fintelfpga -fsycl-link from source

clang/test/Driver/sycl-offload-static-lib-2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
// RUN: %clangxx -target x86_64-unknown-linux-gnu -fsycl -fsycl-targets=nvptx64-nvidia-cuda %t_lib.a -o output_name -lOpenCL -### %s 2>&1 \
151151
// RUN: | FileCheck %s -check-prefix=STATIC_LIB_SRC2 -DBUNDLE_TRIPLE=sycl-nvptx64-nvidia-cuda-sm_50 -DDEPS_TRIPLE=sycl-nvptx64-nvidia-cuda-sm_50
152152
// STATIC_LIB_SRC2: clang{{.*}} "-emit-obj" {{.*}} "-o" "[[HOSTOBJ:.+\.o]]"
153-
// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "-o" "[[HOSTEXE:.+\.out]]" {{.*}}"-z" "undefs"
153+
// STATIC_LIB_SRC2: ld{{(.exe)?}}" {{.*}} "-o" "[[HOSTEXE:.+\.out]]" {{.*}}"--unresolved-symbols=ignore-all"
154154
// STATIC_LIB_SRC2: clang-offload-deps{{.*}} "-targets=[[DEPS_TRIPLE]]" "-outputs=[[OUTDEPS:.+\.bc]]" "[[HOSTEXE]]"
155155
// STATIC_LIB_SRC2_DEF: clang-offload-bundler{{.*}} "-type=aoo" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-output=[[OUTLIB:.+\.txt]]"
156156
// STATIC_LIB_SRC2_NVPTX: clang-offload-bundler{{.*}} "-type=a" "-targets=[[BUNDLE_TRIPLE]]" {{.*}} "-output=[[OUTLIB:.+\.a]]"

0 commit comments

Comments
 (0)