Skip to content

Commit ea2fca7

Browse files
bors[bot]brenoguim
andauthored
Merge #473
473: Other switches might set changed as true. Use extraStrings size. #416 r=Mic92 a=brenoguim Co-authored-by: Breno Rodrigues Guimaraes <[email protected]>
2 parents 12c1fe7 + fcb8fb7 commit ea2fca7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/patchelf.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2163,7 +2163,7 @@ void ElfFile<ElfFileParamNames>::renameDynamicSymbols(const std::unordered_map<s
21632163
}
21642164
}
21652165

2166-
if (changed)
2166+
if (!extraStrings.empty())
21672167
{
21682168
auto newStrTabSize = strTab.size() + extraStrings.size();
21692169
auto& newSec = replaceSection(".dynstr", newStrTabSize);

tests/rename-dynamic-symbols.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,9 @@ ${PATCHELF} --rename-dynamic-symbols ../map *
8282

8383
echo "# Run the patched tool and libraries"
8484
env LD_BIND_NOW=1 LD_LIBRARY_PATH=${PWD} ./many-syms-main
85+
86+
# Test that other switches still work when --rename-dynamic-symbols has no effect
87+
echo "SYMBOL_THAT_DOESNT_EXIST ANOTHER_NAME" > map
88+
${PATCHELF} --set-rpath changed_rpath --rename-dynamic-symbols map --output libnewrpath.so "$full_lib_name"
89+
[ "$(${PATCHELF} --print-rpath libnewrpath.so)" = changed_rpath ] || exit 1
90+

0 commit comments

Comments
 (0)