From e3327dd12411678eadcb961718cb4feccce082b2 Mon Sep 17 00:00:00 2001 From: James Clarke Date: Wed, 11 Dec 2019 00:10:41 +0000 Subject: benchmarks: Simplify TLS initialisation (#224) The symbols used to query the size of .tdata and .tbss need not be thread-local themselves; instead, make them linker script-provided non-thread-local symbols. --- benchmarks/common/crt.S | 12 ------------ benchmarks/common/syscalls.c | 5 ++--- benchmarks/common/test.ld | 7 +++---- 3 files changed, 5 insertions(+), 19 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S index d75e81e..f97c589 100644 --- a/benchmarks/common/crt.S +++ b/benchmarks/common/crt.S @@ -216,18 +216,6 @@ trap_entry: addi sp, sp, 272 mret -.section ".tdata.begin" -.globl _tdata_begin -_tdata_begin: - -.section ".tdata.end" -.globl _tdata_end -_tdata_end: - -.section ".tbss.end" -.globl _tbss_end -_tbss_end: - .section ".tohost","aw",@progbits .align 6 .globl tohost diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index 0a7d6b7..39547b3 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -96,10 +96,9 @@ int __attribute__((weak)) main(int argc, char** argv) static void init_tls() { register void* thread_pointer asm("tp"); - extern char _tls_data; - extern __thread char _tdata_begin, _tdata_end, _tbss_end; + extern char _tdata_begin, _tdata_end, _tbss_end; size_t tdata_size = &_tdata_end - &_tdata_begin; - memcpy(thread_pointer, &_tls_data, tdata_size); + memcpy(thread_pointer, &_tdata_begin, tdata_size); size_t tbss_size = &_tbss_end - &_tdata_end; memset(thread_pointer + tdata_size, 0, tbss_size); } diff --git a/benchmarks/common/test.ld b/benchmarks/common/test.ld index 4f8892e..679c4ba 100644 --- a/benchmarks/common/test.ld +++ b/benchmarks/common/test.ld @@ -49,15 +49,14 @@ SECTIONS /* thread-local data segment */ .tdata : { - _tls_data = .; - *(.tdata.begin) + _tdata_begin = .; *(.tdata) - *(.tdata.end) + _tdata_end = .; } .tbss : { *(.tbss) - *(.tbss.end) + _tbss_end = .; } /* End of uninitalized data segement */ -- cgit v1.1