diff options
author | Fangrui Song <maskray@google.com> | 2021-11-24 18:05:45 -0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2021-12-03 14:59:51 -0800 |
commit | f48364f97320ffc60dd4b567dd4e4f2336c5e619 (patch) | |
tree | fb1125ae7212902da6f886238aa9ebb02e0c2b46 /elfcpp/elfcpp.h | |
parent | 92228a334ba2a775277fc4a8441dd926c26d33c1 (diff) | |
download | binutils-users/maskray/gold-relr.zip binutils-users/maskray/gold-relr.tar.gz binutils-users/maskray/gold-relr.tar.bz2 |
gold: Add --pack-dyn-relocs=relr for arm/aarch64/x86-64 [PR 28601]users/maskray/gold-relr
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.
Diffstat (limited to 'elfcpp/elfcpp.h')
-rw-r--r-- | elfcpp/elfcpp.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h index fdee7ce..cce002a 100644 --- a/elfcpp/elfcpp.h +++ b/elfcpp/elfcpp.h @@ -358,6 +358,7 @@ enum SHT SHT_PREINIT_ARRAY = 16, SHT_GROUP = 17, SHT_SYMTAB_SHNDX = 18, + SHT_RELR = 19, SHT_LOOS = 0x60000000, SHT_HIOS = 0x6fffffff, SHT_LOPROC = 0x70000000, @@ -726,6 +727,11 @@ enum DT DT_PREINIT_ARRAY = 32, DT_PREINIT_ARRAYSZ = 33, + DT_SYMTAB_SHNDX = 34, + DT_RELRSZ = 35, + DT_RELR = 36, + DT_RELRENT = 37, + DT_LOOS = 0x6000000d, DT_HIOS = 0x6ffff000, DT_LOPROC = 0x70000000, @@ -1071,6 +1077,7 @@ struct Elf_sizes // Sizes of ELF reloc entries. static const int rel_size = sizeof(internal::Rel_data<size>); static const int rela_size = sizeof(internal::Rela_data<size>); + static const int relr_size = sizeof(typename Elf_types<size>::Elf_WXword); // Size of ELF dynamic entry. static const int dyn_size = sizeof(internal::Dyn_data<size>); // Size of ELF version structures. |