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 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 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.