[PATCH] D24496: [ELF] - Implemented rpath-link command line option.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 01:57:46 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777.

rpath-link option was ignored before.
This is PR30360, patch fixes that.
Am I missing something ? That looks too much trivial, have no idea why we ignored it before ?

https://reviews.llvm.org/D24496

Files:
  ELF/Driver.cpp
  ELF/Options.td
  test/ELF/rpath-link.s

Index: test/ELF/rpath-link.s
===================================================================
--- test/ELF/rpath-link.s
+++ test/ELF/rpath-link.s
@@ -0,0 +1,7 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/shared.s -o %t1.o
+# RUN: mkdir -p %T/libs
+# RUN: ld.lld -shared %t1.o -o %T/libs/libz.so
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t2.o
+# RUN: ld.lld -o %t --rpath-link=%T/libs -lz %t2.o 2>&1
+# RUN: ld.lld -o %t --rpath-link %T/libs -lz %t2.o 2>&1
Index: ELF/Options.td
===================================================================
--- ELF/Options.td
+++ ELF/Options.td
@@ -145,6 +145,10 @@
 
 def relocatable: F<"relocatable">, HelpText<"Create relocatable object file">;
 
+def rpath_link: S<"rpath-link">, HelpText<"Add DIR to link time shared library search path">;
+
+def rpath_link_eq: J<"rpath-link=">, HelpText<"Add DIR to link time shared library search path">;
+
 def script: S<"script">, HelpText<"Read linker script">;
 
 def shared: F<"shared">, HelpText<"Build a shared object">;
@@ -274,8 +278,6 @@
 def no_mmap_output_file: F<"no-mmap-output-file">;
 def no_warn_common: F<"no-warn-common">;
 def no_warn_mismatch: F<"no-warn-mismatch">;
-def rpath_link: S<"rpath-link">;
-def rpath_link_eq: J<"rpath-link=">;
 def sort_common: F<"sort-common">;
 def warn_execstack: F<"warn-execstack">;
 def warn_shared_textrel: F<"warn-shared-textrel">;
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -381,6 +381,10 @@
 
 // Initializes Config members by the command line options.
 void LinkerDriver::readConfigs(opt::InputArgList &Args) {
+  for (auto *Arg : Args.filtered(OPT_rpath_link_eq))
+    Config->SearchPaths.push_back(Arg->getValue());
+  for (auto *Arg : Args.filtered(OPT_rpath_link))
+    Config->SearchPaths.push_back(Arg->getValue());
   for (auto *Arg : Args.filtered(OPT_L))
     Config->SearchPaths.push_back(Arg->getValue());
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24496.71118.patch
Type: text/x-patch
Size: 2044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160913/dd007db8/attachment.bin>


More information about the llvm-commits mailing list