[LLVMdev] [MCJIT] TLS relocation design
Tim Northover
t.p.northover at gmail.com
Wed Jan 14 15:11:26 PST 2015
> As noted in the bug report, I have an implementation implementation of this
> for ELF/x86_64, so I'll start by describing what was necessary to get that
> running (I did this a year ago, so this is my best recollection). For
> starters, this link describes the general ELF ABI much better than I could
> (it has illustrations!): http://www.akkadia.org/drepper/tls.pdf.
It's been a while since I knew this stuff well, but that looks like
it's describing the old version of TLS. A more optimised specification
has been created since (and it's what AArch64 uses exclusively as far
as I'm aware). This looks like the documentation I read before:
http://www.fsfla.org/~lxoliva/writeups/TLS/RFC-TLSDESC-x86.txt
> Thus it seems, for ELF, all that's required of a potential TLS
> implementation class is a `TLSdlsym` that gives us the module and offset
> information. I'd like to find out what we need to handle Darwin and Windows
> (does somebody have a good reference that describes the TLS scheme on these
> platforms). Perhaps we can also talk to the C library maintainers to get an
> API that gives us this information directly.
I think Darwin's is currently a fairly thin wrapper around the
pthread_key_* functions. It's mostly undocumented, unfortunately, and
I'm not sure I ever knew exactly what the linker & dynamic loader's
responsibilities were.
Cheers.
Tim.
More information about the llvm-dev
mailing list