summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorDmitry Chestnykh <dm.chestnykh@gmail.com>2024-02-06 09:13:41 +0300
committerWaldemar Brodkorb <wbx@openadk.org>2024-02-07 13:47:28 +0100
commit395f920c0a29dd565a66b268ea00fc444ae64086 (patch)
tree78e0c6905d3f98b1e53c5c562dea9f99c4e69983 /libc
parent0fef8e7e0661daa17a9ca17b087f55dcb752b378 (diff)
ld.so: Add support of DT_RELR relocation format.
Nowadays modern libcs like Glibc and musl currently support processing of RELATIVE relocations compressed with DT_RELR format. However I have noticed that uClibc-ng doesn't support this feature and if the source will be linked with `-Wl,-z,pack-relative-relos` (bfd) or `-Wl,--pack-dyn-relocs=relr` (lld) then ld.so cannot properly load the produced DSO. This patch is intended to fix this issue and adds applying of DT_RELR relative relocation. Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/internals/reloc_static_pie.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/misc/internals/reloc_static_pie.c b/libc/misc/internals/reloc_static_pie.c
index ab1923024..81af7d666 100644
--- a/libc/misc/internals/reloc_static_pie.c
+++ b/libc/misc/internals/reloc_static_pie.c
@@ -53,6 +53,9 @@ reloc_static_pie(ElfW(Addr) load_addr)
PERFORM_BOOTSTRAP_GOT(tpnt);
#endif
+#if !defined(__FDPIC__)
+ DL_RELOCATE_RELR(tpnt);
+#endif
#if defined(ELF_MACHINE_PLTREL_OVERLAP)
# define INDX_MAX 1