[PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver
Michał Górny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 2 12:39:21 PST 2019
mgorny created this revision.
mgorny added reviewers: krytarowski, joerg, ruiu, grimar, espindola.
mgorny added a project: lld.
Herald added subscribers: llvm-commits, MaskRay, arichardson, emaste.
The NetBSD clang driver relies on NetBSD ld knowing the default search
paths and never passes those paths explicitly. As a result of this
design requirement, implement appending default search paths within lld
as well.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D56215
Files:
ELF/Driver.cpp
ELF/Driver.h
Index: ELF/Driver.h
===================================================================
--- ELF/Driver.h
+++ ELF/Driver.h
@@ -32,6 +32,7 @@
private:
void readConfigs(llvm::opt::InputArgList &Args);
+ void appendDefaultSearchPaths();
void createFiles(llvm::opt::InputArgList &Args);
void inferMachineType();
template <class ELFT> void link(llvm::opt::InputArgList &Args);
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -365,6 +365,15 @@
error("unknown -z value: " + StringRef(Arg->getValue()));
}
+void LinkerDriver::appendDefaultSearchPaths() {
+#if defined(__NetBSD__)
+ // NetBSD driver relies on the linker knowing the default search paths.
+ Config->SearchPaths.push_back("/usr/local/lib");
+ Config->SearchPaths.push_back("/lib");
+ Config->SearchPaths.push_back("/usr/lib");
+#endif
+}
+
void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
ELFOptTable Parser;
opt::InputArgList Args = Parser.parse(ArgsArr.slice(1));
@@ -412,6 +421,7 @@
readConfigs(Args);
checkZOptions(Args);
+ appendDefaultSearchPaths();
// The behavior of -v or --version is a bit strange, but this is
// needed for compatibility with GNU linkers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56215.179923.patch
Type: text/x-patch
Size: 1268 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190102/faf038c2/attachment.bin>
More information about the llvm-commits
mailing list