[PATCH] Let -rpath work

Joerg Sonnenberger joerg at NetBSD.org
Tue Sep 3 14:07:59 PDT 2013



================
Comment at: lib/Driver/GnuLdDriver.cpp:294
@@ +293,3 @@
+      SmallVector<StringRef, 2> rpaths;
+      StringRef(inputArg->getValue()).split(rpaths, ":");
+      for (auto path : rpaths)
----------------
Rui Ueyama wrote:
> Do we really need to split the argument with ":"? The arguments will eventually be joined with ":" as separator, so splitting and joining is no-op. If we use each rpath value in the linker, splitting it would make sense, but we don't interpret rpath but just copies the value to program header, so that's not the case.
-rpath affects the recursive loading of shared libraries, if -rpath-link is not given. As such I would prefer to have the split path as canonical value at hand. While this functionality is not implemented yet, it is certainly on the todo list.

================
Comment at: include/lld/ReaderWriter/ELFLinkingContext.h:224
@@ -215,2 +223,3 @@
   StringRef _sysrootPath;
+  StringRefVector _rpathList;
 };
----------------
Rui Ueyama wrote:
> So StringRefVector is a vector of *pointers to* StringRef? StringRef seems to be designed to be passed by value rather than by pointer, so it should have been a vector of StringRef (removing one indirection).
> 
> It's not introduced by this patch, so this patch is LGTM though.
No, StringRefVector is defined as vector<StringRef> in LinkingContext.h.


http://llvm-reviews.chandlerc.com/D1583



More information about the llvm-commits mailing list