aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/common/syscalls.c
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2019-12-11 00:10:41 +0000
committerAndrew Waterman <andrew@sifive.com>2019-12-10 16:10:41 -0800
commite3327dd12411678eadcb961718cb4feccce082b2 (patch)
tree8ee6ef103eb91ad000fb031834f3243bd3925fcc /benchmarks/common/syscalls.c
parent9e3decb78644b7fce690acb217b295a40b86ef12 (diff)
downloadriscv-tests-e3327dd12411678eadcb961718cb4feccce082b2.zip
riscv-tests-e3327dd12411678eadcb961718cb4feccce082b2.tar.gz
riscv-tests-e3327dd12411678eadcb961718cb4feccce082b2.tar.bz2
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.
Diffstat (limited to 'benchmarks/common/syscalls.c')
-rw-r--r--benchmarks/common/syscalls.c5
1 files changed, 2 insertions, 3 deletions
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);
}