summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFarid Zakaria <farid.m.zakaria@gmail.com>2021-12-21 14:30:45 -0800
committerFarid Zakaria <farid.m.zakaria@gmail.com>2021-12-21 14:30:45 -0800
commitb92a6e895140c41535edb813f366d0fe00fba4fa (patch)
tree1183391c933e4c877600629f33de3d40153675ac /tests
parente589fe3387737db16456dc954ca36bdac7afa53e (diff)
downloadpatchelf-b92a6e895140c41535edb813f366d0fe00fba4fa.tar.gz
Fix replace-add-needed.sh test for musl
Diffstat (limited to 'tests')
-rwxr-xr-xtests/replace-add-needed.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/replace-add-needed.sh b/tests/replace-add-needed.sh
index 4c88fd9..ab0d353 100755
--- a/tests/replace-add-needed.sh
+++ b/tests/replace-add-needed.sh
@@ -9,10 +9,9 @@ cp simple ${SCRATCH}/
cp libfoo.so ${SCRATCH}/
cp libbar.so ${SCRATCH}/
-
cd ${SCRATCH}
-libcldd=$(ldd ./simple | awk '/ => / { print $3 }' | grep .so | head -n 1)
+libcldd=$(ldd ./simple | awk '/ => / { print $3 }' | grep -E "(libc.so|ld-musl)")
# We have to set the soname on these libraries
${PATCHELF} --set-soname libbar.so ./libbar.so
@@ -20,6 +19,11 @@ ${PATCHELF} --set-soname libbar.so ./libbar.so
# Add a libbar.so so we can rewrite it later
${PATCHELF} --add-needed libbar.so ./simple
+# Make the NEEDED in libfoo the same as simple
+# This is a current "bug" in musl
+# https://www.openwall.com/lists/musl/2021/12/21/1
+${PATCHELF} --replace-needed libbar.so $(readlink -f ./libbar.so) ./libfoo.so
+
${PATCHELF} --replace-needed libc.so.6 ${libcldd} \
--replace-needed libbar.so $(readlink -f ./libbar.so) \
--add-needed $(readlink -f ./libfoo.so) \
@@ -31,4 +35,4 @@ exitCode=0
if test "$exitCode" != 0; then
ldd ./simple
exit 1
-fi
+fi \ No newline at end of file