aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/common
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
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')
-rw-r--r--benchmarks/common/crt.S12
-rw-r--r--benchmarks/common/syscalls.c5
-rw-r--r--benchmarks/common/test.ld7
3 files changed, 5 insertions, 19 deletions
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 */