1From 2480efa8411523cf046094492192a5ee451aae5d Mon Sep 17 00:00:00 2001 2From: Eelco Dolstra <eelco.dolstra@logicblox.com> 3Date: Mon, 19 Sep 2016 17:31:37 +0200 4Subject: [PATCH] Remove apparently incorrect usage of "static" 5 6[Upstream-commit: https://github.com/NixOS/patchelf/commit/a365bcb7d7025da51b33165ef7ebc7180199a05e 7This patch also removes the DT_INIT symbols from needed_libs (DT_INIT 8points to library initialisation function, not to needed libraries...)] 9Signed-off-by: Wolfgang Grandegger <wg@grandegger.com> 10--- 11 src/patchelf.cc | 8 +++----- 12 1 file changed, 3 insertions(+), 5 deletions(-) 13 14diff --git a/src/patchelf.cc b/src/patchelf.cc 15index 136098f..c870638 100644 16--- a/src/patchelf.cc 17+++ b/src/patchelf.cc 18@@ -941,7 +941,6 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const string & newS 19 assert(strTabAddr == rdi(shdrDynStr.sh_addr)); 20 21 /* Walk through the dynamic section, look for the DT_SONAME entry. */ 22- static vector<string> neededLibs; 23 dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset)); 24 Elf_Dyn * dynSoname = 0; 25 char * soname = 0; 26@@ -949,8 +948,7 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const string & newS 27 if (rdi(dyn->d_tag) == DT_SONAME) { 28 dynSoname = dyn; 29 soname = strTab + rdi(dyn->d_un.d_val); 30- } else if (rdi(dyn->d_tag) == DT_INIT) 31- neededLibs.push_back(string(strTab + rdi(dyn->d_un.d_val))); 32+ } 33 } 34 35 if (op == printSoname) { 36@@ -1058,7 +1056,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string newRPath) 37 unless you use its `--enable-new-dtag' option, in which case it 38 generates a DT_RPATH and DT_RUNPATH pointing at the same 39 string. */ 40- static vector<string> neededLibs; 41+ vector<string> neededLibs; 42 dyn = (Elf_Dyn *) (contents + rdi(shdrDynamic.sh_offset)); 43 Elf_Dyn * dynRPath = 0, * dynRunPath = 0; 44 char * rpath = 0; 45@@ -1091,7 +1089,7 @@ void ElfFile<ElfFileParamNames>::modifyRPath(RPathOp op, string newRPath) 46 /* For each directory in the RPATH, check if it contains any 47 needed library. */ 48 if (op == rpShrink) { 49- static vector<bool> neededLibFound(neededLibs.size(), false); 50+ vector<bool> neededLibFound(neededLibs.size(), false); 51 52 newRPath = ""; 53 54-- 551.9.1 56 57