diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-07-16 07:57:45 -0300 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2024-07-23 19:05:38 +0200 |
commit | cb19cef087eaa551568739aa5b59cf97b8d5da1e (patch) | |
tree | 04a4a4c8ce18f12bb4c8b8d5b4220c4f0fc688cc /sysdeps/i386/dl-machine.h | |
parent | f6a75fddf4e71545c63dfcad99cc2df9bac38093 (diff) | |
download | glibc-cb19cef087eaa551568739aa5b59cf97b8d5da1e.zip glibc-cb19cef087eaa551568739aa5b59cf97b8d5da1e.tar.gz glibc-cb19cef087eaa551568739aa5b59cf97b8d5da1e.tar.bz2 |
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>
(cherry picked from commit 4f047d9edecb1a9b796a9a904dcd42bd3cc3d3b6)
Diffstat (limited to 'sysdeps/i386/dl-machine.h')
0 files changed, 0 insertions, 0 deletions