[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
Thu Jan 3 11:41:57 PST 2019
mgorny updated this revision to Diff 180114.
mgorny edited the summary of this revision.
mgorny added a comment.
Herald added subscribers: atanasyan, sdardis.
Updated to use clang's libdir logic.
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,28 @@
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_MIPS:
+ if (Config->EKind == ELF64LEKind || Config->EKind == ELF64BEKind)
+ Config->SearchPaths.push_back("/usr/lib/64");
+ // TODO: how to detect o32?
+ break;
+ case EM_PPC64:
+ break;
+ // TODO: add *nbsd* emulations when supported
+ }
+ 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 +434,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.180114.patch
Type: text/x-patch
Size: 1688 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/4fb98f9c/attachment.bin>
More information about the llvm-commits
mailing list