[AArch64] Allow COPY relocation elimination
authorJiong Wang <jiong.wang@arm.com>
Wed, 7 Jun 2017 11:05:39 +0000 (12:05 +0100)
committerJiong Wang <jiong.wang@arm.com>
Thu, 8 Jun 2017 08:43:39 +0000 (09:43 +0100)
commitbc327528fd2ccdc6c29ab6ae608085dddbad5cc8
tree638acdde987efeeca8a92b0861f0767fc0ee69d1
parent81b6fe3bf9f3be2b6b81d05d08ac58d2a6dcb760
[AArch64] Allow COPY relocation elimination

  As discussed at the PR, this patch tries to avoid COPY relocation generation
and propagate the original relocation into runtime if it was relocating on
writable section.  The ELIMINATE_COPY_RELOCS has been set to true and it's
underlying infrastructure has been improved so that the COPY reloc elimination
at least working on absoluate relocations (ABS64) after this patch.

bfd/
        PR ld/21532
        * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
        (elfNN_aarch64_final_link_relocate): Also propagate relocations to
        runtime for copy relocation elimination cases.
        (alias_readonly_dynrelocs): New function.
        (elfNN_aarch64_adjust_dynamic_symbol): Keep the dynamic relocs instead
        of generating copy relocation if it is not against read-only sections.
        (elfNN_aarch64_check_relocs): Likewise.

ld/
        * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test.
        * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file.
        * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcase.
bfd/ChangeLog
bfd/elfnn-aarch64.c
ld/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/copy-reloc-eliminate.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s [new file with mode: 0644]