diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-22 09:45:39 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-04-22 09:51:17 +0200 |
commit | d60e760e8096feac0fff494f9bb1a0538115a905 (patch) | |
tree | b8cba4a1a5e2ad9f5004eb5779c9d512884420f2 /c/src/lib/libbsp/sh/gensh2 | |
parent | bsp/mbx8xx: Fix Makefile.am and bsp_specs (diff) | |
download | rtems-d60e760e8096feac0fff494f9bb1a0538115a905.tar.bz2 |
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.
Diffstat (limited to 'c/src/lib/libbsp/sh/gensh2')
-rw-r--r-- | c/src/lib/libbsp/sh/gensh2/startup/linkcmds | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram | 4 | ||||
-rw-r--r-- | c/src/lib/libbsp/sh/gensh2/startup/linkcmds.rom | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds index 3f7b8bb1cc..ab7e31e5d0 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds @@ -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)); diff --git a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram index 2260b835b5..c962e8f9a0 100644 --- a/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram +++ b/c/src/lib/libbsp/sh/gensh2/startup/linkcmds.ram @@ -152,9 +152,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)); 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)); |