[PATCH] D56288: [ELF] Do not enable 'new dtags' on NetBSD by default

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 3 12:18:35 PST 2019


mgorny created this revision.
mgorny added reviewers: ruiu, krytarowski, joerg.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

NetBSD strongly prefers using 'old' dtag (RPATH) over Linux-specific
RUNPATH, and did not support the latter until very recently.  Therefore,
defaulting to RUNPATH causes lld to produce non-working executables
by default.  Switch the default appropriately when building on NetBSD.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D56288

Files:
  ELF/Driver.cpp


Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -766,6 +766,14 @@
 
 // Initializes Config members by the command line options.
 void LinkerDriver::readConfigs(opt::InputArgList &Args) {
+#if defined(__NetBSD__)
+// NetBSD prefers RPATH, and does not allow RUNPATH until very recently
+#  define DEFAULT_NEW_DTAGS false
+#else
+#  define DEFAULT_NEW_DTAGS true
+#endif
+
+
   errorHandler().Verbose = Args.hasArg(OPT_verbose);
   errorHandler().FatalWarnings =
       Args.hasFlag(OPT_fatal_warnings, OPT_no_fatal_warnings, false);
@@ -797,7 +805,8 @@
   Config->CallGraphProfileSort = Args.hasFlag(
       OPT_call_graph_profile_sort, OPT_no_call_graph_profile_sort, true);
   Config->EnableNewDtags =
-      Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags, true);
+      Args.hasFlag(OPT_enable_new_dtags, OPT_disable_new_dtags,
+                   DEFAULT_NEW_DTAGS);
   Config->Entry = Args.getLastArgValue(OPT_entry);
   Config->ExecuteOnly =
       Args.hasFlag(OPT_execute_only, OPT_no_execute_only, false);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56288.180122.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190103/7c0f119f/attachment-0001.bin>


More information about the cfe-commits mailing list