glibc/scripts
Adhemerval Zanella 4f047d9ede
elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978)
For each input readelf output, localplt.awk parses each 'Relocation
section' entry, checks its offset against the dynamic section entry, and
saves each DT_JMPREL, DT_RELA, and DT_REL offset value it finds. After
all lines are read, the script checks if any segment offset differed
from 0, meaning at least one 'Relocation section' was matched.

However, if the shared object was built with RELR support and the static
linker could place all the relocation on DT_RELR, there would be no
DT_JMPREL, DT_RELA, and DT_REL entries; only a DT_RELR.

For the current three ABIs that support (aarch64, x86, and powerpc64),
the powerpc64 ld.so shows the behavior above. Both x86_64 and aarch64
show extra relocations on '.rela.dyn', which makes the script check to
succeed.

This patch fixes by handling DT_RELR, where the offset is checked
against the dynamic section entries and if the shared object contains an
entry it means that there are no extra PLT entries (since all
relocations are relative).

It fixes the elf/check-localplt failure on powerpc.

Checked with a build/check for aarch64-linux-gnu, x86_64-linux-gnu,
i686-linux-gnu, arm-linux-gnueabihf, s390x-linux-gnu, powerpc-linux-gnu,
powerpc64-linux-gnu, and powerpc64le-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-07-19 22:50:26 +02:00
..
abi-versions.awk
abilist.awk
backport-support.sh
build-many-glibcs.py
check-c++-types.sh
check-execstack.awk
check-initfini.awk
check-installed-headers.sh
check-local-headers.sh Adjust check-local-headers test for libaudit 4.0 2024-07-19 15:57:46 +02:00
check-localplt.awk
check-obsolete-constructs.py
check-textrel.awk
check-wrapper-headers.py
check-wx-segment.py
config-uname.sh
config.guess
config.sub
cpp
cross-test-ssh.sh
documented.sh
dso-ordering-test.py
evaluate-test.sh
firstversions.awk
gen-as-const.py
gen-libc-abis
gen-libc-modules.awk
gen-posix-conf-vars.awk
gen-rrtypes.py
gen-sorted.awk
gen-tunables.awk tunables: sort tunables list (BZ 30027) 2024-06-12 14:45:18 -04:00
glibc_shared_code.py
glibcelf.py
glibcextract.py
glibcpp.py
glibcsymbols.py
haveversions.awk
install-sh
lib-names.awk
lint-makefiles.sh
list-fixed-bugs.py
list-sources.sh
localplt.awk elf: Fix localplt.awk for DT_RELR-enabled builds (BZ 31978) 2024-07-19 22:50:26 +02:00
merge-test-results.sh
mkinstalldirs
move-if-change
move-symbol-to-libc.py
process-advisories.sh
pylint
pylintrc
rellns-sh
sort-makefile-lines.py
soversions.awk
sysd-rules.awk
test_printers_common.py
test_printers_exceptions.py
test-installation.pl
tst-elf-edit.py
tst-ld-trace.py
update-abilist.sh
update-copyrights
vcstocl_quirks.py
versionlist.awk
versions.awk