Implementing native TLS on OS X in DMD

Jacob Carlborg via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jan 8 08:40:15 PST 2016


On 2016-01-08 16:32, David Nadlinger via digitalmars-d-ldc wrote:

> It's been a while since I initially looked into getting the TLS to work,
> but did you check that _chars is properly aligned (i.e. to 8 bytes on
> x86_64)? This would be one way how the GC could miss the pointer even
> though the global is contained in a root range.

That seemed to be the issue, it works now. Awesome :) thanks. A followup 
question:

* I'm looking at the assembly output of LDC, it looks liked LDC aligns 
to the size of the type, i.e. "int" to 4 and "long" to 8 and so on, is 
that the case?

* It looks like the only uses the above form of alignment if the symbol 
is placed in the __thread_bss section, i.e. doesn't have an initializer. 
Does that make sense? If it's has a initializer and is placed in the 
__thread_data section it will have the alignment of 3 or 4, depending of 
the size of the variable.

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list