diff --git a/tests/Makefile.am b/tests/Makefile.am index 086ee55c..982b49d0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -28,6 +28,7 @@ src_TESTS = \ no-rpath-pie-powerpc.sh \ build-id.sh \ invalid-elf.sh \ + endianness.sh \ contiguous_note_sections.sh build_TESTS = \ diff --git a/tests/endianness.sh b/tests/endianness.sh new file mode 100755 index 00000000..23b4aead --- /dev/null +++ b/tests/endianness.sh @@ -0,0 +1,24 @@ +#! /bin/sh -e +SCRATCH=scratch/$(basename $0 .sh) +PATCHELF="../src/patchelf" + +for arch in ppc64 ppc64le; do + rm -rf ${SCRATCH} + mkdir -p ${SCRATCH} + + cp endianness/${arch}/main endianness/${arch}/libtest.so ${SCRATCH}/ + + rpath="${PWD}/${SCRATCH}" + + # set rpath to scratch dir + ${PATCHELF} --output ${SCRATCH}/main-rpath --set-rpath $rpath ${SCRATCH}/main + + # attempt to shrink rpath, should not result in empty rpath + ${PATCHELF} --output ${SCRATCH}/main-shrunk --shrink-rpath --debug ${SCRATCH}/main-rpath + + # check whether rpath is still present + if ! ${PATCHELF} --print-rpath ${SCRATCH}/main-shrunk | grep -q "$rpath"; then + echo "rpath was removed for ${arch}" + exit 1 + fi +done diff --git a/tests/endianness/Makefile b/tests/endianness/Makefile new file mode 100644 index 00000000..914e3630 --- /dev/null +++ b/tests/endianness/Makefile @@ -0,0 +1,3 @@ +all: + $(CC) -xc -nostdlib -shared -o libtest.so - <<< 'void test() {}' + $(CC) -xc -nostdlib -L. -ltest -o main - <<< 'void _start() {}' diff --git a/tests/endianness/ppc64/libtest.so b/tests/endianness/ppc64/libtest.so new file mode 100755 index 00000000..31340787 Binary files /dev/null and b/tests/endianness/ppc64/libtest.so differ diff --git a/tests/endianness/ppc64/main b/tests/endianness/ppc64/main new file mode 100755 index 00000000..c7c8869f Binary files /dev/null and b/tests/endianness/ppc64/main differ diff --git a/tests/endianness/ppc64le/libtest.so b/tests/endianness/ppc64le/libtest.so new file mode 100755 index 00000000..07d7611b Binary files /dev/null and b/tests/endianness/ppc64le/libtest.so differ diff --git a/tests/endianness/ppc64le/main b/tests/endianness/ppc64le/main new file mode 100755 index 00000000..386c3be7 Binary files /dev/null and b/tests/endianness/ppc64le/main differ