From 5c5a4843ec385a60954fbbc4bcf5b64763639bd3 Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Tue, 20 Mar 2018 10:55:29 +0100 Subject: [ARM] Add TLS relocations for FDPIC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define and handle TLS relocations for FDPIC in BFD and gas. In gas, the new relocations are rejected if the --fdpic option was not specified. We also define the __tdata_start symbol to mark the start of the .tdata section. This allows FDPIC static binaries to find the start of .tdata section, since phdr->p_vaddr of TLS segment is not a valid value for FDPIC. 2018-04-25 Christophe Lyon Mickaël Guêné bfd/: * bfd-in2.h (BFD_RELOC_ARM_TLS_GD32_FDPIC) (BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC): New relocations. * elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC relocations. (elf32_arm_reloc_map): Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC. (struct elf32_arm_link_hash_table): Update comment. (elf32_arm_final_link_relocate): Handle TLS FDPIC relocations. (IS_ARM_TLS_RELOC): Likewise. (elf32_arm_check_relocs): Likewise. (allocate_dynrelocs_for_symbol): Likewise. (elf32_arm_size_dynamic_sections): Update comment. * reloc.c: Add BFD_RELOC_ARM_TLS_GD32_FDPIC, BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC. gas/ * config/tc-arm.c (reloc_names): Add TLSGD_FDPIC, TLSLDM_FDPIC, GOTTPOFF_FDIC relocations. (md_apply_fix): Handle the new TLS FDPIC relocations. (tc_gen_reloc): Likewise. (arm_fix_adjustable): Likewise. include/ * elf/arm.h: Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC. ld/ * scripttempl/elf.sc: Define __tdata_start for .tdata section. --- ld/ChangeLog | 5 +++++ ld/scripttempl/elf.sc | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index d9900b5..30de4cb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,6 +1,11 @@ 2018-04-25 Christophe Lyon Mickaël Guêné + * scripttempl/elf.sc: Define __tdata_start for .tdata section. + +2018-04-25 Christophe Lyon + Mickaël Guêné + * emulparams/armelf_linux_fdpiceabi.sh: Add .rofixup section. 2018-04-25 Christophe Lyon diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 9787ab5..5ccdd41 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -587,7 +587,11 @@ cat <