Commit Graph

26577 Commits

Author SHA1 Message Date
Ulrich Weigand 696caf1d00 PowerPC64 ELFv2 ABI 2/6: Remove function descriptors
This patch adds support for the ELFv2 ABI feature to remove function
descriptors.  See this GCC patch for in-depth discussion:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html

This mostly involves two types of changes: updating assembler source
files to the new logic, and updating the dynamic loader.

After the refactoring in the previous patch, most of the assembler source
changes can be handled simply by providing ELFv2 versions of the
macros in sysdep.h.   One somewhat non-obvious change is in __GI__setjmp:
this used to "fall through" to the immediately following __setjmp ENTRY
point.  This is no longer safe in the ELFv2 since ENTRY defines both
a global and a local entry point, and you cannot simply fall through
to a global entry point as it requires r12 to be set up.

Also, makecontext needs to be updated to set up registers according to
the new ABI for calling into the context's start routine.

The dynamic linker changes mostly consist of removing special code
to handle function descriptors.  We also need to support the new PLT
and glink format used by the the ELFv2 linker, see:
https://sourceware.org/ml/binutils/2013-10/msg00376.html

In addition, the dynamic linker now verifies that the dynamic libraries
it loads match its own ABI.

The hack in VDSO_IFUNC_RET to "synthesize" a function descriptor
for vDSO routines is also no longer necessary for ELFv2.
2013-12-04 07:41:38 -06:00
Ulrich Weigand d31beafa8e PowerPC64 ELFv2 ABI 1/6: Code refactoring
This is the first patch to support the new ELFv2 ABI in glibc.

As preparation, this patch simply refactors some of the powerpc64 assembler
code to move all code related to creating function descriptors (.opd section)
or using function descriptors (function pointer call) into a central place
in sysdep.h.

Note that most locations creating .opd entries were already using macros
in sysdep.h, this patch simply extends this to the remaining places.

No relevant change in generated code expected.
2013-12-04 07:41:38 -06:00
Ulrich Weigand b525166bb9 PowerPC64: Add __private_ss field to TCB header
The TCB header on Intel contains a field __private_ss that is used
to efficiently implement the -fsplit-stack GCC feature.

In order to prepare for a possible future implementation of that
feature on powerpc64, we'd like to reserve a similar field in
the TCB header as well.  (It would be good if this went in with
or before the ELFv2 patches to ensure that this field will be
available always in the ELFv2 environment.)

The field needs to be added at the front of tcbhead_t structure
to avoid changing the ABI; see the recent discussion when adding
the EBB fields.
2013-12-04 07:41:38 -06:00
Alan Modra 7ec07d9a7b PowerPC64: Report overflow on @h and @ha relocations
This patch updates glibc in accordance with the binutils patch checked in here:
https://sourceware.org/ml/binutils/2013-10/msg00372.html

This changes the various R_PPC64_..._HI and _HA relocations to report
32-bit overflows.  The motivation is that existing uses of @h / @ha
are to build up 32-bit offsets (for the "medium model" TOC access
that GCC now defaults to), and we'd really like to see failures at
link / load time rather than silent truncations.

For those rare cases where a modifier is needed to build up a 64-bit
constant, new relocations _HIGH / _HIGHA are supported.

The patch also fixes a bug in overflow checking for the R_PPC64_ADDR30
and R_PPC64_ADDR32 relocations.
2013-12-04 07:41:37 -06:00
Ulrich Weigand 5162e7dd96 PowerPC64: Fix incorrect CFI in *context routines
The context established by "makecontext" has a link register pointing
back to an error path within the makecontext routine.  This is currently
covered by the CFI FDE for makecontext itself, which is simply wrong
for the stack frame *inside* the context.  When trying to unwind (e.g.
doing a backtrace) in a routine inside a context created by makecontext,
this can lead to uninitialized stack slots being accessed, causing the
unwinder to crash in the worst case.

Similarly, during parts of the "setcontext" routine, when the stack
pointer has already been switched to point to the new context, the
address range is still covered by the CFI FDE for setcontext.  When
trying to unwind in that situation (e.g. backtrace from an async
signal handler for profiling), it is again possible that the unwinder
crashes.

Theses are all problems in existing code, but the changes in stack
frame layout appear to make the "worst case" much more likely in
the ELFv2 ABI context.  This causes regressions e.g. in the libgo
testsuite on ELFv2.

This patch fixes this by ending the makecontext/setcontext FDEs
before those problematic parts of the assembler, similar to what
is already done on other platforms.   This fixes the libgo
regression on ELFv2.
2013-12-04 07:41:37 -06:00
Ondřej Bílka 19e3372ba4 Allow strptime read outputs from strftime. Fixes bug 4772. 2013-12-04 13:53:13 +01:00
Siddhesh Poyarekar ecaf142d3d benchtests: skip over blank lines in benchmark input files 2013-12-04 18:20:32 +05:30
Paul Eggert fbf964ae8b Clarify documentation on how functions use timezone. Fixes bug 926. 2013-12-04 13:21:27 +01:00
Adhemerval Zanella fa60a67488 Update powerpc-fpu ULPs. 2013-12-04 06:04:48 -06:00
Ondřej Bílka d674f0ef38 Refactor several debug routines.
To simplify additions of debug routines we replace a custom function
implementation by a simple call.
2013-12-04 02:41:12 +01:00
Joseph Myers 6905a19f7a Update MIPS dl-lookup.c from generic version. 2013-12-03 22:56:05 +00:00
Joseph Myers 749008ff03 Fix exp missing underflows (bug 15268, bug 15425). 2013-12-03 21:49:56 +00:00
Joseph Myers 17dea1887f Fix exp2 errno setting on underflow (bug 16283). 2013-12-03 20:50:51 +00:00
Ondřej Bílka b20de2c3d9 Properly handle shm_open validation. Fixes bug 16274. 2013-12-03 20:16:33 +01:00
Joseph Myers 34e16df5a1 Fix erfc errno setting on underflow (bug 6786). 2013-12-03 16:25:18 +00:00
Joseph Myers d8e2dbe3e3 Move TEST_f_f tests for [e-j]* functions from libm-test.inc to auto-libm-test-in. 2013-12-03 16:22:49 +00:00
Aurelien Jarno 3d2e60756a Add bug number to ChangeLog and NEWS 2013-12-03 14:43:23 +01:00
Aurelien Jarno 18d1425127 locale: don't crash if locale-archive contains all zeros
In case of power failure followed by filesystem issues locale-archive
can end-up containing all zeros. In that case all calls to setlocale()
generate a SIGFPE. This renders a system with a default non-C locale
unbootable.

Avoid this by ignoring the locale instead of generating a SIGFPE.
2013-12-03 11:16:16 +01:00
Siddhesh Poyarekar 520d437b94 [BZ #16195] Fix build warnings from systemtap probes in non-systemtap configurations
Joseph pointed out in the bug report (and in an earlier thread) that
systemtap probes cause build time warnings like the following:

    ../sysdeps/ieee754/dbl-64/e_atan2.c:602:4: warning: the address of
    'p' will always evaluate as 'true' [-Waddress]

due to the fact that we're now passing non-weak variables to
LIBC_PROBE in the libm probes.  This happens only on configurations
that do not enable systemtap.  The macro definition of LIBC_PROBE in
this case only acts as a sanity checker to ensure that the number
parameters passed to LIBC_PROBE is equal to the argument count
parameter passed before it.  This can be done in a much simpler manner
by just adding a macro definition for each number of arguments.  I am
assuming here that we don't really want to bother with supporting
LIBC_PROBE with an indeterminate number of arguments and if there is a
need for a probe to have more data than what is currently supported (4
arguments), one could simply add an additional macro here.
2013-12-03 12:26:12 +05:30
Ondřej Bílka 416e014536 Document shm_open. 2013-12-02 23:33:37 +01:00
Steve Ellcey 9d17796a97 Add ChangeLog entry for sqrt tests. 2013-12-02 09:38:38 -08:00
Steve Ellcey fe7da22091 Benchmark test for sqrt function. 2013-12-02 09:37:18 -08:00
Pavel Simerda 639a0ef8ab Remove redundant GAIH_OKIFUNSPEC and GAIH_EAI.
Only gaih_inet() and gaih_inet_serv() use a special bit flag denoted
by the GAIH_OKIFUNSPEC macro. Only the return value of
gaih_inet_serv() is actively checked for the bit flag which is
redundant because it just copies the nonzero property of the value
otherwise returned. The return value of gaih_inet() is only checked
for being zero and then the bit flag is filtered out. As the bit flag
is set only for otherwise nonzero return values, it doesn't affect the
zero comparison. GAIH_EAI just an alias to ~GAIH_OKIFUNSPEC.
2013-12-02 20:23:13 +05:30
Pavel Simerda f524d6a8e4 getaddrinfo: remove dead code 2013-12-02 20:17:17 +05:30
Siddhesh Poyarekar df3aedaf38 Use herrnop directly
H_ERRNO_ARGS is unnecessary since we this file is specifically for
hosts lookup.
2013-12-02 20:06:20 +05:30
Siddhesh Poyarekar b42ad38d63 Fix ChangeLog formatting 2013-12-02 20:05:39 +05:30
Ondřej Bílka 2a939a7e6d Return fixed version of breaking of RPATH when $ORIGIN contains colons 2013-12-02 14:53:14 +01:00
Adhemerval Zanella 1ab19dec57 Update powerpc-fpu ULPs. 2013-12-02 05:16:42 -06:00
Chris Leonard 14b97c7a8c Add lang_name to various locales. 2013-12-01 08:04:54 -05:00
Joseph Myers 176b0c7913 Move TEST_f_f tests for [a-c]* functions from libm-test.inc to auto-libm-test-in. 2013-11-30 22:04:13 +00:00
Joseph Myers 2a77a467b2 Fix exp10 errno setting on underflow (bug 6787). 2013-11-29 16:32:49 +00:00
Joseph Myers ea3bc4e821 Fix x86 sqrt rounding (bug 14032). 2013-11-29 16:31:16 +00:00
Joseph Myers 0712c9d861 Test sqrt in all rounding modes. 2013-11-29 16:28:47 +00:00
Joseph Myers ffb536d0ac Start generating libm tests automatically with MPFR. 2013-11-29 16:27:55 +00:00
Siddhesh Poyarekar 97161a9373 Add 16214 to NEWS 2013-11-29 19:44:42 +05:30
Andreas Krebbel acd98a8ed1 [BZ #16214] S/390: Fix TLS GOT pointer setup. 2013-11-29 09:57:04 +01:00
Joseph Myers 7475aef5fa Document libm accuracy goals. 2013-11-28 22:31:03 +00:00
Joseph Myers 8bca7cd830 Remove unused ldbl-96 functions (bug 15004). 2013-11-28 20:50:03 +00:00
Joseph Myers 91a1f3fea0 Add powerpc-nofpu/e500 support functions for atomic compound assignment and FLT_ROUNDS. 2013-11-28 18:01:41 +00:00
Joseph Myers c5df760908 Document some libm error handling intents. 2013-11-28 16:52:36 +00:00
Joseph Myers 3c1c46a64a Fix dbl-64 e_sqrt.c for non-default rounding modes (bug 16271). 2013-11-28 16:50:38 +00:00
Siddhesh Poyarekar 5a4c6d53f5 Get canonical name in getaddrinfo from hosts file for AF_INET (fixes 16077)
AF_INET lookup in hosts file uses _nss_files_gethostbyname2_r, which
is not capable of returning a canonical name if it has found one.
This change adds _nss_files_gethostbyname3_r, which wraps around
_nss_files_gethostbyname2_r and then returns result.h_name as the
canonical name.
2013-11-28 17:18:12 +05:30
Ondřej Bílka 897b98ba4d Make memset in calloc a tail call. 2013-11-28 12:05:50 +01:00
Chris Leonard 2ddb48d376 Add lang_name to various locales. 2013-11-27 15:52:46 -05:00
Aurelien Jarno 24d8773d06 MIPS: Fix RLIM64_INFINITY constant for O32 and N32 ABIs
Fix the RLIM64_INFINITY constant for O32 and N32 ABIs to match the
kernel one. Change the getrlimit64/setrlimit64 into old compat symbols,
and provide the Linux generic getrlimit64/setrlimit64 functions as
GLIBC_2_19 version.
2013-11-27 17:38:16 +01:00
Aurelien Jarno 9480dfe2a3 MIPS: Add wrappers to get/setrlimit64 to fix RLIM64_INFINITY constant
RLIM64_INFINITY was supposed to be a glibc convention rather than
anything seen by the kernel, but it ended being passed to the kernel
through the prlimit64 syscall.  On O32 and N32 ABIs, we therefore
end-up with different values on the userland and kernel side:

* On the kernel side, the value is defined for all architectures as
  include/uapi/linux/resource.h:

  #define RLIM64_INFINITY           (~0ULL)

* On the GNU libc side, the value is defined in
  ports/sysdeps/unix/sysv/linux/mips/bits/resource.h:

  For the O32 and N32 ABI:
  #  define RLIM64_INFINITY 0x7fffffffffffffffULL

  and for the N64 ABI:
  #  define RLIM64_INFINITY 0xffffffffffffffffUL

This was not a problem until the prlimit64 syscall was wired in the
2.6.36 kernel. Given the GLIBC uses the prlimit64 syscall to implement
getrlimit64 and setrlimit64, pam_limits.so is setting the limits to
a very big value instead of infinity. As a normal user process can
later only decrease the value and not increase it, it will later get
and EPERM error when trying to set the value to infinity with setrlimit.

The GLIBC has this constant for more than 7 years, and as it is defined
in a header file, it means a lot of binaries are in the wild. This patch
fixes that by adding a wrapper to fix the value passed to or received
from the kernel, before or after calling the prlimit64 syscall.
2013-11-27 17:36:51 +01:00
Ondřej Bílka a950349667 Also remove benchtests/bench-strsep-ifunc.c 2013-11-26 17:34:34 +01:00
Will Newton 7520ff8c74 aarch64: Enable ifunc support.
Add support for handling the R_AARCH64_IRELATIVE relocation and
STT_GNU_IFUNC symbols to the aarch64 port.

ports/ChangeLog.aarch64:

2013-11-26  Will Newton  <will.newton@linaro.org>

	* sysdeps/aarch64/dl-irel.h: Include ldsodefs.h.
	(ELF_MACHINE_IRELA): Define.  (elf_ifunc_invoke): Pass
	hwcap to ifunc resolver function.  (elf_irela): New function.
	* sysdeps/aarch64/dl-machine.h: Include dl-irel.h.
	(elf_machine_rela) Handle STT_GNU_IFUNC symbols and
	R_AARCH64_IRELATIVE relocations.  (elf_machine_lazy_rel):
	Handle R_AARCH64_IRELATIVE relocations.
2013-11-26 16:18:04 +00:00
Uros Bizjak 6f476861be Avoid "left shift count >= width of type" warnings in soft-fp code. 2013-11-26 16:05:10 +00:00
Carlos O'Donell 2fe162299f NEWS: Only public headers have __unused/__block changed. 2013-11-26 09:47:45 -05:00