grow-test: fix on non-gcc systems

This commit is contained in:
Jörg Thalheim
2021-09-13 17:55:05 +02:00
parent a4ae03d638
commit 90da38b8cf
3 changed files with 8 additions and 4 deletions

1
.gitignore vendored
View File

@@ -31,3 +31,4 @@ Makefile
/tests/main-scoped
/tests/libbig-dynstr.debug
/tests/contiguous-note-sections
/tests/simple-pie

View File

@@ -2,7 +2,7 @@ LIBS =
STRIP ?= strip
check_PROGRAMS = simple main too-many-strtab main-scoped big-dynstr no-rpath contiguous-note-sections
check_PROGRAMS = simple-pie simple main too-many-strtab main-scoped big-dynstr no-rpath contiguous-note-sections
no_rpath_arch_TESTS = \
no-rpath-amd64.sh \
@@ -68,6 +68,9 @@ simple_SOURCES = simple.c
# no -fpic for simple.o
simple_CFLAGS =
simple_pie_SOURCES = simple.c
simple_pie_CFLAGS = -fPIC -pie
main_SOURCES = main.c
main_LDADD = -lfoo $(AM_LDADD)
main_DEPENDENCIES = libfoo.so

View File

@@ -5,12 +5,12 @@ SCRATCH=scratch/$(basename $0 .sh)
rm -rf ${SCRATCH}
mkdir -p ${SCRATCH}
g++ -x c -fPIC -pie -o ${SCRATCH}/simple simple.c
cp simple-pie ${SCRATCH}/simple-pie
# Add a 40MB rpath
head -c 40000000 /dev/urandom > ${SCRATCH}/foo.bin
# Grow the file
../src/patchelf --add-rpath @${SCRATCH}/foo.bin ${SCRATCH}/simple
../src/patchelf --add-rpath @${SCRATCH}/foo.bin ${SCRATCH}/simple-pie
# Make sure we can still run it
${SCRATCH}/simple
${SCRATCH}/simple-pie