]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gold: Add --pack-dyn-relocs=relr for arm/aarch64/x86-64 [PR 28601] users/maskray/gold-relr
authorFangrui Song <maskray@google.com>
Thu, 25 Nov 2021 02:05:45 +0000 (18:05 -0800)
committerFangrui Song <maskray@google.com>
Fri, 3 Dec 2021 22:59:51 +0000 (14:59 -0800)
commitf48364f97320ffc60dd4b567dd4e4f2336c5e619
treefb1125ae7212902da6f886238aa9ebb02e0c2b46
parent92228a334ba2a775277fc4a8441dd926c26d33c1
gold: Add --pack-dyn-relocs=relr for arm/aarch64/x86-64 [PR 28601]

elfcpp/
    * elfcpp.h (SHT): New constant SHT_RELR.
    (DT): New constants DT_SYMTAB_SHNDX/DT_RELRSZ/DT_RELR/DT_RELRENT.
    (Elf_sizes): New static data member relr_size.
gold/
    * options.h (class General_options): Add pack_dyn_relocs,
    Pack_dyn_relocs, relr_relocs, and pack_dyn_relocs_enum_.
    * options.cc (General_options::relr_relocs): Define.
    * reloc-types.h (Reloc_types<elfcpp::SHT_RELR, size, big_endian>):
    New.
    * layout.h (Layout::add_target_dynamic_tags): Add dyn_relr.
    * layout.cc (Layout::add_target_dynamic_tags): Add dyn_relr.
    * output.h (set_current_data_size_for_child): Remove assert.
    (Output_reloc<elfcpp::SHT_RELR, dynamic, size, big_endian>): New.
    (Output_data_reloc<elfcpp::SHT_RELR, dynamic, size, big_endian>): New.
    * output.cc (Output_data_reloc_base): Set entsize for SHT_RELR.
    (do_write): Define.
    (Output_data_reloc<elfcpp::SHT_RELR, true, *, *>): Instantiate.
    * aarch64.cc (Target_aarch64): Add Relr_section,
    relr_dyn_section, and relr_dyn_.
    (do_relax): Check SHT_RELR.
    (Target_aarch64::Scan::local): Check SHT_RELR.
    (Target_aarch64::Scan::global): Check SHT_RELR.
    * arm.cc (Target_arm): Add Relr_section,
    relr_dyn_section, and relr_dyn_.
    (do_relax): Check SHT_RELR.
    (Target_arm::Scan::local): Check SHT_RELR.
    (Target_arm::Scan::global): Check SHT_RELR.
    * x86_64.cc (Target_x86_64): Add Relr_section,
    relr_dyn_section, and relr_dyn_.
    (do_relax): Check SHT_RELR.
    (Target_x86_64::Scan::local): Check SHT_RELR.
    (Target_x86_64::Scan::global): Check SHT_RELR.
    * testsuite/Makefile.am: New tests relr_arm.sh relr_aarch64.sh
      relr_x86_64.sh.
    * testsuite/relr_1.s: New.
17 files changed:
elfcpp/elfcpp.h
gold/aarch64.cc
gold/arm.cc
gold/layout.cc
gold/layout.h
gold/options.cc
gold/options.h
gold/output.cc
gold/output.h
gold/reloc-types.h
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/relr_1.s [new file with mode: 0644]
gold/testsuite/relr_aarch64.sh [new file with mode: 0755]
gold/testsuite/relr_arm.sh [new file with mode: 0755]
gold/testsuite/relr_x86_64.sh [new file with mode: 0755]
gold/x86_64.cc