summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2020-09-17 09:25:03 +0200
committerRolf Eike Beer <eb@emlix.com>2021-03-16 08:26:28 +0100
commit554dec3668384e68b7aefdbd1aed63ee90daa4b0 (patch)
treecf3755fa22da27bb8c380f6ef2ea5370d876bace
parent4967cdcd0ea09df373bbce2e24e87cfbe87248c5 (diff)
downloadpatchelf-554dec3668384e68b7aefdbd1aed63ee90daa4b0.tar.gz
do not add new string entries when changing libraries to themself
-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());