diff options
author | Alexander Richardson <arichardson.kde@gmail.com> | 2017-11-20 15:43:20 +0000 |
---|---|---|
committer | Alexander Richardson <arichardson.kde@gmail.com> | 2017-11-20 15:43:20 +0000 |
commit | 1de78471f524e79dc77ecacbe09fada47bfd7418 (patch) | |
tree | b9fdcb325bdaf2133ff38f4a93cacd40666101af /lld/ELF/ScriptParser.cpp | |
parent | 24194525057b73ecc1d78b7853ce1bbd6ceaf9c2 (diff) | |
download | bcm5719-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/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 8dd23668b7a..8130f27a53e 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -350,20 +350,12 @@ void ScriptParser::readInclude() { return; } - // https://sourceware.org/binutils/docs/ld/File-Commands.html: - // The file will be searched for in the current directory, and in any - // directory specified with the -L option. - if (sys::fs::exists(Tok)) { - if (Optional<MemoryBufferRef> MB = readFile(Tok)) - tokenize(*MB); - return; - } - if (Optional<std::string> Path = findFromSearchPaths(Tok)) { + if (Optional<std::string> Path = searchLinkerScript(Tok)) { if (Optional<MemoryBufferRef> MB = readFile(*Path)) tokenize(*MB); return; } - setError("cannot open " + Tok); + setError("cannot find linker script " + Tok); } void ScriptParser::readOutput() { |