glibc/sysdeps
Aurelien Jarno 2a8612b278 ARM: fix kernel assisted atomics with GCC 8 (bug 24034)
The pre-ARMv7 CPUs are missing atomic compare and exchange and/or
barrier instructions. Therefore those are implemented using kernel
assistance, calling a kernel function at a specific address, and passing
the arguments in the r0 to r4 registers. This is done by specifying
registers for local variables. The a_ptr variable is placed in the r2
register and declared with __typeof (mem). According to the GCC
documentation on local register variables, if mem is a constant pointer,
the compiler may substitute the variable with its initializer in asm
statements, which may cause the corresponding operand to appear in a
different register.

This happens in __libc_start_main with the pointer to the thread counter
for static binaries (but not the shared ones):

  # ifdef SHARED
        unsigned int *ptr = __libc_pthread_functions.ptr_nthreads;
  #  ifdef PTR_DEMANGLE
        PTR_DEMANGLE (ptr);
  #  endif
  # else
        extern unsigned int __nptl_nthreads __attribute ((weak));
        unsigned int *const ptr = &__nptl_nthreads;
  # endif

This causes static binaries using threads to crash when the GNU libc is
built with GCC 8 and most notably tst-cancel21-static.

To fix that, use the same trick than for the volatile qualifier,
defining a_ptr as a union.

Changelog:
	[BZ #24034]
	* sysdeps/unix/sysv/linux/arm/atomic-machine.h
	(__arm_assisted_compare_and_exchange_val_32_acq): Use uint32_t rather
	than __typeof (...) for the a_ptr variable.
(cherry picked from commit fe20bb1d60)
2019-01-03 15:59:14 +01:00
..
aarch64 [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
alpha Update Alpha libm-test-ulps 2018-12-28 11:24:48 +01:00
arm [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
generic [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
gnu hurd: Fix shmid_ds's shm_segsz field type 2018-06-02 21:52:43 +02:00
hppa Mark _init and _fini as hidden [BZ #23145] 2018-06-08 10:28:52 -07:00
htl hurd: Avoid PLTs for __pthread_get/setspecific 2018-08-09 01:30:13 +02:00
hurd Fix ISO C threads installed header and HURD assumption 2018-07-25 17:27:45 -03:00
i386 [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
ia64 i64: fix missing exp2f, log2f and powf symbols in libm.a [BZ #23822] 2018-10-26 15:49:30 +01:00
ieee754 ldbl-128ibm-compat: Add printf_size 2018-07-02 10:51:01 -03:00
init_array sysdeps/init_array: Add PREINIT_FUNCTION to crti.S 2018-01-29 10:22:26 -08:00
m68k m68k: Reorganize log1p and significand implementations 2018-06-22 21:34:28 -03:00
mach hurd: Fix exec usage of mach_setup_thread 2018-08-01 00:10:03 +02:00
microblaze Mark _init and _fini as hidden [BZ #23145] 2018-06-08 10:28:52 -07:00
mips Mark _init and _fini as hidden [BZ #23145] 2018-06-08 10:28:52 -07:00
nios2 Mark _init and _fini as hidden [BZ #23145] 2018-06-08 10:28:52 -07:00
nptl [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
posix Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
powerpc powerpc: Add missing CFI register information (bug #23614) 2018-12-13 09:42:22 +01:00
pthread hurd: fix sigevent's sigev_notify_attributes field type 2018-04-19 21:43:44 +02:00
riscv RISC-V: properly terminate call chain (bug 23125) 2018-12-15 21:57:43 +01:00
s390 [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
sh Update SH libm-tests-ulps 2018-07-31 10:33:53 -03:00
sparc [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00
unix ARM: fix kernel assisted atomics with GCC 8 (bug 24034) 2019-01-03 15:59:14 +01:00
wordsize-32 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
wordsize-64 Use libc_hidden_* for strtoumax (bug 15105). 2018-02-28 14:16:21 +00:00
x86 Check multiple NT_GNU_PROPERTY_TYPE_0 notes [BZ #23509] 2018-11-08 10:52:32 -08:00
x86_64 [BZ #20271] Add newlines in __libc_fatal calls. 2018-11-09 10:17:07 -05:00