From 91ac3a7d8474480685632cd25f844d3154c69fdf Mon Sep 17 00:00:00 2001 From: Tulio Magno Quites Machado Filho Date: Mon, 17 Jul 2017 17:48:59 -0300 Subject: powerpc: Fix float128 IFUNC relocations [BZ #21707] The patch proposed by Peter Bergner [1] to libgcc in order to fix [BZ #21707] adds a dependency on a symbol provided by the loader, forcing the loader to be linked to tests after libgcc was linked. It also requires to read the thread pointer during IRELA relocations. Tested on powerpc, powerpc64, powerpc64le, s390x and x86_64. [1] https://sourceware.org/ml/libc-alpha/2017-06/msg01383.html [BZ #21707] * csu/libc-start.c (LIBC_START_MAIN): Perform IREL{,A} relocations before or after initializing the TCB on statically linked executables. That's a per-architecture definition. * elf/rtld.c (dl_main): Add a comment about thread-local variables initialization. * sysdeps/generic/libc-start.h: New file. Define ARCH_APPLY_IREL and ARCH_SETUP_IREL. * sysdeps/powerpc/Makefile: [$(subdir) = elf && $(multi-arch) != no] (tests-static-internal): Add tst-tlsifunc-static. [$(subdir) = elf && $(multi-arch) != no && $(build-shared) == yes] (tests-internal): Add tst-tlsifunc. * sysdeps/powerpc/tst-tlsifunc.c: New file. * sysdeps/powerpc/tst-tlsifunc-static.c: Likewise. * sysdeps/powerpc/powerpc64le/Makefile (f128-loader-link): New variable. [$(subdir) = math] (test-float128% test-ifloat128%): Force linking to the loader after linking to libgcc. [$(subdir) = wcsmbs || $(subdir) = stdlib] (bug-strtod bug-strtod2) (bug-strtod2 tst-strtod-round tst-wcstod-round tst-strtod6 tst-strrom) (tst-strfrom-locale strfrom-skeleton): Likewise. * sysdeps/unix/sysv/linux/powerpc/libc-start.h: New file. Define ARCH_APPLY_IREL and ARCH_SETUP_IREL. --- sysdeps/unix/sysv/linux/powerpc/libc-start.h | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/powerpc/libc-start.h (limited to 'sysdeps/unix/sysv') diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-start.h b/sysdeps/unix/sysv/linux/powerpc/libc-start.h new file mode 100644 index 0000000000..c0635be9bc --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/libc-start.h @@ -0,0 +1,29 @@ +/* PowerPC definitions for libc main startup. + Copyright (C) 2017 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _LIBC_START_H +#define _LIBC_START_H + +#ifndef SHARED +/* IREL{,A} must happen after TCB initialization in order to allow IFUNC + resolvers to read TCB fields, e.g. hwcap and at_platform. */ +#define ARCH_SETUP_IREL() +#define ARCH_APPLY_IREL() apply_irel () +#endif /* ! SHARED */ + +#endif /* _LIBC_START_H */ -- cgit 1.4.1