[PATCH, libphobos] Implement GCC emutls in druntime

Iain Buclaw ibuclaw@gdcproject.org
Thu Apr 25 11:09:00 GMT 2019


On Thu, 25 Apr 2019 at 12:25, Johannes Pfau <johannespfau@gmail.com> wrote:
>
> This adds emulated TLS support to druntime.
> The main problem here is that the D garbage collector needs
> to be able to scan the TLS memory for pointers, which is not
> possible with the current libgcc implementation.
>
> This therefore reimplements the libgcc emutls
> support (__emutls_get_address, ...) in druntime, taking
> care to expose an interface for the GC to scan memory
> (_d_emutls_scan). Due to the library link order, in most
> cases D code will corrently call the implementation in
> druntime. Where this does not work is if a C program
> loads a D library, then the D library will continue to
> use the libgcc implementation. This can be fixed in
> GCC 10 in various ways, but for now this patch
> will allow most use cases for MinGW, OSX and other
> emutls targets to work.
>
> In section code, the  _d_emutls_scan function and
> _d_emutls_destroy functions need to be called. This
> patch implements this for the elf_shared sections code.
>
> Bootstrapped on x86_64 linux with --disable-tls, checked
> testsuite with --disable-tls and without. Initial review
> on https://github.com/D-Programming-GDC/gcc/pull/13
>

OK, as it unblocks getting libphobos support for OSX and other emutls targets.

--
Iain.



More information about the Gcc-patches mailing list