[PATCH] D143306: [Driver] Default to -fno-openmp-implicit-rpath

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 3 17:24:26 PST 2023


MaskRay created this revision.
MaskRay added reviewers: jdoerfert, jhuber6, JonChesterfield, tstellar.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

D118493 <https://reviews.llvm.org/D118493> added -fno-openmp-implicit-rpath and made it the default, with an
argument that it convenients systems installing the toolchain at a non-standard
location.

I'd argue that such systems should specify `-Wl,-rpath` explicitly or in a Clang
configuration file. libc++, libc++abi, libunwind, and compiler-rt don't add the
extra DT_RUNPATH, it's weird for openmp to diverge. Some build systems want to
handle DT_RUNPATH themselves (e.g. CMAKE_INSTALL_RPATH). Some distributions
(e.g. Fedora) have policies against `DT_RUNPATH` and this change is causing
trouble.

No test: the test was removed by d14897c7dad8c05c003bada019c0b573ace63a1a <https://reviews.llvm.org/rGd14897c7dad8c05c003bada019c0b573ace63a1a>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D143306

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -796,7 +796,7 @@
                                           ArgStringList &CmdArgs) {
 
   if (Args.hasFlag(options::OPT_fopenmp_implicit_rpath,
-                   options::OPT_fno_openmp_implicit_rpath, true)) {
+                   options::OPT_fno_openmp_implicit_rpath, false)) {
     // Default to clang lib / lib64 folder, i.e. the same location as device
     // runtime
     SmallString<256> DefaultLibPath =
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -4217,7 +4217,7 @@
   HelpText<"Do not add -rpath with HIP runtime library directory to the linker flags">;
 defm openmp_implicit_rpath: BoolFOption<"openmp-implicit-rpath",
   LangOpts<"OpenMP">,
-  DefaultTrue,
+  DefaultFalse,
   PosFlag<SetTrue, [], "Set rpath on OpenMP executables">,
   NegFlag<SetFalse>,
   BothFlags<[NoArgumentUnused]>>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143306.494776.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230204/8d48a349/attachment-0001.bin>


More information about the cfe-commits mailing list