diff options
author | Breno Rodrigues GuimarĂ£es <brenorg@gmail.com> | 2023-03-11 10:59:27 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-11 10:59:27 -0300 |
commit | ac212d0e6fb8b741e5a5e9ea61091149103f401c (patch) | |
tree | a93853a74f4a168d00849b7cfdb3c9732e34ee44 /tests | |
parent | ea2fca765c440fff1ff74e1463444dea7b819db2 (diff) | |
parent | 80f68669368ecfaac342077eb70109fb3c5d0ac7 (diff) | |
download | patchelf-ac212d0e6fb8b741e5a5e9ea61091149103f401c.tar.gz |
Merge pull request #475 from brenoguim/breno.474
Use the largest segment alignment for libraries requiring non-standard alignments #474
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 5 | ||||
-rwxr-xr-x | tests/set-rpath-library.sh | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 55a8f75..4ae540a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -119,7 +119,7 @@ check_DATA = libbig-dynstr.debug # - with libtool, it is difficult to control options # - with libtool, it is not possible to compile convenience *dynamic* libraries :-( check_PROGRAMS += libfoo.so libfoo-scoped.so libbar.so libbar-scoped.so libsimple.so libsimple-execstack.so libbuildid.so libtoomanystrtab.so \ - phdr-corruption.so many-syms-main libmany-syms.so + phdr-corruption.so many-syms-main libmany-syms.so liboveralign.so libbuildid_so_SOURCES = simple.c libbuildid_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,--build-id @@ -143,6 +143,9 @@ libbar_scoped_so_LDFLAGS = $(LDFLAGS_sharedlib) libsimple_so_SOURCES = simple.c libsimple_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,-z,noexecstack +liboveralign_so_SOURCES = simple.c +liboveralign_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,-z,max-page-size=0x10000 + libsimple_execstack_so_SOURCES = simple.c libsimple_execstack_so_LDFLAGS = $(LDFLAGS_sharedlib) -Wl,-z,execstack diff --git a/tests/set-rpath-library.sh b/tests/set-rpath-library.sh index 55661a1..6ae1715 100755 --- a/tests/set-rpath-library.sh +++ b/tests/set-rpath-library.sh @@ -14,6 +14,7 @@ mkdir -p "${SCRATCH}/libsB" cp main-scoped "${SCRATCH}/" cp libfoo-scoped.so "${SCRATCH}/libsA/" cp libbar-scoped.so "${SCRATCH}/libsB/" +cp liboveralign.so "${SCRATCH}/" oldRPath=$(../src/patchelf --print-rpath "${SCRATCH}"/main-scoped) if test -z "$oldRPath"; then oldRPath="/oops"; fi @@ -56,3 +57,12 @@ if test "$exitCode" != 46; then echo "bad exit code!" exit 1 fi + +# ALL loads should have the same alignment +lib="${SCRATCH}/liboveralign.so" +../src/patchelf --set-rpath "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" "$lib" +num_alignments=$(${READELF} -W -l "${lib}" | awk '/LOAD/ { print $NF }' | sort -u | wc -l) +echo "$num_alignments" +if test "${num_alignments}" -ne "1"; then + exit 1 +fi |