TLS for iOS - how to proceed

Dan Olson zans.is.for.cans at yahoo.com
Tue Apr 1 08:31:08 PDT 2014


I decided to start a new thread specific to this problem.

I have all these pieces to make TLS work for D on iOS, just sitting on
my computer, but they need to go somewhere.  I'd like like to push this
up to https://github.com/smolt/ldc.git but I am not sure the best way to
proceed.  I am looking for advice.

First, here are the pieces:

1. Mods to LLVM: llvm is modified to emit code to lookup TLS vars
address.

2. The tlv code from Apple's dyld open source (threadLocalHelpers.s and
threadLocalVariables.c) is dropped into druntime and modified to
slightly to work for ARM.  This provides the same API as seen on MacOS
x86.

3. D runtime initSections() in sections_ldc.d makes a call to
tlv_initializer() (from threadLocalVariables.c) to set everything up.

Note - LDC compiler code does not change at all for iOS TLS - all
handled in LLVM.


Here are the issues:

What is best way to maintain and distribute the LLVM changes?

The tlv runtime support is currently in the form of modified copies of
Apple dyld open source.  How do we properly use this (licensing)?  Can
it go in druntime or should it go elsewhere?  Should it be
reimplemented?

Also, I'd like help making my LLVM changes better.  I didn't do things
the proper way (had to cheat with a const_cast).
-- 
Dan


More information about the digitalmars-d-ldc mailing list