diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-04-12 00:13:48 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2017-04-12 00:13:48 +0000 |
commit | a76349bffe3ad01cfffbc14f8077ab2df65314aa (patch) | |
tree | a5e7edbae0cd51bb0363de7cde64d2665162c679 /lld/ELF/ScriptParser.cpp | |
parent | 13c8daf57ad364852abdfaca369f05459eb01b7f (diff) | |
download | bcm5719-llvm-a76349bffe3ad01cfffbc14f8077ab2df65314aa.tar.gz bcm5719-llvm-a76349bffe3ad01cfffbc14f8077ab2df65314aa.zip |
[lld] Keep full library path in DT_NEEDED.
Fixes PR32572.
When
(a) a library has no soname
and (b) library is given on the command line with path (and not through -L/-l flags)
DT_NEEDED entry for such library keeps the path as given.
This behavior is consistent with gold and bfd, and is used in compiler-rt test suite.
This is a second attempt after r300007 got reverted. This time relro-omagic test is
changed in a way to avoid hardcoding the path to the test directory in the objdump'd
binary.
llvm-svn: 300011
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index bdc733d0082..0ba00a2ae35 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -243,25 +243,26 @@ void ScriptParser::addFile(StringRef S) { SmallString<128> PathData; StringRef Path = (Config->Sysroot + S).toStringRef(PathData); if (sys::fs::exists(Path)) { - Driver->addFile(Saver.save(Path)); + Driver->addFile(Saver.save(Path), /*WithLOption=*/false); return; } } if (sys::path::is_absolute(S)) { - Driver->addFile(S); + Driver->addFile(S, /*WithLOption=*/false); } else if (S.startswith("=")) { if (Config->Sysroot.empty()) - Driver->addFile(S.substr(1)); + Driver->addFile(S.substr(1), /*WithLOption=*/false); else - Driver->addFile(Saver.save(Config->Sysroot + "/" + S.substr(1))); + Driver->addFile(Saver.save(Config->Sysroot + "/" + S.substr(1)), + /*WithLOption=*/false); } else if (S.startswith("-l")) { Driver->addLibrary(S.substr(2)); } else if (sys::fs::exists(S)) { - Driver->addFile(S); + Driver->addFile(S, /*WithLOption=*/false); } else { if (Optional<std::string> Path = findFromSearchPaths(S)) - Driver->addFile(Saver.save(*Path)); + Driver->addFile(Saver.save(*Path), /*WithLOption=*/true); else setError("unable to find " + S); } |