summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
authorAlexander Richardson <arichardson.kde@gmail.com>2017-11-20 15:43:20 +0000
committerAlexander Richardson <arichardson.kde@gmail.com>2017-11-20 15:43:20 +0000
commit1de78471f524e79dc77ecacbe09fada47bfd7418 (patch)
treeb9fdcb325bdaf2133ff38f4a93cacd40666101af /lld/ELF/Driver.cpp
parent24194525057b73ecc1d78b7853ce1bbd6ceaf9c2 (diff)
downloadbcm5719-llvm-1de78471f524e79dc77ecacbe09fada47bfd7418.tar.gz
bcm5719-llvm-1de78471f524e79dc77ecacbe09fada47bfd7418.zip
[ELF] Fall back to search dirs for linker scripts specified with -T
Summary: This matches the behaviour of ld.bfd: https://sourceware.org/binutils/docs/ld/Options.html#Options If scriptfile does not exist in the current directory, ld looks for it in the directories specified by any preceding '-L' options. Multiple '-T' options accumulate. Reviewers: ruiu, grimar Reviewed By: ruiu, grimar Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D40129 llvm-svn: 318655
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a2e4559bab3..e8d3639483b 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -862,8 +862,12 @@ void LinkerDriver::createFiles(opt::InputArgList &Args) {
addFile(Arg->getValue(), /*WithLOption=*/false);
break;
case OPT_script:
- if (Optional<MemoryBufferRef> MB = readFile(Arg->getValue()))
- readLinkerScript(*MB);
+ if (Optional<std::string> Path = searchLinkerScript(Arg->getValue())) {
+ if (Optional<MemoryBufferRef> MB = readFile(*Path))
+ readLinkerScript(*MB);
+ break;
+ }
+ error(Twine("cannot find linker script ") + Arg->getValue());
break;
case OPT_as_needed:
Config->AsNeeded = true;
OpenPOWER on IntegriCloud