| Thread overview | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
November 11, 2014 shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
what's the status? I tried building druntime with 'make -f posix.mak dll' and got src/rt/sections.d(52): Error: static assert (is(typeof(__error) == void* function())) is false I'd be happy to put in some work to improve the situation, but a brief overview of the status quo would be useful. | ||||
November 11, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to John Colvin | On 2014-11-11 11:42, John Colvin wrote: > what's the status? > > I tried building druntime with 'make -f posix.mak dll' and got > > src/rt/sections.d(52): Error: static assert (is(typeof(__error) == > void* function())) is false > > > I'd be happy to put in some work to improve the situation, but a brief > overview of the status quo would be useful. The first step would be to implement native TLS, see this issue [1]. The next step that would probably be to look at the changes in druntime made for Linux to add support for shared libraries. I think a major part of that is in rt_sections.d or similar. There were some changes to the compiler as well, adding some hooks when a dynamic library is loaded. But that shouldn't be needed on OS X since the dynamic linker have native support for this. [1] https://issues.dlang.org/show_bug.cgi?id=9476 -- /Jacob Carlborg | |||
November 11, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 2014-11-11 15:05, Jacob Carlborg wrote: > The first step would be to implement native TLS, see this issue [1]. BTW, the reason to implement native TLS is because otherwise we need to implement basically what the dynamic linker is already doing for TLS our self. Since it would be nice to have native TLS support anyway I thought that was a better idea. -- /Jacob Carlborg | |||
November 14, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 11/11/2014 06:24 PM, Jacob Carlborg wrote:
> BTW, the reason to implement native TLS is because otherwise we need to
> implement basically what the dynamic linker is already doing for TLS our
> self. Since it would be nice to have native TLS support anyway I thought
> that was a better idea.
What's the situation of native TLS? Any docs?
What version of OSX is required?
| |||
November 14, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 11/11/2014 03:05 PM, Jacob Carlborg wrote: > > There were some changes to the compiler as well, adding some hooks when > a dynamic library is loaded. But that shouldn't be needed on OS X since > the dynamic linker have native support for this. Yes, you need a constructor and destructor in each shared library that call into druntime to register all modules, EH handlers and such things. There is some Mach-O support to be notified (via a callback) when a new shared library is loaded. It wasn't possible to unset that callback though, meaning it would segfault when druntime itself is unloaded. So either we get this runtime linker stuff to work or we simply use __attribute__((constructor))/__attribute__((destructor)) functions like on linux. | |||
November 14, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Friday, 14 November 2014 at 15:22:45 UTC, Martin Nowak wrote:
> What's the situation of native TLS? Any docs?
> What version of OSX is required?
10.7. And IMHO the most useful documentation for actually getting stuff done is the ld source code (opensource.apple.com).
David
| |||
November 14, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Tuesday, 11 November 2014 at 17:24:31 UTC, Jacob Carlborg wrote:
> On 2014-11-11 15:05, Jacob Carlborg wrote:
>
>> The first step would be to implement native TLS, see this issue [1].
>
> BTW, the reason to implement native TLS is because otherwise we need to implement basically what the dynamic linker is already doing for TLS our self. Since it would be nice to have native TLS support anyway I thought that was a better idea.
We're two releases into having native support for TLS in OSX now, so it probably is time to switch over.
| |||
November 15, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to David Nadlinger | On 2014-11-14 17:18, David Nadlinger wrote: > 10.7. And IMHO the most useful documentation for actually getting stuff > done is the ld source code (opensource.apple.com). There's also the source code for the compiler (Clang, LLVM) and the dynamic linker (dyld). -- /Jacob Carlborg | |||
November 15, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | On 2014-11-14 17:40, Sean Kelly wrote: > We're two releases into having native support for TLS in OSX now, so it > probably is time to switch over. There have been four releases of OS X which support TLS, 10.7-10.10. -- /Jacob Carlborg | |||
November 15, 2014 Re: shared libraries on OS X | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On 2014-11-14 16:26, Martin Nowak wrote: > There is some Mach-O support to be notified (via a callback) when a new > shared library is loaded. It wasn't possible to unset that callback > though, meaning it would segfault when druntime itself is unloaded. Right, I keep forgetting that. -- /Jacob Carlborg | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply