diff options
author | Christophe Lyon <christophe.lyon@st.com> | 2018-03-20 10:55:29 +0100 |
---|---|---|
committer | Christophe Lyon <christophe.lyon@linaro.org> | 2018-04-18 12:20:25 +0000 |
commit | 96f718fda4f8c490c7a8077f8225bd1ddf01ac02 (patch) | |
tree | ea051f3c9eddea86c768d2f758dc8b793ee0647e /ld | |
parent | 81104800e5786a8b54aaa0d66a94d91bba365daa (diff) | |
download | gdb-96f718fda4f8c490c7a8077f8225bd1ddf01ac02.zip gdb-96f718fda4f8c490c7a8077f8225bd1ddf01ac02.tar.gz gdb-96f718fda4f8c490c7a8077f8225bd1ddf01ac02.tar.bz2 |
[ARM] Add TLS relocations for FDPIC.
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-XX-XX Christophe Lyon <christophe.lyon@st.com>
Mickaël Guêné <mickael.guene@st.com>
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.
* Define __tdata_start symbol to mark start of .tdata section
This allow fdpic static binaries to find start of .tdata section
since phdr->p_vaddr of TLS segment is not a valid value for fdpic.
* Add fdpic tls specific relocations
Diffstat (limited to 'ld')
-rw-r--r-- | ld/scripttempl/elf.sc | 6 |
1 files changed, 5 insertions, 1 deletions
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 <<EOF .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) } /* Thread Local Storage sections */ - .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } + .tdata ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__tdata_start = .);}} + *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) + } .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } ${RELOCATING+${PREINIT_ARRAY}} |