summaryrefslogtreecommitdiff
path: root/tests/set-rpath-rel-map.sh
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2021-12-11 09:57:42 -0300
committerFelipe Sateler <fsateler@debian.org>2021-12-11 09:57:42 -0300
commit9b7476ece31032443b23d0c29d3e2f8430ccd56f (patch)
tree3aa609323599e9a26284ae51c4b01f1511cf35d4 /tests/set-rpath-rel-map.sh
parent77df926e47945fe90439dc14392a03adcb23d40c (diff)
parent33f8b793d0121f1c837bc6f8df493059b060edd2 (diff)
Update upstream source from tag 'upstream/0.14.3'
Update to upstream version '0.14.3' with Debian dir 5fce376ddd9db80ca6268e7f6b779f9f1a71514b
Diffstat (limited to 'tests/set-rpath-rel-map.sh')
-rwxr-xr-xtests/set-rpath-rel-map.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/set-rpath-rel-map.sh b/tests/set-rpath-rel-map.sh
new file mode 100755
index 0000000..efc0943
--- /dev/null
+++ b/tests/set-rpath-rel-map.sh
@@ -0,0 +1,37 @@
+#! /bin/sh -e
+
+if ! objdump -p main | grep -q MIPS_RLD_MAP_REL; then
+ echo "No MIPS_RLD_MAP_REL dynamic section entry, skipping"
+ exit 0
+fi
+
+SCRATCH=scratch/$(basename $0 .sh)
+
+rm -rf ${SCRATCH}
+mkdir -p ${SCRATCH}
+mkdir -p ${SCRATCH}/libsA
+mkdir -p ${SCRATCH}/libsB
+
+cp main ${SCRATCH}/
+cp libfoo.so ${SCRATCH}/libsA/
+cp libbar.so ${SCRATCH}/libsB/
+
+# break the main executable by removing .rld_map section
+objcopy --remove-section .rld_map ${SCRATCH}/main
+
+oldRPath=$(../src/patchelf --print-rpath ${SCRATCH}/main)
+if test -z "$oldRPath"; then oldRPath="/oops"; fi
+../src/patchelf --force-rpath --set-rpath $oldRPath:$(pwd)/${SCRATCH}/libsA:$(pwd)/${SCRATCH}/libsB ${SCRATCH}/main
+
+if test "$(uname)" = FreeBSD; then
+ export LD_LIBRARY_PATH=$(pwd)/${SCRATCH}/libsB
+fi
+
+exitCode=0
+
+(cd ${SCRATCH} && ./main) || exitCode=$?
+
+if test "$exitCode" != 46; then
+ echo "bad exit code!"
+ exit 1
+fi