summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Driver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-04-13 00:23:32 +0000
committerRui Ueyama <ruiu@google.com>2017-04-13 00:23:32 +0000
commit3233d3eb460b5d4e98e5049ec5f3dfe63b11d234 (patch)
treef1feefc7ec87f5752ca0602e4dd00b59abea9711 /lld/ELF/Driver.cpp
parent37df0180a021647849875a1a19a8dd72362e2d8c (diff)
downloadbcm5719-llvm-3233d3eb460b5d4e98e5049ec5f3dfe63b11d234.tar.gz
bcm5719-llvm-3233d3eb460b5d4e98e5049ec5f3dfe63b11d234.zip
Do not initialize this->SoName with this->DefaultSoName.
This patch uses DefaultSoName in getSoName instead of in parseSoName. I think this is more readable. This patch also add comments. llvm-svn: 300147
Diffstat (limited to 'lld/ELF/Driver.cpp')
-rw-r--r--lld/ELF/Driver.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 8eb95f188b7..47ecd607a48 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -184,9 +184,17 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
return;
}
Files.push_back(createSharedFile(MBRef));
- // If the library is found at an explicitly given path use the entire path
- // as he default soname. Such libraries should not require RPATH or
- // LD_LIBRARY_PATH to run.
+
+ // DSOs usually have DT_SONAME tags in their ELF headers, and the
+ // sonames are used to identify DSOs. But if they are missing,
+ // they are identified by filenames. We don't know whether the new
+ // file has a DT_SONAME or not because we haven't parsed it yet.
+ // Here, we set the default soname for the file because we might
+ // need it later.
+ //
+ // If a file was specified by -lfoo, the directory part is not
+ // significant, as a user did not specify it. This behavior is
+ // compatible with GNU.
Files.back()->DefaultSoName =
WithLOption ? sys::path::filename(Path) : Path;
return;
OpenPOWER on IntegriCloud