[PATCH] D56215: [lld] [ELF] Include default search paths for NetBSD driver
Michał Górny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 3 12:12:40 PST 2019
mgorny updated this revision to Diff 180121.
mgorny edited the summary of this revision.
mgorny added a comment.
Removed non-x86.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56215/new/
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,23 @@
error("unknown -z value: " + StringRef(Arg->getValue()));
}
+void LinkerDriver::appendDefaultSearchPaths() {
+#if defined(__NetBSD__)
+ // NetBSD driver relies on the linker knowing the default search paths.
+ // Please keep this in sync with clang/lib/Driver/ToolChains/NetBSD.cpp
+ // (NetBSD::NetBSD constructor)
+ switch (Config->EMachine) {
+ case EM_386:
+ Config->SearchPaths.push_back("/usr/lib/i386");
+ break;
+ case EM_X86_64:
+ break;
+ // TODO: support non-x86 architectures
+ }
+ 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 +429,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.180121.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190103/14119355/attachment.bin>
More information about the cfe-commits
mailing list