From 1de78471f524e79dc77ecacbe09fada47bfd7418 Mon Sep 17 00:00:00 2001 From: Alexander Richardson Date: Mon, 20 Nov 2017 15:43:20 +0000 Subject: [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 --- lld/ELF/ScriptParser.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'lld/ELF/ScriptParser.cpp') 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 MB = readFile(Tok)) - tokenize(*MB); - return; - } - if (Optional Path = findFromSearchPaths(Tok)) { + if (Optional Path = searchLinkerScript(Tok)) { if (Optional MB = readFile(*Path)) tokenize(*MB); return; } - setError("cannot open " + Tok); + setError("cannot find linker script " + Tok); } void ScriptParser::readOutput() { -- cgit v1.2.3