Implementing native TLS on OS X in DMD

Dan Olson via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sat Jan 9 11:48:35 PST 2016


Jacob Carlborg <doob at me.com> writes:

> On 2016-01-08 17:40, Jacob Carlborg wrote:
>
> Adding the assembly for convenience
>
>> * 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?
>
> Without initializer:
>
> .tbss __D4main1ai$tlv$init, 4, 3
>
> BTW, do you know that the above 3 is?

3 is alignment like .p2align (power of 2 alignment).
2^3 in this case (8-byte)

>> * 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.
>
> With initializer:
>
> 	.section	__DATA,__thread_data,thread_local_regular
> 	.align	3
> __D4main1ai$tlv$init:
> 	.long	4

Same 8-byte alignment (OSX .align is synonym for .p2align).

The tbss and tdata declarations match.


More information about the digitalmars-d-ldc mailing list