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.
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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits