__emutls_v & __emutls_t

Mike none at none.com
Sat Dec 21 18:01:09 PST 2013


I need to make a startup procedure for my ARM Cortex-M platform.  
In C/C++ this includs copying the .data segment to RAM and 
initializing the .bss segment to 0.

If I declare global variables in D as...

__gshared int GlobalDataVar = 2;
__gshared int GlobalBssVar;

... these get put in .data and .bss respectively, and I know what 
to do in my startup procedure:

However if I declare thread local variables in D as...

int TLSDataVar = 1;
int TLSBssVar;

... two symbols for each variable are created: one in the section 
".rodata.__emutls_t" and the other in section ".data.__emutls_v"

minlibd's linker script 
(https://bitbucket.org/timosi/minlibd/src/c4503befb556ff3edf04eeb63c384e0ea723a6aa/tools/ldscript4?at=default) 
does not deal with these sections, I'm assuming because my 
version of GDC (yesterday's 4.8.2 backport {Thanks Johannes}) has 
changes for supporting emulated TLS.

My GDC is configured with --disable-tls and --disable-threads, so 
I believe I could treat these the same as __gshared variables, 
but I need to first understand what these sections are and what 
they contain.

I know this may be more specific to GCC than GDC, but if you know 
something about these sections, please let me know, or point me 
to some resource that will help me understand them.

Thanks,
Mike


More information about the D.gnu mailing list