From d60e760e8096feac0fff494f9bb1a0538115a905 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 22 Apr 2014 09:45:39 +0200 Subject: bsps: Fix TLS support in linker command files The TLS section symbols had wrong values in case of an empty TLS data section and a nonempty TLS BSS section. --- c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom') diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom index a0f98019f9..321760aa6f 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom @@ -153,9 +153,11 @@ SECTIONS __TLS_BSS_end = .; } > ram __TLS_Data_size = __TLS_Data_end - __TLS_Data_begin; + __TLS_Data_begin = __TLS_Data_size != 0 ? __TLS_Data_begin : __TLS_BSS_begin; + __TLS_Data_end = __TLS_Data_size != 0 ? __TLS_Data_end : __TLS_BSS_begin; __TLS_BSS_size = __TLS_BSS_end - __TLS_BSS_begin; __TLS_Size = __TLS_BSS_end - __TLS_Data_begin; - __TLS_Alignment = ALIGNOF (.tdata); + __TLS_Alignment = MAX (ALIGNOF (.tdata), ALIGNOF (.tbss)); /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ . = ALIGN(128) + (. & (128 - 1)); -- cgit v1.2.3