[PATCH] D119018: [OpenMP] Add -Bsymbolic to arguments for GNU linker

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 4 10:14:49 PST 2022


jhuber6 updated this revision to Diff 406027.
jhuber6 added a comment.

More informative error message.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119018/new/

https://reviews.llvm.org/D119018

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


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -577,6 +577,14 @@
     }
     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);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119018.406027.patch
Type: text/x-patch
Size: 750 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220204/69242afd/attachment.bin>


More information about the cfe-commits mailing list