glibc/sysdeps/arm
Maciej W. Rozycki 9c82da17b5 [BZ #17078] ARM: R_ARM_TLS_DESC prelinker support
This is a change to the dynamic linker to add prelinker support for the
R_ARM_TLS_DESC relocation.  Two cases can be considered here, the usual
one where lazy binding is in use and the less frequent one, where
immediate binding is requested via the use of the DF_BIND_NOW dynamic
flag (e.g. by using the GNU linker's "-z now" option).

This change only handles the first case.  In this scenario the prelinker
does what the dynamic linker would do, that is it preinitialises
R_ARM_TLS_DESC relocations with a pointer to the lazy specialization as
provided with the DT_TLSDESC_PLT dynamic tag.  A conflict is
additionally created and in the conflict resolution path the dynamic
linker complements the work by initialising the object's pointer as
indicated by the DT_TLSDESC_GOT dynamic tag to the linker's internal
lazy specialization worker function and also providing the associated
link map in the second entry of the GOT.  This step is required, because
if prelinking is successful at the run time, then the dynamic linker's
elf_machine_runtime_setup() function isn't called that would normally do
so.

The second case remains unresolved, because support for that scenario
has not been implemented in the prelinker.  In this case the lazy
specialization is unavailable and the DT_TLSDESC_PLT dynamic tag is not
present.

The prelinker could assume the common case of static specialization and
resolve the relocation, but that would require the exposure of dynamic
linker's specialization worker function.  Furthermore the dynamic linker
would have to handle the relocation in the conflict resolution path and
see if the dynamic specialization should be used instead.  This however
would require access to data structures currently not made available to
the conflict resolution path and therefore a redesign of this part of
the dynamic linker.

Alternatively the prelinker could defer all processing to the dynamic
linker's conflict resolution path, but that would require similar access
to the said data structures.

Therefore the prelinker issues an error instead and the dynamic linker
has assertions to check that DT_TLSDESC_PLT and DT_TLSDESC_GOT are in
use in its conflict resolution path.

This change resolves all TLS failures in the prelinker testsuite, as
noted in the bug report, as well as the small test case provided there.
Unfortunately we don't seem to have any hooks to factor in the prelinker
(if present on a system) to testing, so at this time this fix has to
rely on using the prelinker test suite and enabling TLS descriptors
there for coverage.

	[BZ #17078]
	* sysdeps/arm/dl-machine.h (elf_machine_rela)
	[RESOLVE_CONFLICT_FIND_MAP]: Handle R_ARM_TLS_DESC relocation.
	(elf_machine_lazy_rel): Handle prelinked R_ARM_TLS_DESC entries.
2014-07-17 19:22:05 +01:00
..
armv6 Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
armv6t2 Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
armv7 Make armv7 strcmp assembly compatible with ARM mode and SFI. 2014-05-09 13:22:00 -07:00
bits ARM: Fix compiler warnings from atomic.h 2014-07-17 11:36:31 +01:00
include/bits ARM: Add SystemTap probes to longjmp and setjmp. 2014-02-25 10:07:04 +00:00
nptl ARM: Split Linuxism out of sysdeps/arm/nptl/tls.h 2014-06-30 11:19:22 -07:00
soft-fp ARM: soft-fp NaN representation correction 2014-05-16 23:10:29 +01:00
sys Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
__longjmp.S ARM: Fix up setjmp/longjmp changes sfi_* macro use. 2014-03-11 10:59:01 -07:00
abi-note.S Fix whitespace in ARM files to allow move. 2014-02-08 01:52:38 +00:00
add_n.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
addmul_1.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_assert.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_atexit.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_errno_addr.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_lcsts.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_localeconv.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_math.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_mb_cur_max.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_memclr.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_memcpy.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_memmove.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_memset.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_sighandlers.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
aeabi_unwind_cpp_pr1.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
arm-features.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
arm-mcount.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
backtrace.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
bsd-_setjmp.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
bsd-setjmp.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
configure ARM: Clean up EABI-related configury 2014-07-16 15:18:36 -07:00
configure.ac ARM: Clean up EABI-related configury 2014-07-16 15:18:36 -07:00
crti.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
crtn.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-irel.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-lookupcfg.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-machine.h [BZ #17078] ARM: R_ARM_TLS_DESC prelinker support 2014-07-17 19:22:05 +01:00
dl-sysdep.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-tls.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-tlsdesc.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
dl-tlsdesc.S ARM: Fix handling of concurrent TLS descriptor resolution 2014-05-27 10:39:18 +01:00
dl-trampoline.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
fclrexcpt.c Speed up the ARM fenv implementation by avoiding unnecessary FPSCR 2014-06-24 12:04:27 +00:00
fedisblxcpt.c Speed up the ARM fenv implementation by avoiding unnecessary FPSCR 2014-06-24 12:04:27 +00:00
feenablxcpt.c Speed up the ARM fenv implementation by avoiding unnecessary FPSCR 2014-06-24 12:04:27 +00:00
fegetenv.c ARM: Improve fenv implementation 2014-05-15 15:23:27 +01:00
fegetexcept.c ARM: Improve fenv implementation 2014-05-15 15:23:27 +01:00
fegetround.c Use libc calls defined by fenv_private.h to implement several fenv functions 2014-06-24 11:13:08 +00:00
feholdexcpt.c Cleanup fenv implementation 2014-06-24 14:57:32 +00:00
fenv_private.h Add _FPU_MASK_RM and use it instead of FE_TOWARDZERO. 2014-06-24 15:02:51 +00:00
fesetenv.c Add missing #include <fpu_control.h> to ARM fesetenv/feupdateenv. 2014-06-26 13:35:31 -07:00
fesetround.c Add _FPU_MASK_RM and use it instead of FE_TOWARDZERO. 2014-06-24 15:02:51 +00:00
feupdateenv.c Add missing #include <fpu_control.h> to ARM fesetenv/feupdateenv. 2014-06-26 13:35:31 -07:00
fgetexcptflg.c Use libc calls defined by fenv_private.h to implement several fenv functions 2014-06-24 11:13:08 +00:00
find_exidx.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
fpu_control.h Add _FPU_MASK_RM and use it instead of FE_TOWARDZERO. 2014-06-24 15:02:51 +00:00
fraiseexcpt.c Cleanup fenv implementation 2014-06-24 14:57:32 +00:00
frame.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
framestate.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
fsetexcptflg.c Remove an unused include. 2014-06-24 15:00:01 +00:00
ftestexcept.c Use libc calls defined by fenv_private.h to implement several fenv functions 2014-06-24 11:13:08 +00:00
gcc-compat.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
gccframe.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
get-rounding-mode.h Add _FPU_MASK_RM and use it instead of FE_TOWARDZERO. 2014-06-24 15:02:51 +00:00
gmp-mparam.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
Implies Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
jmpbuf-unwind.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
ldsodefs.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
libc-aeabi_read_tp.S ARM: Move more aeabi routine magic out of Linux-specific directories 2014-06-26 15:08:29 -07:00
libc-tls.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
libm-test-ulps Regenerate ARM libm-test-ulps. 2014-06-30 21:20:35 +00:00
machine-gmon.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
Makefile ARM: Move more aeabi routine magic out of Linux-specific directories 2014-06-26 15:08:29 -07:00
math_private.h [ARM] Add support for fenv_private on ARM. 2014-04-28 10:53:04 +01:00
math-tests.h Add fenv test support for targets which don't have FP traps. 2014-04-17 09:39:27 +01:00
memcpy.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
memmove.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
memset.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
memusage.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
nptl-aeabi_unwind_cpp_pr1.c ARM: Move more aeabi routine magic out of Linux-specific directories 2014-06-26 15:08:29 -07:00
preconfigure ARM: Clean up EABI-related configury 2014-07-16 15:18:36 -07:00
preconfigure.ac ARM: Clean up EABI-related configury 2014-07-16 15:18:36 -07:00
rt-aeabi_unwind_cpp_pr1.c ARM: Move more aeabi routine magic out of Linux-specific directories 2014-06-26 15:08:29 -07:00
rtld-global-offsets.sym Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
s_fma.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
s_fmaf.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
setfpucw.c Speed up the ARM fenv implementation by avoiding unnecessary FPSCR 2014-06-24 12:04:27 +00:00
setjmp.S ARM: Fix up setjmp/longjmp changes sfi_* macro use. 2014-03-11 10:59:01 -07:00
sotruss-lib.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
stackinfo.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
start.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
static-stubs.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
strlen.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
sub_n.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
submul_1.S Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
sysdep.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
test-fpucw.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
tls-macros.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
tlsdesc.c Fix -Wundef warnings for SHARED 2014-07-09 09:26:07 +01:00
tlsdesc.sym Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
tst-armtlsdescextlazy.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-armtlsdescextlazymod.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-armtlsdescextnow.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-armtlsdescextnowmod.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-armtlsdescloc.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-armtlsdesclocmod.c [BZ #17075] ARM: Fix immediate calculation of R_ARM_TLS_DESC 2014-06-20 20:22:42 +01:00
tst-audit.h Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
unwind-dw2-fde-glibc.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
unwind-pe.c Move arm from ports to libc. 2014-02-08 01:49:39 +00:00
unwind.h Move ARM internal unwind.h header to the right sysdeps directory. 2014-05-06 15:55:20 -07:00
Versions Move arm from ports to libc. 2014-02-08 01:49:39 +00:00