aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome@forissier.org>2020-07-21 10:54:44 +0200
committerJérôme Forissier <jerome@forissier.org>2020-08-06 11:10:44 +0200
commitb011a82a6399c722ff1aa62c68456845d9a1be0f (patch)
treec712724456b78212b061f6874475e9db6259e10b
parent4566d1f34b4e902df500940ceacf04c9fd15b966 (diff)
ta: ta.ld.S: add .tdata and .tbss sections
Preparing for C++ support in TAs. TA object file generated by a thread-enabled toolchain (such as g++ built without --disable-threads) may contain .tdata* and .tbss* sections even if the application is single threaded. Those are similar to .data and .bss except that they are templates to be used by the runtime code to set up Thread Local Storage data blocks. This commit adds those two sections as well as related relocation sections (.rel.tdata, .rel.tbss, .rela.tdata, .rela.tbss). The fragments are copied from GCC's internal linker script (shown by -Wl,-verbose). They are inserted next to .dynamic and .got because they may all be part of a RELRO segment if the linker chooses to create one. In practice there can be only one RELRO segment [1] so sections have to be contiguous. Note that ldelf currently ignores RELRO. [1] https://reviews.llvm.org/D40029 Signed-off-by: Jerome Forissier <jerome@forissier.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r--ta/arch/arm/ta.ld.S6
1 files changed, 6 insertions, 0 deletions
diff --git a/ta/arch/arm/ta.ld.S b/ta/arch/arm/ta.ld.S
index 56645173..3c588158 100644
--- a/ta/arch/arm/ta.ld.S
+++ b/ta/arch/arm/ta.ld.S
@@ -48,11 +48,17 @@ SECTIONS {
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.got : { *(.got.plt) *(.got) }
.rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) }
.rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) }
.rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) }
.rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
+ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
+ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
+ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
.rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
.rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
.rel.dyn : { *(.rel.dyn) }