external/glibc.git
9 years agoAdd ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA to x86
H.J. Lu [Tue, 31 Mar 2015 12:15:43 +0000 (05:15 -0700)]
Add ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA to x86

With copy relocation, address of protected data defined in the shared
library may be external.   When there is a relocation against the
protected data symbol within the shared library, we need to check if we
should skip the definition in the executable copied from the protected
data.  This patch adds ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA and defines
it for x86.  If ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA isn't 0, do_lookup_x
will skip the data definition in the executable from copy reloc.

[BZ #17711]
* elf/dl-lookup.c (do_lookup_x): When UNDEF_MAP is NULL, which
indicates it is called from do_lookup_x on relocation against
protected data, skip the data definion in the executable from
copy reloc.
(_dl_lookup_symbol_x): Pass ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA,
instead of ELF_RTYPE_CLASS_PLT, to do_lookup_x for
EXTERN_PROTECTED_DATA relocation against STT_OBJECT symbol.
* sysdeps/generic/ldsodefs.h * (ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA):
New.  Defined to 4 if DL_EXTERN_PROTECTED_DATA is defined,
otherwise to 0.
* sysdeps/i386/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New.
* sysdeps/i386/dl-machine.h (elf_machine_type_class): Set class
to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_386_GLOB_DAT.
* sysdeps/x86_64/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New.
* sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Set class
to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_X86_64_GLOB_DAT.

9 years agoNPTL: Remove duplicate definition of PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
Martin Galvan [Sat, 28 Mar 2015 04:41:35 +0000 (01:41 -0300)]
NPTL: Remove duplicate definition of PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP

The PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP macro was defined twice with the
same values in pthread.h; this removes the second definition.

9 years agoNPTL: swap comments for THREAD_SETMEM and THREAD_SETMEM_NC for i386 and x86_64
Martin Galvan [Sat, 28 Mar 2015 04:31:56 +0000 (01:31 -0300)]
NPTL: swap comments for THREAD_SETMEM and THREAD_SETMEM_NC for i386 and x86_64

The comments for THREAD_SETMEM and THREAD_SETMEM_NC were swapped for
i386 and x86_64; this patch fixes that.

9 years agoConvert dlfcn/tststatic to use test-skeleton.
Roland McGrath [Fri, 27 Mar 2015 19:55:25 +0000 (12:55 -0700)]
Convert dlfcn/tststatic to use test-skeleton.

9 years agoHarden powerpc64 elf_machine_fixup_plt
Alan Modra [Thu, 26 Mar 2015 02:00:45 +0000 (12:30 +1030)]
Harden powerpc64 elf_machine_fixup_plt

IFUNC is difficult to correctly implement on any target needing a GOT
to support position independent code, due to the dependency on order
of dynamic relocations.  ld.so should be changed to apply IFUNC
relocations last, globally, because without that it is actually
impossible to write an IFUNC resolver in C that works in all
situations.  Case in point, vfork in libpthread.so is an IFUNC with
the resolver returning &__libc_vfork.  (system and fork are similar.)
If another shared library, libA say, uses vfork then it is quite
possible that libpthread.so hasn't been dynamically relocated before
the unfortunate libA is dynamically relocated.  In that case the GOT
entry for &__libc_vfork is still zero, so the IFUNC resolver returns
NULL.  LD_BIND_NOW=1 results in libA PLT dynamic relocations being
applied using this NULL value and ld.so segfaults.

This patch hardens ld.so to not segfault on a NULL from an IFUNC
resolver.  It also fixes a problem with undefined weak.  If you leave
the plt entry as-is for undefined weak then if the entry is ever
called it will loop in ld.so rather than segfaulting.

* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_fixup_plt):
Don't segfault if ifunc resolver returns a NULL.  Do set plt to
zero for undefined weak.
(elf_machine_plt_conflict): Similarly.

9 years agoAdd more tests of acosh, asinh and atanh.
Joseph Myers [Wed, 25 Mar 2015 22:21:20 +0000 (22:21 +0000)]
Add more tests of acosh, asinh and atanh.

This patch adds some randomly-generated tests of acosh, asinh and
atanh that are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of acosh, asinh and
atanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd another test of asin.
Joseph Myers [Wed, 25 Mar 2015 21:57:04 +0000 (21:57 +0000)]
Add another test of asin.

This patch adds a randomly-generated test of asin that is observed to
increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add another test of asin.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoRemove unused macros from i386 lowlevellock.h.
Joseph Myers [Wed, 25 Mar 2015 21:21:18 +0000 (21:21 +0000)]
Remove unused macros from i386 lowlevellock.h.

In the course of the work on six-argument syscalls I noticed that the
i386 lowlevellock.h contained some unused macro definitions (already
unused before my patch).  This patch removes them.

Tested for x86 that installed stripped shared libraries are unchanged
by this patch.

* sysdeps/unix/sysv/linux/i386/lowlevellock.h (LLL_EBX_LOAD):
Remove macro.
(LLL_EBX_REG): Likewise.
(LLL_ENTER_KERNEL): Likewise.

9 years agoAdd more tests of asin.
Joseph Myers [Wed, 25 Mar 2015 17:53:58 +0000 (17:53 +0000)]
Add more tests of asin.

This patch adds some randomly-generated tests of asin that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of asin.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoSupport six-argument syscalls from C for 32-bit x86, use generic lowlevellock-futex...
Joseph Myers [Wed, 25 Mar 2015 15:17:54 +0000 (15:17 +0000)]
Support six-argument syscalls from C for 32-bit x86, use generic lowlevellock-futex.h (bug 18138).

This patch follows the approach outlined in
<https://sourceware.org/ml/libc-alpha/2015-03/msg00656.html> to
support six-argument syscalls from INTERNAL_SYSCALL for 32-bit x86,
making them call a function __libc_do_syscall that takes the syscall
number and three syscall arguments in the registers in which the
kernel expects them, along with a pointer to a structure containing
the other three arguments.

In turn, this allows the generic lowlevellock-futex.h to be used on
32-bit x86, so supporting lll_futex_timed_wait_bitset (and so allowing
FUTEX_CLOCK_REALTIME to be used in various cases, so fixing bug 18138
for 32-bit x86 and leaving hppa as the only architecture missing
lll_futex_timed_wait_bitset).  The change to lowlevellock.h's
definition of SYS_futex is because the generic lowlevelloc-futex.h
ends up bringing in bits/syscall.h which defines SYS_futex to
__NR_futex, so resulting in redefinition errors.  The revised
definition in lowlevellock.h is in line with what the x86_64 version
does.

__libc_do_syscall is only needed in libpthread at present (meaning
nothing special needs to be done to make it shared-only in most
libraries containing it, static in libc only, as on ARM).

Tested for 32-bit x86, with the glibc testsuite and with the test in
bug 18138.  The failures seen

FAIL: nptl/tst-cleanupx4
FAIL: rt/tst-cpuclock2

are pre-existing.

[BZ #18138]
* sysdeps/unix/sysv/linux/i386/sysdep.h (struct
libc_do_syscall_args): New structure.
(INTERNAL_SYSCALL_MAIN_0): New macro.
(INTERNAL_SYSCALL_MAIN_1): Likewise.
(INTERNAL_SYSCALL_MAIN_2): Likewise.
(INTERNAL_SYSCALL_MAIN_3): Likewise.
(INTERNAL_SYSCALL_MAIN_4): Likewise.
(INTERNAL_SYSCALL_MAIN_5): Likewise.
(INTERNAL_SYSCALL_MAIN_6): Likewise.  Call __libc_do_syscall.
(INTERNAL_SYSCALL): Define to use INTERNAL_SYSCALL_MAIN_##nr.
Replace conditional definitions by conditional definitions of ....
(INTERNAL_SYSCALL_MAIN_INLINE): ... this.  New macro.
* sysdeps/unix/sysv/linux/i386/libc-do-syscall.S: New file.
* sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = nptl]
(libpthread-sysdep_routines): Add libc-do-syscall.
* sysdeps/unix/sysv/linux/i386/lowlevellock-futex.h: Remove file.
* sysdeps/unix/sysv/linux/i386/lowlevellock.h (SYS_futex): Define
to __NR_futex not 240.

9 years agopowerpc __tls_get_addr call optimization
Alan Modra [Wed, 25 Mar 2015 05:23:47 +0000 (15:53 +1030)]
powerpc __tls_get_addr call optimization

This patch is glibc support for a PowerPC TLS optimization, inspired
by Alexandre Oliva's TLS optimization for other processors,
http://www.lsd.ic.unicamp.br/~oliva/writeups/TLS/RFC-TLSDESC-x86.txt

In essence, this optimization uses a zero module id in the tls_index
GOT entry to indicate that a TLS variable is allocated space in the
static TLS area.  A special plt call linker stub for __tls_get_addr
checks for such a tls_index and if found, returns the offset
immediately.  The linker communicates the fact that the special
__tls_get_addr stub is used by setting a bit in the dynamic tag
DT_PPC64_OPT/DT_PPC_OPT.  glibc communicates to the linker that this
optimization is available by the presence of __tls_get_addr_opt.

tst-tlsmod2.so is built with -Wl,--no-tls-get-addr-optimize for
tst-tls-dlinfo, which otherwise would fail since it tests that no
static tls is allocated.  The ld option --no-tls-get-addr-optimize has
been available since binutils-2.20 so doesn't need a configure test.

* NEWS: Advertise TLS optimization.
* elf/elf.h (R_PPC_TLSGD, R_PPC_TLSLD, DT_PPC_OPT, PPC_OPT_TLS): Define.
(DT_PPC_NUM): Increment.
* elf/dynamic-link.h (HAVE_STATIC_TLS): Define.
(CHECK_STATIC_TLS): Use here.
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_rela): Optimize
TLS descriptors.
* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_rela): Likewise.
* sysdeps/powerpc/dl-tls.c: New file.
* sysdeps/powerpc/Versions: Add __tls_get_addr_opt.
* sysdeps/powerpc/tst-tlsopt-powerpc.c: New tls test.
* sysdeps/unix/sysv/linux/powerpc/Makefile: Add new test.
Build tst-tlsmod2.so with --no-tls-get-addr-optimize.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/ld.abilist: Update.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/ld-le.abilist: Likewise.

9 years agopowerpc64 configure message
Alan Modra [Wed, 25 Mar 2015 05:15:36 +0000 (15:45 +1030)]
powerpc64 configure message

This feature doesn't depend on the linker, as can be seen from the
actual test.  It's a compiler feature.

* sysdeps/powerpc/powerpc64/configure.ac: Correct "linker support
for overlapping .opd entries" to "support...".
* sysdeps/powerpc/powerpc64/configure: Regenerate

9 years agoAdd more tests of acos.
Joseph Myers [Wed, 25 Mar 2015 00:30:10 +0000 (00:30 +0000)]
Add more tests of acos.

This patch adds some randomly-generated tests of acos that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of acos.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of expm1.
Joseph Myers [Wed, 25 Mar 2015 00:05:13 +0000 (00:05 +0000)]
Add more tests of expm1.

This patch adds some randomly-generated tests of expm1 that are
observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of expm1.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of cosh, sinh.
Joseph Myers [Tue, 24 Mar 2015 23:48:04 +0000 (23:48 +0000)]
Add more tests of cosh, sinh.

This patch adds some randomly-generated tests of cosh and sinh that
are observed to increase ulps on x86_64.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of cosh and sinh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoRegenerate x86_64, x86 ulps from scratch.
Joseph Myers [Tue, 24 Mar 2015 23:30:19 +0000 (23:30 +0000)]
Regenerate x86_64, x86 ulps from scratch.

The x86_64 and x86 libm-test-ulps files hadn't been regenerated from
scratch for some time, as evidenced by the presence of entries for
*_tonearest functions (those tests duplicated the
default-rounding-mode tests, and such duplicates are no longer run).
The aarch64, alpha, hppa, ia64, m68k, microblaze, powerpc, s390, sh,
sparc, tile files similarly could do with from-scratch regeneration as
evidenced by the presence of such entries.  (Truncate the existing
file then run "make regen-ulps" and move the resulting file into
place.)

This patch regenerates the x86_64 and x86 files from scratch.  It's
likely some of the reduced / removed ulps will need restoring because
they appear on processors or compiler versions other than the one I
tested on, but in such cases I'd like to first see if I can generate
new tests that show such ulps on the Intel processor I'm testing on,
to reduce the effects from different people using different processors
and compilers to regenerate the ulps.

* sysdeps/i386/fpu/libm-test-ulps: Regenerated.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoAdd more tests of log2.
Joseph Myers [Tue, 24 Mar 2015 23:06:28 +0000 (23:06 +0000)]
Add more tests of log2.

In testing for x86_64 on an AMD processor, I observed libm test
failures of the form:

testing long double (without inline functions)
Failure: Test: log2_downward (0x2.b7e151628aed4p+0)
Result:
 is:          1.44269504088896356633e+00   0xb.8aa3b295c17f67600000p-3
 should be:   1.44269504088896356622e+00   0xb.8aa3b295c17f67500000p-3
 difference:  1.08420217248550443400e-19   0x8.00000000000000000000p-66
 ulp       :  1.0000
 max.ulp   :  0.0000
Maximal error of `log2_downward'
 is      : 1 ulp
 accepted: 0 ulp

These issues arise because the maximum ulps when regenerating on one
processor are not the same as on another processor, so regeneration on
several processors may be needed when updating libm-test-ulps to avoid
failures for some users testing glibc - but such regeneration on
multiple processors is inconvenient.  Causes can be: on x86 and, for
x86_64, for long double, variation in results of x87 instructions for
transcendental operations between processors; on x86, variation in
compiler excess precision between compiler versions and
configurations; on any processor where the compiler may contract
expressions using fused multiply-add, variation in what contraction
occurs.

Although it's hard to be sure libm-test-ulps covers all ulps that may
be seen in any configuration for the given architecture, in practice
it helps simply to add wider test coverage to make it more likely
that, when testing on one processor, the ulps seen are the biggest
that can be seen for that function on that processor, and hopefully
they are also the biggest that can be seen for that function in other
configurations for that architecture.  Thus, this patch adds some
tests of log2 that increase the ulps I see on x86_64 on an Intel
processor, so that hopefully future from-scratch regenerations on that
processor will produce ulps big enough not to have errors from testing
on AMD processors.  These tests were found by randomly generating
inputs and seeing what produced ulps larger than those currently in
libm-test-ulps.  Of course such increases also improve the accuracy of
the empirical table of known ulps generated from libm-test-ulps files
that goes in the manual.

Tested for x86_64 and x86 and ulps updated accordingly.

* math/auto-libm-test-in: Add more tests of log2.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.

9 years agoMinor cleanups in libio/iofdopen.c
Roland McGrath [Mon, 23 Mar 2015 20:46:36 +0000 (13:46 -0700)]
Minor cleanups in libio/iofdopen.c

9 years agopthread_setaffinity (Linux variant): Rewrite to use VLA instead of alloca
Florian Weimer [Mon, 23 Mar 2015 15:34:48 +0000 (16:34 +0100)]
pthread_setaffinity (Linux variant): Rewrite to use VLA instead of alloca

extend_alloca was used to emulate VLA deallocation.  The new version
also handles the res == 0 corner case more explicitly, by returning 0
instead of the (potentially undefined, but usually zero) system call
error.

9 years agoAvoid SIGFPE in wordexp [BZ #18100]
Florian Weimer [Mon, 23 Mar 2015 15:12:38 +0000 (16:12 +0100)]
Avoid SIGFPE in wordexp [BZ #18100]

Check for a zero divisor and integer overflow before performing
division in arithmetic expansion.

9 years agoRemove HAVE_ASM_PPC_REL16 references
Alan Modra [Thu, 19 Mar 2015 07:58:38 +0000 (18:28 +1030)]
Remove HAVE_ASM_PPC_REL16 references

In bc0cdc498 the configure check for HAVE_ASM_PPC_REL16 was removed
on the grounds that the minimum binutils supports rel16 relocs.  This
is true, but not all references to HAVE_ASM_PPC_REL16 in the sources
were removed.

* config.h.in: Remove HAVE_ASM_PPC_REL16.
* sysdeps/powerpc/powerpc32/tls-macros.h: Remove HAVE_ASM_PPC_REL16
and false branch of conditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
Likewise.

9 years agoAdd more exception to local headers list
Samuel Thibault [Sun, 22 Mar 2015 23:28:42 +0000 (00:28 +0100)]
Add more exception to local headers list

* scripts/check-local-headers.sh (exclude): Add device/,
hurd/hurd_types.h, hurd/ioctl_types.h, hurd/paths.h, hurd/ioctls.defs,
cthreads.h.

9 years agoFix visibility of EXTPROC macro
Samuel Thibault [Sun, 22 Mar 2015 16:27:51 +0000 (17:27 +0100)]
Fix visibility of EXTPROC macro

* bits/termios.h [!__USE_MISC] (EXTPROC): Do not define.

9 years agoNote old commit as having resolved bug 11505.
Joseph Myers [Sat, 21 Mar 2015 17:50:13 +0000 (17:50 +0000)]
Note old commit as having resolved bug 11505.

9 years agoFix warnings
Samuel Thibault [Sat, 21 Mar 2015 03:49:44 +0000 (04:49 +0100)]
Fix warnings

* sysdeps/mach/hurd/Makefile ($(common-objpfx)errnos.d): Depend on
libc-modules.h
* sysdeps/mach/hurd/i386/trampoline.c (_hurd_setup_sighandler): Remove
unused declaration of _hurd_intr_rpc_msg_in_trap.
* mach/mach_init.c (__mach_init): Test whether HAVE_HOST_PAGE_SIZE is
defined instead of whether it is non-zero.
* sysdeps/mach/hurd/i386/intr-msg.h (INTR_MSG_TRAP): Use "+m"
input constraint instead of both input and output constraint.  Use ecx
clobber instead of %ecx.
* sysdeps/mach/hurd/malloc-machine.h (mutex_init, mutex_lock,
mutex_unlock): Use a statement expression instead of an expression list.
* sysdeps/mach/hurd/setitimer.c (_hurd_itimer_thread_stack_size): Set
type to vm_size_t instead of vm_address_t.
* sysdeps/mach/hurd/fork.c (__fork): Test whether STACK_GROWTH_UP is
defined instead of whether it is non-zero.
* hurd/hurd/ioctl.h (_hurd_locked_install_cttyid): New declaration.
* sysdeps/mach/hurd/setsid.c: Include <hurd/ioctl.h>.
* sysdeps/mach/hurd/mmap.c (__mmap): Use 0 instead of NULL for
comparisons with mapaddr.
* nscd/nscd-client.h: Include <time.h>.
* sysdeps/mach/hurd/dl-sysdep.c (fmh): Pass vm_offset_t dummy
9th parameter to __vm_region instead of int.

9 years agoAdd missing dependency
Samuel Thibault [Sat, 21 Mar 2015 00:19:23 +0000 (01:19 +0100)]
Add missing dependency

* sysdeps/mach/hurd/Makefile ($(common-objpfx)errnos.d): Depend on
libc-modules.h

9 years agoARM: Fix memcpy & memmove for [ARM_ALWAYS_BX]
Roland McGrath [Thu, 19 Mar 2015 19:45:24 +0000 (12:45 -0700)]
ARM: Fix memcpy & memmove for [ARM_ALWAYS_BX]

9 years agolinux-generic: add a README
Chris Metcalf [Thu, 19 Mar 2015 17:33:01 +0000 (13:33 -0400)]
linux-generic: add a README

9 years agoMake sem_timedwait use FUTEX_CLOCK_REALTIME (bug 18138).
Joseph Myers [Wed, 18 Mar 2015 17:05:38 +0000 (17:05 +0000)]
Make sem_timedwait use FUTEX_CLOCK_REALTIME (bug 18138).

sem_timedwait converts absolute timeouts to relative to pass them to
the futex syscall.  (Before the recent reimplementation, on x86_64 it
used FUTEX_CLOCK_REALTIME, but not on other architectures.)

Correctly implementing POSIX requirements, however, requires use of
FUTEX_CLOCK_REALTIME; passing a relative timeout to the kernel does
not conform to POSIX.  The POSIX specification for sem_timedwait says
"The timeout shall be based on the CLOCK_REALTIME clock.".  The POSIX
specification for clock_settime says "If the value of the
CLOCK_REALTIME clock is set via clock_settime(), the new value of the
clock shall be used to determine the time of expiration for absolute
time services based upon the CLOCK_REALTIME clock. This applies to the
time at which armed absolute timers expire. If the absolute time
requested at the invocation of such a time service is before the new
value of the clock, the time service shall expire immediately as if
the clock had reached the requested time normally.".  If a relative
timeout is passed to the kernel, it is interpreted according to the
CLOCK_MONOTONIC clock, and so fails to meet that POSIX requirement in
the event of clock changes.

This patch makes sem_timedwait use lll_futex_timed_wait_bitset with
FUTEX_CLOCK_REALTIME when possible, as done in some other places in
NPTL.  FUTEX_CLOCK_REALTIME is always available for supported Linux
kernel versions; unavailability of lll_futex_timed_wait_bitset is only
an issue for hppa (an issue noted in
<https://sourceware.org/glibc/wiki/PortStatus>, and fixed by the
unreviewed
<https://sourceware.org/ml/libc-alpha/2014-12/msg00655.html> that
removes the hppa lowlevellock.h completely).

In the FUTEX_CLOCK_REALTIME case, the glibc code still needs to check
for negative tv_sec and handle that as timeout, because the Linux
kernel returns EINVAL not ETIMEDOUT for that case, so resulting in
failures of nptl/tst-abstime and nptl/tst-sem13 in the absence of that
check.  If we're trying to distinguish between Linux-specific and
generic-futex NPTL code, I suppose having this in an nptl/ file isn't
ideal, but there doesn't seem to be any better place at present.

It's not possible to add a testcase for this issue to the testsuite
because of the requirement to change the system clock as part of a
test (this is a case where testing would require some form of
container, with root in that container, and one whose CLOCK_REALTIME
is isolated from that of the host; I'm not sure what forms of
containers, short of a full virtual machine, provide that clock
isolation).

Tested for x86_64.  Also tested for powerpc with the testcase included
in the bug.

[BZ #18138]
* nptl/sem_waitcommon.c: Include <kernel-features.h>.
(futex_abstimed_wait)
[__ASSUME_FUTEX_CLOCK_REALTIME && lll_futex_timed_wait_bitset]:
Use lll_futex_timed_wait_bitset with FUTEX_CLOCK_REALTIME instead
of lll_futex_timed_wait.

9 years agoFix up NEWS merge goof-up
Siddhesh Poyarekar [Wed, 18 Mar 2015 09:34:57 +0000 (15:04 +0530)]
Fix up NEWS merge goof-up

9 years agoUse calloc to allocate xports (BZ #17542)
Brad Hubbard [Wed, 18 Mar 2015 09:21:26 +0000 (14:51 +0530)]
Use calloc to allocate xports (BZ #17542)

If xports is NULL in xprt_register we malloc it but if sock >
_rpc_dtablesize() that memory does not get initialised and may in theory
contain any value. Later we make a conditional jump in svc_getreq_common
based on the uninitialised memory and this caused a general protection
fault in rpc.statd on an older version of glibc but this code has not
changed since that version.

Following is the valgrind warning.

==26802== Conditional jump or move depends on uninitialised value(s)
==26802==    at 0x5343A25: svc_getreq_common (in /lib64/libc-2.5.so)
==26802==    by 0x534357B: svc_getreqset (in /lib64/libc-2.5.so)
==26802==    by 0x10DE1F: ??? (in /sbin/rpc.statd)
==26802==    by 0x10D0EF: main (in /sbin/rpc.statd)
==26802==  Uninitialised value was created by a heap allocation
==26802==    at 0x4C2210C: malloc (vg_replace_malloc.c:195)
==26802==    by 0x53438BE: xprt_register (in /lib64/libc-2.5.so)
==26802==    by 0x53450DF: svcudp_bufcreate (in /lib64/libc-2.5.so)
==26802==    by 0x10FE32: ??? (in /sbin/rpc.statd)
==26802==    by 0x10D13E: main (in /sbin/rpc.statd)

9 years agoFix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbage
Alexandre Oliva [Tue, 17 Mar 2015 04:14:11 +0000 (01:14 -0300)]
Fix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbage

for  ChangeLog

[BZ #17090]
[BZ #17620]
[BZ #17621]
[BZ #17628]
* NEWS: Update.
* elf/dl-tls.c (_dl_update_slotinfo): Clean up outdated DTV
entries with Static TLS too.  Skip entries past the end of the
allocated DTV, from Alan Modra.
(tls_get_addr_tail): Update to glibc_likely/unlikely.  Move
Static TLS DTV entry set up from...
 (_dl_allocate_tls_init): ... here (fix modid assertion), ...
* elf/dl-reloc.c (_dl_nothread_init_static_tls): ... here...
* nptl/allocatestack.c (init_one_static_tls): ... and here...
* elf/dlopen.c (dl_open_worker): Drop l_tls_modid upper bound
for Static TLS.
* elf/tlsdeschtab.h (map_generation): Return size_t.  Check
that the slot we find is associated with the given map before
using its generation count.
* nptl_db/db_info.c: Include ldsodefs.h.
(rtld_global, dtv_slotinfo_list, dtv_slotinfo): New typedefs.
* nptl_db/structs.def (DB_RTLD_VARIABLE): New macro.
(DB_MAIN_VARIABLE, DB_RTLD_GLOBAL_FIELD): Likewise.
(link_map::l_tls_offset): New struct field.
(dtv_t::counter): Likewise.
(rtld_global): New struct.
(_rtld_global): New rtld variable.
(dl_tls_dtv_slotinfo_list): New rtld global field.
(dtv_slotinfo_list): New struct.
(dtv_slotinfo): Likewise.
* nptl_db/td_symbol_list.c: Drop gnu/lib-names.h include.
(td_lookup): Rename to...
(td_mod_lookup): ... this.  Use new mod parameter instead of
LIBPTHREAD_SO.
* nptl_db/td_thr_tlsbase.c: Include link.h.
(dtv_slotinfo_list, dtv_slotinfo): New functions.
(td_thr_tlsbase): Check DTV generation.  Compute Static TLS
addresses even if the DTV is out of date or missing them.
* nptl_db/fetch-value.c (_td_locate_field): Do not refuse to
index zero-length arrays.
* nptl_db/thread_dbP.h: Include gnu/lib-names.h.
(td_lookup): Make it a macro implemented in terms of...
(td_mod_lookup): ... this declaration.
* nptl_db/db-symbols.awk (DB_RTLD_VARIABLE): Override.
(DB_MAIN_VARIABLE): Likewise.

9 years agoPreserve bound registers in _dl_runtime_resolve
H.J. Lu [Mon, 16 Mar 2015 21:58:43 +0000 (14:58 -0700)]
Preserve bound registers in _dl_runtime_resolve

We need to add a BND prefix before indirect branch at the end of
_dl_runtime_resolve to preserve bound registers.

[BZ #18134]
* sysdeps/x86_64/dl-trampoline.S (PRESERVE_BND_REGS_PREFIX): New.
(_dl_runtime_resolve): Add a BND prefix before indirect branch.

9 years ago* stdlib/setenv.c (__add_to_environ): Revert previous change.
Paul Eggert [Mon, 16 Mar 2015 00:06:21 +0000 (17:06 -0700)]
* stdlib/setenv.c (__add_to_environ): Revert previous change.

9 years agom68k: fix 64-bit arithmetic in atomic operations (bug 18128)
Andreas Schwab [Fri, 13 Mar 2015 17:21:55 +0000 (18:21 +0100)]
m68k: fix 64-bit arithmetic in atomic operations (bug 18128)

9 years ago* stdlib/setenv.c (__add_to_environ):
Paul Eggert [Thu, 12 Mar 2015 22:57:07 +0000 (15:57 -0700)]
* stdlib/setenv.c (__add_to_environ):

Dump core quickly if setenv (..., NULL, ...) is called.

9 years agoARM: Rewrite sysdeps/arm/tls-macros.h
Roland McGrath [Fri, 13 Mar 2015 17:10:09 +0000 (10:10 -0700)]
ARM: Rewrite sysdeps/arm/tls-macros.h

9 years agoEnhance nscd's inotify support (Bug 14906).
Carlos O'Donell [Fri, 13 Mar 2015 13:49:24 +0000 (09:49 -0400)]
Enhance nscd's inotify support (Bug 14906).

In bug 14906 the user complains that the inotify support in nscd
is not sufficient when it comes to detecting changes in the
configurationfiles that should be watched for the various databases.

The current nscd implementation uses inotify to watch for changes in
the configuration files, but adds watches only for IN_DELETE_SELF and
IN_MODIFY. These watches are insufficient to cover even the most basic
uses by a system administrator. For example using emacs or vim to edit
a configuration file should trigger a reload but it might not if
the editors use move to atomically update the file. This atomic update
changes the inode and thus removes the notification on the file (as
inotify is based on inodes). Thus the inotify support in nscd for
configuration files is insufficient to account for the average use
cases of system administrators and users.

The inotify support is significantly enhanced and described here:
https://www.sourceware.org/ml/libc-alpha/2015-02/msg00504.html

Tested on x86_64 with and without inotify support.

9 years agosoft-fp: Define and use _FP_STATIC_ASSERT.
Joseph Myers [Thu, 12 Mar 2015 18:43:21 +0000 (18:43 +0000)]
soft-fp: Define and use _FP_STATIC_ASSERT.

This patch makes soft-fp use static assertions in place of conditional
calls to abort, in places where there are checks for conditions (on
the types for which a macro is used) that the code is not prepared to
handle.  The fallback definition of _FP_STATIC_ASSERT (for kernel use
only, as only relevant to compilers not supported for building glibc)
is as in misc/sys/cdefs.h.

This means that soft-fp only ever calls abort for _FP_UNREACHABLE
calls in builds with GCC versions before 4.5.  Thus, there is no need
for an abort declaration or <stdlib.h> include, since the kernel code
handles defining abort as a macro itself - and so this avoids any need
for an __KERNEL__ condition on the abort declaration to avoid it
breaking with the kernel's macro definition.  That is, this patch is
intended to make glibc's soft-fp code suitable for kernel use with no
kernel-local changes to the soft-fp code needed at all.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by the patch.  One explicit <stdlib.h> include had to be
added to a file that was relying on the include from soft-fp.h.

* soft-fp/soft-fp.h (_FP_STATIC_ASSERT): New macro.
[_LIBC]: Do not include <stdlib.h>.
[!_LIBC] (abort): Remove declaration.
* soft-fp/op-2.h (_FP_MUL_MEAT_2_120_240_double): Use
_FP_STATIC_ASSERT instead of conditionally calling abort.
* soft-fp/op-common.h (_FP_FROM_INT): Likewise.
(_FP_EXTEND_CNAN): Likewise.
(FP_TRUNC): Likewise.
(__FP_CLZ): Likewise.
* sysdeps/powerpc/nofpu/flt-rounds.c: Include <stdlib.h>.

9 years agomanual: fix XPG basename prototype
Yaakov Selkowitz [Thu, 12 Mar 2015 08:20:35 +0000 (03:20 -0500)]
manual: fix XPG basename prototype

* manual/string.texi (XPG basename): Fix prototype.

9 years agoS/390: Fix setcontext/swapcontext which are not restoring sigmask.
Stefan Liebler [Thu, 12 Mar 2015 10:08:11 +0000 (11:08 +0100)]
S/390: Fix setcontext/swapcontext which are not restoring sigmask.

9 years agoS/390: Regenerate ULPs
Stefan Liebler [Thu, 12 Mar 2015 10:04:13 +0000 (11:04 +0100)]
S/390: Regenerate ULPs

9 years agoFix ldconfig segmentation fault with corrupted cache (Bug 18093).
Aurelien Jarno [Thu, 12 Mar 2015 01:03:50 +0000 (21:03 -0400)]
Fix ldconfig segmentation fault with corrupted cache (Bug 18093).

ldconfig is using an aux-cache to speed up the ld.so.cache update. It
is read by mmaping the file to a structure which contains data offsets
used as pointers. As they are not checked, it is not hard to get
ldconfig to segfault with a corrupted file. This happens for instance if
the file is truncated, which is common following a filesystem check
following a system crash.

This can be reproduced for example by truncating the file to roughly
half of it's size.

There is already some code in elf/cache.c (load_aux_cache) to check
for a corrupted aux cache, but it happens to be broken and not enough.
The test (aux_cache->nlibs >= aux_cache_size) compares the number of
libs entry with the cache size. It's a non sense, as it basically
assumes that each library entry is a 1 byte... Instead this commit
computes the theoretical cache size using the headers and compares it
to the real size.

9 years agoFix BZ #18043 comment # 19: don't call undefined setenv(..., NULL, 1).
Paul Pluzhnikov [Wed, 11 Mar 2015 15:55:50 +0000 (08:55 -0700)]
Fix BZ #18043 comment # 19: don't call undefined setenv(..., NULL, 1).

9 years agopowerpc: Remove HAVE_ASM_GLOBAL_DOT_NAME define
Adhemerval Zanella [Tue, 3 Feb 2015 12:41:25 +0000 (07:41 -0500)]
powerpc: Remove HAVE_ASM_GLOBAL_DOT_NAME define

With AIX port deprecated there is no need to check/define
HAVE_ASM_GLOBAL_DOT_NAME anymore since the current minimum binutils
supported (2.22) does not emit global symbol with dot.

This patch removes all the HAVE_ASM_GLOBAL_DOT_NAME definition and
checks for powerpc64 port.

9 years agohppa: update __O_SYNC fix with [BZ #18068]
Mike Frysinger [Wed, 11 Mar 2015 07:33:07 +0000 (03:33 -0400)]
hppa: update __O_SYNC fix with [BZ #18068]

9 years agohppa: Fix feupdateenv and fesetexceptflag (Bug 18111).
Carlos O'Donell [Wed, 11 Mar 2015 06:42:27 +0000 (02:42 -0400)]
hppa: Fix feupdateenv and fesetexceptflag (Bug 18111).

The function feupdateenv has been fixed to correctly handle FE_DFL_ENV
and FE_NOMASK_ENV.

The fesetexceptflag function has been fixed to correctly handle setting
the new flags instead of just OR-ing the existing flags.

This fixes the test-fenv-return and test-fenvinline failures on hppa.

9 years agohppa: Fix feholdexcpt and fesetenv (Bug 18110).
John David Anglin [Wed, 11 Mar 2015 03:43:50 +0000 (23:43 -0400)]
hppa: Fix feholdexcpt and fesetenv (Bug 18110).

The constraints in the inline assembly in feholdexcept and fesetenv
are incorrect. The assembly modifies the buffer pointer, but doesn't
express that in the constraints. The simple fix is to remove the
modification of the buffer pointer which is no longer required by
the existing code, and adjust the one constraint that did express
the modification of bufptr.

The change fixes test-fenv when glibc is compiled with recent gcc.

9 years agosoft-fp: Add _FP_UNREACHABLE.
Joseph Myers [Wed, 11 Mar 2015 01:14:15 +0000 (01:14 +0000)]
soft-fp: Add _FP_UNREACHABLE.

This patch makes soft-fp use a new macro _FP_UNREACHABLE in place of
calling abort in unreachable default cases of switch statements.
_FP_UNREACHABLE expands to call __builtin_unreachable for GCC 4.5 and
later; the fallback to abort is thus only for kernel use.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.  Also tested with the math/ tests for mips64
(in the case of fma there *was* previously an abort call generated,
unlike for the other operations - one switch only deals with a subset
of classes for one operand based on what could have been generated in
the earlier part of fma, whereas the other switches deal with all
combinations of two classes - and this is apparently too complicated
for the default case to have been optimized away).

* soft-fp/soft-fp.h (_FP_UNREACHABLE): New macro.
* soft-fp/op-common.h (_FP_MUL): Use _FP_UNREACHABLE instead of
abort.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.

9 years agoLet tests result in UNSUPPORTED; use that for unbuildable C++ cases
Roland McGrath [Tue, 10 Mar 2015 22:13:14 +0000 (15:13 -0700)]
Let tests result in UNSUPPORTED; use that for unbuildable C++ cases

9 years agoHarmonize posix/regcomp.c with gnulib: comment formatting
Roland McGrath [Tue, 10 Mar 2015 20:53:34 +0000 (13:53 -0700)]
Harmonize posix/regcomp.c with gnulib: comment formatting

9 years agohppa: Update libm-test-ulps.
Carlos O'Donell [Tue, 10 Mar 2015 20:09:37 +0000 (16:09 -0400)]
hppa: Update libm-test-ulps.

9 years agoAdd test for bug 18104.
Joseph Myers [Tue, 10 Mar 2015 17:53:40 +0000 (17:53 +0000)]
Add test for bug 18104.

[BZ #18104]
* math/auto-libm-test-in: Add another test of pow.
* math/auto-libm-test-out: Regenerated.

9 years agopowerpc: Fix incorrect results for pow when using FMA
Adhemerval Zanella [Tue, 10 Mar 2015 13:38:54 +0000 (09:38 -0400)]
powerpc: Fix incorrect results for pow when using FMA

This patch adds no FMA generation for e_pow to avoid precision issues
for powerpc.  This fixes BZ#18104.

9 years agosoft-fp: Use multiple-include guards.
Joseph Myers [Tue, 10 Mar 2015 00:32:29 +0000 (00:32 +0000)]
soft-fp: Use multiple-include guards.

This patch makes soft-fp headers consistently use multiple-include
guards, something previously done mainly only in the Linux kernel
version.  The guard macros aren't the same as those used in the Linux
kernel, but there seems to be enough variation in such guards in Linux
kernel code that hopefully this version will be acceptable there.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.

* soft-fp/double.h [SOFT_FP_DOUBLE_H]: New multiple-include guard.
* soft-fp/extended.h [SOFT_FP_EXTENDED_H]: Likewise.
* soft-fp/op-1.h [SOFT_FP_OP_1_H]: Likewise.
* soft-fp/op-2.h [SOFT_FP_OP_2_H]: Likewise.
* soft-fp/op-4.h [SOFT_FP_OP_4_H]: Likewise.
* soft-fp/op-8.h [SOFT_FP_OP_8_H]: Likewise.
* soft-fp/op-common.h [SOFT_FP_OP_COMMON_H]: Likewise.
* soft-fp/quad.h [SOFT_FP_QUAD_H]: Likewise.
* soft-fp/single.h [SOFT_FP_SINGLE_H]: Likewise.
* soft-fp/soft-fp.h (SOFT_FP_H): Define to 1 rather than empty.
Add comment on closing #endif.

9 years agoMinor refactoring:
Paul Pluzhnikov [Mon, 9 Mar 2015 21:41:35 +0000 (14:41 -0700)]
Minor refactoring:

* posix/wordexp.c (CHAR_IN_SET): New macro.
(parse_param): Use it.

9 years agoUpdate powerpc-fpu ULPs.
Adhemerval Zanella [Mon, 9 Mar 2015 17:26:48 +0000 (13:26 -0400)]
Update powerpc-fpu ULPs.

9 years agoFix BZ #18043 (c4): buffer-overflow (read past the end) in wordexp/parse_dollars...
Paul Pluzhnikov [Mon, 9 Mar 2015 14:22:36 +0000 (07:22 -0700)]
Fix BZ #18043 (c4): buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param

9 years agoMention BZ #18042 in NEWS.
Paul Pluzhnikov [Mon, 9 Mar 2015 04:58:26 +0000 (21:58 -0700)]
Mention BZ #18042 in NEWS.

9 years agoFix off-by-one which caused BZ #18042 and add a test for it.
Paul Pluzhnikov [Mon, 9 Mar 2015 04:55:13 +0000 (21:55 -0700)]
Fix off-by-one which caused BZ #18042 and add a test for it.

9 years agoRefactor wordexp-test.c such that words always ends at the edge of
Paul Pluzhnikov [Mon, 9 Mar 2015 04:37:31 +0000 (21:37 -0700)]
Refactor wordexp-test.c such that words always ends at the edge of
unreadable page.

This makes it easy to catch overflows, such as BZ #18043 (and BZ #18042).

9 years agoCleanup: in preparation for fixing BZ #16734, fix memory leaks exposed by
Paul Pluzhnikov [Sun, 8 Mar 2015 16:46:53 +0000 (09:46 -0700)]
Cleanup: in preparation for fixing BZ #16734, fix memory leaks exposed by
switching fopen()ed streams from mmap to malloc.

9 years agohurd: Make libc able to call pthread stubs
Samuel Thibault [Sun, 8 Mar 2015 10:26:57 +0000 (11:26 +0100)]
hurd: Make libc able to call pthread stubs

* sysdeps/mach/hurd/bits/libc-lock.h [_LIBC]: Include
<bits/libc-lockP.h>

9 years agosoft-fp: Support conditional zero-initialization in declarations.
Joseph Myers [Sat, 7 Mar 2015 01:39:42 +0000 (01:39 +0000)]
soft-fp: Support conditional zero-initialization in declarations.

In the Linux kernel, some architectures have a single function that
uses different kinds of unpacking and packing depending on the
instruction being emulated, meaning it is not readily visible to the
compiler that variables from _FP_DECL and _FP_FRAC_DECL_* macros are
only used in cases where they were initialized.  The existing copy of
soft-fp in the Linux kernel uses zero-initialization to avoid warnings
in this case, so while frowned upon as a warning suppression mechanism
in code built for glibc it seems appropriate to have such
zero-initialization conditional on __KERNEL__.  This patch duly adds
it, via a macro _FP_ZERO_INIT that expands to empty for non-kernel
compilations.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.

* soft-fp/soft-fp.h (_FP_ZERO_INIT): New macro.  Define depending
on [__KERNEL__].
* soft-fp/op-1.h (_FP_FRAC_DECL_1): Use _FP_ZERO_INIT.
* soft-fp/op-2.h (_FP_FRAC_DECL_2): Likewise.
* soft-fp/op-common.h (_FP_DECL): Likewise.

9 years agoReplace __attribute__((visibility("protected")))
H.J. Lu [Fri, 6 Mar 2015 12:55:56 +0000 (04:55 -0800)]
Replace __attribute__((visibility("protected")))

With copy relocation, address of protected data defined in the shared
library may be external.  Compiler shouldn't asssume protected data will
be local.  But due to

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65248

__attribute__((visibility("protected"))) doesn't work correctly, we need
to use asm (".protected xxx") instead.

* elf/ifuncdep2.c (global): Replace
__attribute__((visibility("protected"))) with
asm (".protected global").
* elf/ifuncmod1.c (global): Likewise.
* elf/ifuncmod5.c (global): Likewise.

9 years agoFix /* in comment in previous commit.
Joseph Myers [Sat, 7 Mar 2015 00:59:56 +0000 (00:59 +0000)]
Fix /* in comment in previous commit.

9 years agosoft-fp: Condition sfp-machine.h include path on __KERNEL__.
Joseph Myers [Sat, 7 Mar 2015 00:36:02 +0000 (00:36 +0000)]
soft-fp: Condition sfp-machine.h include path on __KERNEL__.

My Linux kernel patch to update the kernel to current glibc soft-fp
<https://sourceware.org/ml/libc-alpha/2015-02/msg00107.html> still
leaves a few small differences between the two copies of soft-fp.

I think it's desirable to avoid such differences completely if
possible by having one set of sources suitable for use in both places.
To that end, this patch introduces a conditional on __KERNEL__ for the
path by which sfp-machine.h is included.

Tested for powerpc-nofpu that installed stripped shared libraries are
unchanged by this patch.

* soft-fp/soft-fp.h [!_LIBC && __KERNEL__]: Include
<asm/sfp-machine.h> instead of <sfp-machine.h>.

9 years agoDocument test-wrapper-env-only in INSTALL.
Roland McGrath [Fri, 6 Mar 2015 18:59:15 +0000 (10:59 -0800)]
Document test-wrapper-env-only in INSTALL.

9 years agoChangeLog format
Roland McGrath [Fri, 6 Mar 2015 18:52:53 +0000 (10:52 -0800)]
ChangeLog format

9 years agoFix BZ #18043: buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param
Paul Pluzhnikov [Fri, 6 Mar 2015 17:13:16 +0000 (09:13 -0800)]
Fix BZ #18043: buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param

9 years agotime: ensure failing strptime() tests are reported correctly
Vincent Bernat [Fri, 6 Mar 2015 11:01:52 +0000 (12:01 +0100)]
time: ensure failing strptime() tests are reported correctly

9 years agoFix aio_error thread-safety.
Samuel Thibault [Fri, 6 Mar 2015 10:32:24 +0000 (11:32 +0100)]
Fix aio_error thread-safety.

* sysdeps/pthread/aio_error.c: New file
* sysdeps/pthread/aio_misc.c: Remove optimistic comment about
synchronization.

9 years agovfprintf: Define WORK_BUFFER_SIZE
Florian Weimer [Sun, 1 Mar 2015 20:52:15 +0000 (21:52 +0100)]
vfprintf: Define WORK_BUFFER_SIZE

This constant will allow us to refer to the number of elements in
work_buffer across a function call boundary.

9 years agovfprintf: Introduce JUMP_TABLE_BASE_LABEL
Florian Weimer [Sun, 1 Mar 2015 20:47:31 +0000 (21:47 +0100)]
vfprintf: Introduce JUMP_TABLE_BASE_LABEL

This makes the offset handling more explicit and avoids
cross-references between the jump tables.

9 years agovfprintf: Introduce THOUSANDS_SEP_T
Florian Weimer [Fri, 6 Mar 2015 09:26:58 +0000 (10:26 +0100)]
vfprintf: Introduce THOUSANDS_SEP_T

This avoids preprocessor conditionals in function declarations.

9 years agomanual: complete example in error message documentation
Rical Jasan [Fri, 6 Mar 2015 05:59:49 +0000 (00:59 -0500)]
manual: complete example in error message documentation

The manual gives "an example showing how to handle failure to open a
file correctly."  The example function, open_sesame, uses the
newly-introduced strerror function and errno and
program_invocation_short_name variables.  It fails to specify GNU
extensions, however, so attempts to use it in the following way:

    int main (void) {open_sesame ("badname");}

fail during compilation with "error: ‘program_invocation_short_name’
undeclared", indicating the example is incomplete.  The presence of
"#include"s suggest everything neccesary for the function to work should
be present.  For completeness, the example is lacking the following line:

    #define _GNU_SOURCE

as the declarations of program_invocation_*name in errno.h are wrapped
in an "#ifdef __USE_GNU" conditional.

The documentation of the variables is also expanded, adding that their
definition lies in errno.h and noting specifically they are GNU
extensions.

9 years agomanual: drop strerror C89 compatibility note
Mike Frysinger [Thu, 5 Mar 2015 19:09:50 +0000 (14:09 -0500)]
manual: drop strerror C89 compatibility note

Mentioning systems that are old and don't support C89 is probably
a waste of time nowadays.  Drop the note.

9 years agoAvoid re-exec-self in bug-setlocale1.
Roland McGrath [Thu, 5 Mar 2015 20:58:49 +0000 (12:58 -0800)]
Avoid re-exec-self in bug-setlocale1.

9 years agoReplace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY
H.J. Lu [Thu, 5 Mar 2015 16:26:21 +0000 (08:26 -0800)]
Replace ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY

ELF_RTYPE_CLASS_NOCOPY in comments is a typo.  It should be
ELF_RTYPE_CLASS_COPY.

[BZ #18082]
* sysdeps/alpha/dl-machine.h (elf_machine_type_class): Replace
ELF_RTYPE_CLASS_NOCOPY with ELF_RTYPE_CLASS_COPY in comments.
* sysdeps/arm/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/hppa/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/i386/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/ia64/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/m68k/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/microblaze/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/nios2/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/powerpc/powerpc32/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/powerpc/powerpc64/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/s390/s390-32/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/s390/s390-64/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/sh/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/sparc/sparc32/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/sparc/sparc64/dl-machine.h (elf_machine_type_class):
Likewise.
* sysdeps/tile/dl-machine.h (elf_machine_type_class): Likewise.
* sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Likewise.

9 years agoDefine ETH_ALEN in generic <netinet/if_ether.h>.
Roland McGrath [Thu, 5 Mar 2015 00:11:31 +0000 (16:11 -0800)]
Define ETH_ALEN in generic <netinet/if_ether.h>.

9 years agoSplit rpcent tests out of tst-netdb.
Roland McGrath [Wed, 4 Mar 2015 23:55:38 +0000 (15:55 -0800)]
Split rpcent tests out of tst-netdb.

9 years agoConditionalize some test code for SIGRTMIN, SA_SIGINFO.
Roland McGrath [Wed, 4 Mar 2015 23:14:56 +0000 (15:14 -0800)]
Conditionalize some test code for SIGRTMIN, SA_SIGINFO.

9 years agoAvoid more C++ tests.
Roland McGrath [Wed, 4 Mar 2015 22:11:39 +0000 (14:11 -0800)]
Avoid more C++ tests.

9 years agoAvoid C++ tests when the C++ cannot be linked.
Roland McGrath [Wed, 4 Mar 2015 21:52:45 +0000 (13:52 -0800)]
Avoid C++ tests when the C++ cannot be linked.

9 years agoDon't define __CORRECT_ISO_CPP_STRING_H_PROTO for non-GCC compilers (bug 17631)
Andreas Schwab [Wed, 10 Dec 2014 10:28:51 +0000 (11:28 +0100)]
Don't define __CORRECT_ISO_CPP_STRING_H_PROTO for non-GCC compilers (bug 17631)

The implementation of __CORRECT_ISO_CPP_STRING_H_PROTO requires
support for asm aliases.

9 years agopowerpc: Fix inline feraiseexcept, feclearexcept macros
Adhemerval Zanella [Wed, 28 Jan 2015 11:10:41 +0000 (06:10 -0500)]
powerpc: Fix inline feraiseexcept, feclearexcept macros

This patch fixes the inline feraiseexcept and feclearexcept macros for
powerpc by casting the input argument to integer before operation on it.

It fixes BZ#17776.

9 years agoFix localplt test breakage with new readelf
Alan Modra [Fri, 20 Feb 2015 04:53:28 +0000 (15:23 +1030)]
Fix localplt test breakage with new readelf

Since 2014-11-24 binutils git commit bb4d2ac2, readelf has appended
the symbol version to symbols shown in reloc dumps.

[BZ #16512]
* scripts/localplt.awk: Strip off symbol version.
* NEWS: Mention bug fix.

9 years agoDeglobalize internal variables in timer_routines.c.
Roland McGrath [Mon, 2 Mar 2015 23:44:27 +0000 (15:44 -0800)]
Deglobalize internal variables in timer_routines.c.

9 years agoCorrect __ASSUME_PRLIMIT64 for hppa/microblaze/sh (bug 17779).
Joseph Myers [Mon, 2 Mar 2015 23:05:55 +0000 (23:05 +0000)]
Correct __ASSUME_PRLIMIT64 for hppa/microblaze/sh (bug 17779).

__ASSUME_PRLIMIT64 is defined in kernel-features.h for kernels 2.6.36
and later, but hppa, microblaze and sh did not add the prlimit64
syscall until 2.6.37.  This patch adds corresponding undefines of
__ASSUME_PRLIMIT64 to those architectures' kernel-features.h files.

(This concludes the kernel-features.h fixes arising out of the review
- limited to macros defined in the architecture-independent
kernel-features.h file - I did in connection with the move to 2.6.32
minimum kernel version.  For that subset of macros - I didn't check
any purely architecture-specific macros - I think they are now defined
for the correct kernel versions on each architecture after this
patch.)

[BZ #17779]
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
Undefine.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
[__LINUX_KERNEL_VERSION < 0x020625] (__ASSUME_PRLIMIT64):
Likewise.

9 years agoFix BZ 18036 buffer overflow (read past end of buffer) in internal_fnmatch
Paul Pluzhnikov [Mon, 2 Mar 2015 21:34:22 +0000 (13:34 -0800)]
Fix BZ 18036 buffer overflow (read past end of buffer) in internal_fnmatch

9 years agoFix parallel build error
Andreas Schwab [Mon, 2 Mar 2015 14:47:56 +0000 (15:47 +0100)]
Fix parallel build error

9 years ago_nss_nis_initgroups_dyn: Return status instead of NSS_STATUS_SUCCESS
Florian Weimer [Mon, 2 Mar 2015 09:07:12 +0000 (10:07 +0100)]
_nss_nis_initgroups_dyn: Return status instead of NSS_STATUS_SUCCESS

9 years agoAvoid unsafe loc_name type casts with additional variable
Alexandre Oliva [Sat, 28 Feb 2015 01:18:56 +0000 (22:18 -0300)]
Avoid unsafe loc_name type casts with additional variable

for  ChangeLog

[BZ #15969]
* locale/findlocale.c (_nl_find_locale): Introduce const
version of loc_name and drop unsafe type casts.

9 years agoConvert dlfcn/tststatic2 to use test-skeleton.
Roland McGrath [Fri, 27 Feb 2015 23:21:03 +0000 (15:21 -0800)]
Convert dlfcn/tststatic2 to use test-skeleton.

9 years agoCompile vismain with -fPIE and link with -pie
H.J. Lu [Fri, 27 Feb 2015 21:56:44 +0000 (13:56 -0800)]
Compile vismain with -fPIE and link with -pie

Protocted symbol in shared library can only be accessed from PIE
or shared library.  Linker in binutils 2.26 enforces it.  We must
compile vismain with -fPIE and link it with -pie.

[BZ #17711]
* elf/Makefile (tests): Add vismain only if PIE is enabled.
(tests-pie): Add vismain.
(CFLAGS-vismain.c): New.
* elf/vismain.c: Add comments for PIE requirement.

9 years agoFix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047).
Joseph Myers [Fri, 27 Feb 2015 17:48:37 +0000 (17:48 +0000)]
Fix ldbl-96, ldbl-128ibm atanhl inaccuracy (bug 18046, bug 18047).

The threshold in ldbl-96 atanhl for when to return the argument,
0x1p-28, is a bit too big, and that in ldbl-128ibm atanhl is much too
big (the relevant condition being x^3/3 being < 0.5ulp of x),
resulting in errors a bit above the limits of those considered
acceptable in glibc in the ldbl-96 case, and in large errors in the
ldbl-128ibm case.  This patch changes those implementations to use
more appropriate thresholds and adds tests around the thresholds for
various formats.

Tested for x86_64, x86 and powerpc.  x86_64 and x86 ulps updated
accordingly.

[BZ #18046]
[BZ #18047]
* sysdeps/ieee754/ldbl-128ibm/e_atanhl.c (__ieee754_atanhl): Use
0x1p-56L as threshold for just returning the argument.
* sysdeps/ieee754/ldbl-96/e_atanhl.c (__ieee754_atanhl): Use
0x1p-32L as threshold for just returning the argument.
* math/auto-libm-test-in: Add more tests of atanh.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulp: Likewise.

9 years agoRather than using a C implementation of memmove, directly call memmove, which
Wilco Dijkstra [Fri, 27 Feb 2015 14:44:41 +0000 (14:44 +0000)]
Rather than using a C implementation of memmove, directly call memmove, which
typically has a much faster optimized implementation.

9 years agoRather than using a C implementation of memset, directly call memset, which
Wilco Dijkstra [Fri, 27 Feb 2015 14:41:46 +0000 (14:41 +0000)]
Rather than using a C implementation of memset, directly call memset, which
typically has a much faster optimized implementation.

9 years agohppa: fix __O_SYNC to match the kernel
John David Anglin [Sun, 10 Aug 2014 14:00:23 +0000 (10:00 -0400)]
hppa: fix __O_SYNC to match the kernel

9 years agoAdd comment to CSTR macro in k_standard.c.
Joseph Myers [Fri, 27 Feb 2015 01:12:19 +0000 (01:12 +0000)]
Add comment to CSTR macro in k_standard.c.

* sysdeps/ieee754/k_standard.c (CSTR): Add comment.