summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/patchelf.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc
index c8ce4f6..4b16fc1 100644
--- a/src/patchelf.cc
+++ b/src/patchelf.cc
@@ -1504,7 +1504,7 @@ void ElfFile<ElfFileParamNames>::replaceNeeded(const std::map<std::string, std::
if (rdi(dyn->d_tag) == DT_NEEDED) {
char * name = strTab + rdi(dyn->d_un.d_val);
auto i = libs.find(name);
- if (i != libs.end()) {
+ if (i != libs.end() && name != i->second) {
auto replacement = i->second;
debug("replacing DT_NEEDED entry '%s' with '%s'\n", name, replacement.c_str());
@@ -1556,7 +1556,7 @@ void ElfFile<ElfFileParamNames>::replaceNeeded(const std::map<std::string, std::
while (verNeedNum > 0) {
char * file = verStrTab + rdi(need->vn_file);
auto i = libs.find(file);
- if (i != libs.end()) {
+ if (i != libs.end() && file != i->second) {
auto replacement = i->second;
debug("replacing .gnu.version_r entry '%s' with '%s'\n", file, replacement.c_str());