[PATCH v1] Fix elf_irel for static-pie

Siva Chandra sivachandra@google.com
Wed Mar 20 18:04:00 GMT 2019


Currently, elf_irel does not account for the load address in case of
static-pie. This change makes _dl_relocate_static_pie return the load
address, which is then passed to elf_irel so that it can adjust for the
load address.

I do not know of any released linker which can exercise this correctly
that I can write tests.

ChangeLog:

        * csu/libc-start.c (apply_irel): Add new argument load_addr.
        (LIBC_START_MAIN): Pass return value from _dl_relocate_static_pie
        to ARCH_SETUP_IREL.
        * csu/static-reloc.c (_dl_relocate_static_pie): Return 0.
        * elf/dl-reloc-static-pie.c (_dl_relocate_static_pie): Return
        load address.
        * sysdeps/generic/ldsodefs.h (_dl_relocate_static_pie): Add
        ElfW(Addr) as return type.
        * sysdeps/generic/libc-start.h (ARCH_SETUP_IREL): Add load_addr
        argument.
        * sysdeps/mach/hurd/libc-start.h (ARCH_SETUP_IREL): Likewise.
        * sysdeps/unix/sysv/linux/powerpc/libc-start.h (ARCH_SETUP_IREL):
        Likewise.
        * sysdeps/x86/libc-start.h (ARCH_SETUP_IREL): Likewise.
        * sysdeps/x86_64/dl-irel.h (elf_irela): Add new argument load_addr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: elf_irel_patch_v1
Type: application/octet-stream
Size: 5619 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20190320/b743c9b3/attachment.obj>


More information about the Libc-alpha mailing list