aboutsummaryrefslogtreecommitdiff
path: root/elfcpp/aarch64.h
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2014-09-17 14:14:59 -0700
committerJing Yu <jingyu@google.com>2014-09-17 14:24:10 -0700
commit3a53193762d8c42fd50daa15034c7326af6ce037 (patch)
tree27394a7649d3f7a4abe6d2010a5ec7d104e997b1 /elfcpp/aarch64.h
parent5e43d46791c4c66fd83947a12d4f716b561a9103 (diff)
downloadgdb-3a53193762d8c42fd50daa15034c7326af6ce037.zip
gdb-3a53193762d8c42fd50daa15034c7326af6ce037.tar.gz
gdb-3a53193762d8c42fd50daa15034c7326af6ce037.tar.bz2
Add tls support to gold aarch64 backend.
elfcpp/ChangeLog: 2014-09-17 Han Shen <shenhan@google.com> * aarch64.h (R_AARCH64_TLS_DTPREL64): Switch enum value with ... (R_AARCH64_TLS_DTPMOD64): ... enum value. gold/ChangeLog: 2014-09-17 Han Shen <shenhan@google.com> Jing Yu <jingyu@google.com> * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC, TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL. * aarch64.cc (Target_aarch64): Add data members got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_, tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in constructor. (Target_aarch64::do_reloc_symbol_index): New method. (Target_aarch64::do_reloc_addend): New method. (Target_aarch64::add_tlsdesc_info): New method. (Target_aarch64::do_dynsym_value): New method. (Target_aarch64::do_make_data_plt): Add new parameters: got, got_irelative. Pass them to Output_data_plt_aarch64_standard. (Target_aarch64::make_data_plt): Add new parameters: got, got_irelative. Pass them to do_make_data_plt. (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable. (Target_aarch64::Relocate:tls_gd_to_le): New method. (Target_aarch64::Relocate:tls_ie_to_le): New method. (Target_aarch64::Relocate:tls_desc_gd_to_le): New method. (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method. (Target_aarch64::got_tlsdesc_section): New method. (Target_aarch64::make_local_ifunc_plt_entry): New method. (Target_aarch64::define_tls_base_symbol): New method. (Target_aarch64::reserve_tlsdesc_entries): New method. (Target_aarch64::got_mod_index_entry): New method. (Target_aarch64::rela_tlsdesc_section): New method. (Target_aarch64::rela_irelative_section): New method. (Target_aarch64::Tlsdesc_info): New struct. (Target_aarch64::got_section): Create .got.plt space for IRELATIVE relocations and tlsdesc relocations. (Target_aarch64::optimize_tls_reloc): Implement method. (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_, got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them in constructor. (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method. (Output_data_plt_aarch64::has_tlsdesc_entry): New method. (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method. (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method. (Output_data_plt_aarch64::rela_tlsdesc): New method. (Output_data_plt_aarch64::rela_irelative): New method. (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations. (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute. (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method. (Output_data_plt_aarch64::fill_tlsdesc_entry): New method. (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method. (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method. (Output_data_plt_aarch64_standard): New member variables: plt_tlsdesc_entry_size, tlsdesc_plt_entry. (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard): New parameter: got, got_irelative. (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method. (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method. (Output_data_plt_aarch64::do_write): Replace got_address with gotplt_address. Add irelative_count_ to count. Write tlsdesc entry. (AArch64_relocate_functions::update_movnz): New method. (AArch64_relocate_functions): Correct format. (AArch64_relocate_functions::movnz): New method. (Target_aarch64::Scan::local): Correct format. Move r_sym, got to before the switch. Add new cases to switch. Check ie_to_le relaxation on tlsie relocations. Add code handling tlsgd tlsdesc cases. (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when needed. Add new cases to switch. Insert dynamic RELATIVE relocation when needed. Add code handling tlsgd, tlsie, tlsdesc cases. Call reloc_name_in_error_message to print unsupported reloc. (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to make_data_plt. (Target_aarch64::do_finalize_sections): Emit relocs to save COPY relocs. Fill in some more dynamic tags. (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs. Skip call tls_get_addr when tlsgd is relaxed. (Target_aarch64::Relocate::relocate_tls): Correct format. Add code handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le, tlsdesc->ie relaxation.
Diffstat (limited to 'elfcpp/aarch64.h')
-rw-r--r--elfcpp/aarch64.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/elfcpp/aarch64.h b/elfcpp/aarch64.h
index 52ac3ea..55a5dfa 100644
--- a/elfcpp/aarch64.h
+++ b/elfcpp/aarch64.h
@@ -171,8 +171,12 @@ enum
R_AARCH64_GLOB_DAT = 1025, // S + A
R_AARCH64_JUMP_SLOT = 1026, // S + A
R_AARCH64_RELATIVE = 1027, // Delta(S) + A
- R_AARCH64_TLS_DTPREL64 = 1028, // DTPREL(S+A)
- R_AARCH64_TLS_DTPMOD64 = 1029, // LDM(S)
+ // Note (shenhan): the following 2 relocs are different from elf spec from
+ // arm. In elf docs, TLS_DTPMOD64 is defined as 1029, TLS_DTPREL64 1028.
+ // While actually the bfd linker (and the dynamic linker) treates TLS_DTPMOD64
+ // as 1028, TLS_DTPREL64 1029. See binutils-gdb/include/elf/aarch64.h.
+ R_AARCH64_TLS_DTPMOD64 = 1028, // LDM(S)
+ R_AARCH64_TLS_DTPREL64 = 1029, // DTPREL(S+A)
R_AARCH64_TLS_TPREL64 = 1030, // TPREL(S+A)
R_AARCH64_TLSDESC = 1031, // TLSDESC(S+A)
R_AARCH64_IRELATIVE = 1032, // Indirect(Delta(S) + A)