diff options
author | Brad King <brad.king@kitware.com> | 2009-06-10 18:11:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-06-10 18:11:40 (GMT) |
commit | d6dd3e91a43d58314919394af6c56383181d410c (patch) | |
tree | 0c6f7b838de928f22605fef918a8e1c7ae530bcf /Source/cmComputeLinkInformation.cxx | |
parent | 42c4a1d71fa818855f1cb67962e94a1f50b18f03 (diff) | |
download | CMake-d6dd3e91a43d58314919394af6c56383181d410c.zip CMake-d6dd3e91a43d58314919394af6c56383181d410c.tar.gz CMake-d6dd3e91a43d58314919394af6c56383181d410c.tar.bz2 |
BUG: Do not mangle symbols when editing RPATHs
In ELF binaries the .dynstr string table is used both for the RPATH
string and for program symbols. If a symbol name happens to match the
end of the build-tree RPATH string the linker is allowed to merge the
symbols.
We must not allow this when the RPATH string will be replaced during
installation because it will mangle the symbol. Therefore we always pad
the end of the build-tree RPATH with ':' if it will be replaced. Tools
tend not to use ':' at the end of symbol names, so it is unlikely to
conflict. See issue #9130.
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 058a0d4..cd3ca57 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1705,10 +1705,15 @@ std::string cmComputeLinkInformation::GetRPathString(bool for_install) rpath += *ri; } - // If the rpath will be replaced at install time make sure it is - // long enough now. + // If the rpath will be replaced at install time, prepare space. if(!for_install && this->RuntimeUseChrpath) { + // Always add one trailing separator so the linker does not re-use + // the rpath .dynstr entry for a symbol name that happens to match + // the end of the rpath string. + rpath += this->GetRuntimeSep(); + + // Make sure it is long enough to hold the replacement value. std::string::size_type minLength = this->GetChrpathString().length(); while(rpath.length() < minLength) { |