Shared Libraries [was Re: D 1.076 and 2.061 release]
John Colvin
john.loughran.colvin at gmail.com
Wed Jan 9 10:53:14 PST 2013
On Wednesday, 9 January 2013 at 10:38:33 UTC, Walter Bright wrote:
> On 1/9/2013 2:28 AM, Jacob Carlborg wrote:
>> On 2013-01-09 11:26, Jacob Carlborg wrote:
>>
>>> I think it sounds like that but I don't know. I'm just trying
>>> to figure
>>> out how TLS is implemented on Mac OS X 10.7+.
>>
>> Also, there's nothing else that calls this tlv_get_addr
>> function or the thunk so
>> I'm guessing it's the compiler that calls it.
>
> Watcha do is something like this:
>
> __thread int x;
> int foo() { return x; }
>
> Compile, disassemble, and look at the code generated and the
> fixup records. Then there's no need to guess :-)
Surely __thread is redundant there, seeing as x will be TLS by
default?
I tried disassembling this on os x 10.7.5
otool (the default tool for this on os x) just gave me this:
tls_test.o:
indirect symbol table offset is past end of file
(__TEXT,__text) section
It couldn't see any instructions at all.
gdb disas gives this:
0x0000000000000024 <D8tls_test3fooFZi+0>: push rbp
0x0000000000000025 <D8tls_test3fooFZi+1>: mov rbp,rsp
0x0000000000000028 <D8tls_test3fooFZi+4>: mov rdi,QWORD
PTR [rip+0x0] # 0x30 <D8tls_test3fooFZi+12>
0x0000000000000030 <D8tls_test3fooFZi+12>: call 0x35
<D8tls_test3fooFZi+17>
0x0000000000000035 <D8tls_test3fooFZi+17>: mov eax,DWORD
PTR [rax]
0x0000000000000037 <D8tls_test3fooFZi+19>: pop rbp
0x0000000000000038 <D8tls_test3fooFZi+20>: ret
More information about the Digitalmars-d-announce
mailing list