[clang] 2a9a13d - [OpenMP] Remove `-Bsymbolic` flag for device linking in the GNU toolchain

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 20 09:25:25 PDT 2022


Author: Joseph Huber
Date: 2022-10-20T11:25:16-05:00
New Revision: 2a9a13d9cc5fceeb2cdb293dffeca0bc326c479f

URL: https://github.com/llvm/llvm-project/commit/2a9a13d9cc5fceeb2cdb293dffeca0bc326c479f
DIFF: https://github.com/llvm/llvm-project/commit/2a9a13d9cc5fceeb2cdb293dffeca0bc326c479f.diff

LOG: [OpenMP] Remove `-Bsymbolic` flag for device linking in the GNU toolchain

Previously, OpenMP linking would be done explicitly in a linker stage.
For `x86_64` offloading this would just use the host linker, which could
be the `bfd` linker. This linker had problems linking relocations
against variables with protected visibility so we force `-Bsymbolic`
when linking. After the deprecation of the old offloading driver this
code is no longer used and can be removed.

Reviewed By: tianshilei1992

Differential Revision: https://reviews.llvm.org/D136363

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 9d3490f2acbb..f717ca3ed849 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -586,13 +586,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("-lm");
   }
 
-  // If we are linking for the device all symbols should be bound locally. The
-  // symbols are already protected which makes this redundant. This is only
-  // necessary to work around a problem in bfd.
-  // TODO: Remove this once 'lld' becomes the only linker for offloading.
-  if (JA.isDeviceOffloading(Action::OFK_OpenMP))
-    CmdArgs.push_back("-Bsymbolic");
-
   // Silence warnings when linking C code with a C++ '-stdlib' argument.
   Args.ClaimAllArgs(options::OPT_stdlib_EQ);
 


        


More information about the cfe-commits mailing list