musl/arch
Rich Felker 6ba5517a46 fix local-dynamic model TLS on mips and powerpc
the TLS ABI spec for mips, powerpc, and some other (presently
unsupported) RISC archs has the return value of __tls_get_addr offset
by +0x8000 and the result of DTPOFF relocations offset by -0x8000. I
had previously assumed this part of the ABI was actually just an
implementation detail, since the adjustments cancel out. however, when
the local dynamic model is used for accessing TLS that's known to be
in the same DSO, either of the following may happen:

1. the -0x8000 offset may already be applied to the argument structure
passed to __tls_get_addr at ld time, without any opportunity for
runtime relocations.

2. __tls_get_addr may be used with a zero offset argument to obtain a
base address for the module's TLS, to which the caller then applies
immediate offsets for individual objects accessed using the local
dynamic model. since the immediate offsets have the -0x8000 adjustment
applied to them, the base address they use needs to include the
+0x8000 offset.

it would be possible, but more complex, to store the pointers in the
dtv[] array with the +0x8000 offset pre-applied, to avoid the runtime
cost of adding 0x8000 on each call to __tls_get_addr. this change
could be made later if measurements show that it would help.
2015-06-25 22:22:00 +00:00
..
aarch64 add .text section directive to all crt_arch.h files missing it 2015-05-22 01:50:05 -04:00
arm arm: add vdso support 2015-06-14 04:23:20 +00:00
i386 fix inconsistency in a_and and a_or argument types on x86[_64] 2015-05-20 00:17:35 -04:00
microblaze add .text section directive to all crt_arch.h files missing it 2015-05-22 01:50:05 -04:00
mips fix local-dynamic model TLS on mips and powerpc 2015-06-25 22:22:00 +00:00
or1k add .text section directive to all crt_arch.h files missing it 2015-05-22 01:50:05 -04:00
powerpc fix local-dynamic model TLS on mips and powerpc 2015-06-25 22:22:00 +00:00
sh switch to using trap number 31 for syscalls on sh 2015-06-16 15:25:02 +00:00
x32 fix inconsistency in a_and and a_or argument types on x86[_64] 2015-05-20 00:17:35 -04:00
x86_64 fix inconsistency in a_and and a_or argument types on x86[_64] 2015-05-20 00:17:35 -04:00