Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \
Expand Down
24 changes: 24 additions & 0 deletions tests/endianness.sh
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions tests/endianness/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
all:
$(CC) -xc -nostdlib -shared -o libtest.so - <<< 'void test() {}'
$(CC) -xc -nostdlib -L. -ltest -o main - <<< 'void _start() {}'
Binary file added tests/endianness/ppc64/libtest.so
Binary file not shown.
Binary file added tests/endianness/ppc64/main
Binary file not shown.
Binary file added tests/endianness/ppc64le/libtest.so
Binary file not shown.
Binary file added tests/endianness/ppc64le/main
Binary file not shown.