Author: Joseph Huber Date: 2023-01-26T15:05:10-06:00 New Revision: f9839876574fe97fdcdf104fbb1c9ba7fd4f9433
URL: https://github.com/llvm/llvm-project/commit/f9839876574fe97fdcdf104fbb1c9ba7fd4f9433 DIFF: https://github.com/llvm/llvm-project/commit/f9839876574fe97fdcdf104fbb1c9ba7fd4f9433.diff LOG: [LinkerWrapper] Fix `-Bsymbolic` being sent to the compiler and not the linker Summary: Clang doesn't warn on `-B` options passed to it. This one is not forwarded to the linker which results in some tests failing when offloading to x86_64 with the `bfd` linker. Added: Modified: clang/test/Driver/linker-wrapper.c clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp Removed: ################################################################################ diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c index 2bd3f60541e4c..8c9bf1acf8141 100644 --- a/clang/test/Driver/linker-wrapper.c +++ b/clang/test/Driver/linker-wrapper.c @@ -52,7 +52,7 @@ // RUN: clang-linker-wrapper --host-triple=x86_64-unknown-linux-gnu --dry-run \ // RUN: --linker-path=/usr/bin/ld.lld -- %t.o -o a.out 2>&1 | FileCheck %s --check-prefix=CPU-LINK -// CPU-LINK: clang{{.*}} -o {{.*}}.img --target=x86_64-unknown-linux-gnu -march=native -O2 -Wl,--no-undefined -Bsymbolic -shared {{.*}}.o {{.*}}.o +// CPU-LINK: clang{{.*}} -o {{.*}}.img --target=x86_64-unknown-linux-gnu -march=native -O2 -Wl,--no-undefined -Wl,-Bsymbolic -shared {{.*}}.o {{.*}}.o // RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o // RUN: clang-linker-wrapper --dry-run --host-triple=x86_64-unknown-linux-gnu -mllvm -openmp-opt-disable \ diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 361179ad8a3b2..d479b5a6cccef 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -389,7 +389,7 @@ Expected<StringRef> clang(ArrayRef<StringRef> InputFiles, const ArgList &Args) { // If this is CPU offloading we copy the input libraries. if (!Triple.isAMDGPU() && !Triple.isNVPTX()) { - CmdArgs.push_back("-Bsymbolic"); + CmdArgs.push_back("-Wl,-Bsymbolic"); CmdArgs.push_back("-shared"); ArgStringList LinkerArgs; for (const opt::Arg *Arg : _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits