diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-01-31 15:08:42 (GMT) |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-01-31 15:08:42 (GMT) |
commit | 94f38d26bce27c813858223f9c3818b7435438e7 (patch) | |
tree | 48d4f83455f6c3b3fa0c193eaaeb8849a4ce1212 | |
parent | 56cae84500ca807079376d9fa6c5483f240c5b33 (diff) | |
download | patchelf-94f38d26bce27c813858223f9c3818b7435438e7.zip patchelf-94f38d26bce27c813858223f9c3818b7435438e7.tar.gz patchelf-94f38d26bce27c813858223f9c3818b7435438e7.tar.bz2 |
* .rel.plt is called .rela.plt on x86_64-linux.
-rw-r--r-- | src/patchelf.cc | 8 | ||||
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rwxr-xr-x | tests/shrink-rpath.sh (renamed from tests/shrink.sh) | 10 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 9dba988..4e84877 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -480,8 +480,12 @@ void ElfFile<ElfFileParamNames>::rewriteSections() dyn->d_un.d_ptr = findSection(".dynsym").sh_addr; else if (dyn->d_tag == DT_HASH) dyn->d_un.d_ptr = findSection(".hash").sh_addr; - else if (dyn->d_tag == DT_JMPREL) - dyn->d_un.d_ptr = findSection(".rel.plt").sh_addr; + else if (dyn->d_tag == DT_JMPREL) { + Elf_Shdr * shdr = findSection2(".rel.plt"); + if (!shdr) shdr = findSection2(".rela.plt"); /* 64-bit Linux */ + if (!shdr) error("cannot find .rel.plt or .rela.plt"); + dyn->d_un.d_ptr = shdr->sh_addr; + } else if (dyn->d_tag == DT_REL) { /* !!! hack! */ Elf_Shdr * shdr = findSection2(".rel.dyn"); /* no idea if this makes sense, but it was needed for some diff --git a/tests/Makefile.am b/tests/Makefile.am index 1b8baba..5772fbb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,6 +1,6 @@ check_PROGRAMS = main simple big-dynstr -TESTS = plain-fail.sh plain-run.sh shrink.sh set-interpreter-short.sh \ +TESTS = plain-fail.sh plain-run.sh shrink-rpath.sh set-interpreter-short.sh \ set-interpreter-long.sh set-rpath.sh no-rpath.sh big-dynstr.sh TESTS_ENVIRONMENT = PATCHELF_DEBUG=1 diff --git a/tests/shrink.sh b/tests/shrink-rpath.sh index a60911c..e0c82c1 100755 --- a/tests/shrink.sh +++ b/tests/shrink-rpath.sh @@ -19,4 +19,12 @@ if echo "$rpath" | grep -q /no-such-path; then exit 1 fi -LD_LIBRARY_PATH=. ./main +cp libfoo.so scratch/ + +exitCode=0 +cd scratch && LD_LIBRARY_PATH=. ../main || exitCode=$? + +if test "$exitCode" != 46; then + echo "bad exit code!" + exit 1 +fi |