Commit Graph

18034 Commits

Author SHA1 Message Date
David S. Miller 23ebf74307 Update SPARC ulps.
* sysdeps/sparc/fpu/libm-test-ulps: Update.
2015-04-08 20:34:49 -07:00
Joseph Myers 787d22bce6 Add more tests of atanh.
This patch adds some randomly-generated tests of 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 atanh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-04-08 21:13:35 +00:00
Joseph Myers 024bcc5106 Add more tests of atan.
This patch adds some randomly-generated tests of atan 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 atan.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-04-08 21:00:03 +00:00
Florian Weimer 561052ad35 nscd_getgr_r: Use struct scratch_buffer instead of extend_alloca
The lack of alloca accounting means that the old code could run out of
stack space if multiple retries are needed.
2015-04-08 21:08:03 +02:00
Florian Weimer c6ee40da8b getnameinfo: Use struct scratch_buffer instead of extend_alloca
This patch adjusts the internal function nrl_domainname, too.
2015-04-08 21:07:44 +02:00
Florian Weimer 794a74af4d _nss_compat_initgroups_dyn: Use struct scratch_buffer instead of extend_alloca 2015-04-08 21:07:24 +02:00
Florian Weimer 866ba63b31 grp: Rewrite to use struct scratch_buffer instead of extend_alloca
grp/compat-initgroups.c is included from nscd/initgrcache.c, which is
why the #include directive has to be added there as well.
2015-04-08 21:07:03 +02:00
Florian Weimer 7b8399f479 pldd: Use struct scratch_buffer instead of extend_alloca 2015-04-08 21:06:49 +02:00
Joseph Myers da0cf658c6 Add more tests of cbrt.
This patch adds some randomly-generated tests of cbrt 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 cbrt.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/x86_64/fpu/libm-test-ulps: Update.
2015-04-08 17:56:15 +00:00
Joseph Myers 80352c01c1 Add more tests of cabs.
This patch adds some randomly-generated tests of cabs 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 cabs.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-04-08 17:46:07 +00:00
Joseph Myers 8431838dde Fix dbl-64 atan2 in non-default rounding modes (bug 18210, bug 18211).
The dbl-64 implementation of atan2 does computations that expect to
run in round-to-nearest mode, and in other modes the errors can
accumulate to more than the maximum accepted 9ulp.  This patch makes
it use FE_TONEAREST internally, similar to other functions with such
issues.  Tests that previously produced large errors are added for
atan2 and the closely related carg, clog and clog10 functions.

Tested for x86_64 and x86 and ulps updated accordingly.

	[BZ #18210]
	[BZ #18211]
	* sysdeps/ieee754/dbl-64/e_atan2.c: Include <fenv.h>.
	(__ieee754_atan2): Set FE_TONEAREST mode for internal
	computations.
	* math/auto-libm-test-in: Add more tests of atan2, carg, clog and
	clog10.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-04-08 17:32:17 +00:00
Joseph Myers ae63c7ebed Fix dbl-64 atan in non-default rounding modes (bug 18197).
The dbl-64 implementation of atan does computations that expect to run
in round-to-nearest mode, and in other modes the errors can accumulate
to more than the maximum accepted 9ulp.  This patch makes it use
FE_TONEAREST internally, similar to other functions with such issues.

Tested for x86_64 and x86; no ulps updates needed.

	[BZ #18197]
	* sysdeps/ieee754/dbl-64/s_atan.c: Include <fenv.h>.
	(atan): Set FE_TONEAREST mode for internal computations.
	* math/auto-libm-test-in: Add more tests of atan.
	* math/auto-libm-test-out: Regenerated.
2015-04-08 17:14:12 +00:00
James Cowgill d5856d06c3 [BZ #17930] MIPS: Define SHM_NORESERVE.
[BZ #17930]
	* sysdeps/unix/sysv/linux/mips/bits/shm.h (SHM_NORESERVE): Define.
2015-04-07 17:23:54 +00:00
Florian Weimer 72301304a5 scratch_buffer_grow_preserve: Add missing #include <string.h> 2015-04-07 17:46:58 +02:00
Florian Weimer cfcfd4614b Add struct scratch_buffer and its internal helper functions
These will be used from NSS modules, so they have to be exported.
2015-04-07 11:03:43 +02:00
Richard Henderson 9e8c0381bb math/test-fenvinline: Cast fe_exc to unsigned int before printing
On Alpha and IA-64, fexcept_t is unsigned long.  But all the values
fit within an int, so the cast is ok for printing.  All other hosts
use unsigned int or unsigned short already.
2015-04-06 10:43:59 -07:00
Richard Henderson 974c4a36d8 alpha: Update libm-test-ulps
Regenerated from scratch.
2015-04-06 10:38:16 -07:00
Richard Henderson cc47c82476 alpha: Unconditionally include dl-sysdep.h in sysdep.h
Fixes a -Wundef error wrt RTLD_PRIVATE_ERRNO.
2015-04-06 10:36:44 -07:00
Ondřej Bílka 9781a37002 Handle mblen return code when n is zero. 2015-04-03 15:47:12 +02:00
Florian Weimer 37d60d970c Define libc_max_align_t for internal use 2015-04-02 19:55:21 +02:00
Andreas Schwab b763f6ae85 aarch64: Increase MINSIGSTKSZ and SIGSTKSZ (bug 16850) 2015-04-02 12:18:11 +02:00
Mel Gorman c26efef979 malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
Trimming heaps is a balance between saving memory and the system overhead
required to update page tables and discard allocated pages. The malloc
option M_TRIM_THRESHOLD is a tunable that users are meant to use to decide
where this balance point is but it is only applied to the main arena.

For scalability reasons, glibc malloc has per-thread heaps but these are
shrunk with madvise() if there is one page free at the top of the heap.
In some circumstances this can lead to high system overhead if a thread
has a control flow like

    while (data_to_process) {
        buf = malloc(large_size);
        do_stuff();
        free(buf);
    }

For a large size, the free() will call madvise (pagetable teardown, page
free and TLB flush) every time followed immediately by a malloc (fault,
kernel page alloc, zeroing and charge accounting). The kernel overhead
can dominate such a workload.

This patch allows the user to tune when madvise gets called by applying
the trim threshold to the per-thread heaps and using similar logic to the
main arena when deciding whether to shrink. Alternatively if the dynamic
brk/mmap threshold gets adjusted then the new values will be obeyed by
the per-thread heaps.

Bug 17195 was a test case motivated by a problem encountered in scientific
applications written in python that performance badly due to high page fault
overhead. The basic operation of such a program was posted by Julian Taylor
https://sourceware.org/ml/libc-alpha/2015-02/msg00373.html

With this patch applied, the overhead is eliminated. All numbers in this
report are in seconds and were recorded by running Julian's program 30
times.

pyarray
                                 glibc               madvise
                                  2.21                    v2
System  min             1.81 (  0.00%)        0.00 (100.00%)
System  mean            1.93 (  0.00%)        0.02 ( 99.20%)
System  stddev          0.06 (  0.00%)        0.01 ( 88.99%)
System  max             2.06 (  0.00%)        0.03 ( 98.54%)
Elapsed min             3.26 (  0.00%)        2.37 ( 27.30%)
Elapsed mean            3.39 (  0.00%)        2.41 ( 28.84%)
Elapsed stddev          0.14 (  0.00%)        0.02 ( 82.73%)
Elapsed max             4.05 (  0.00%)        2.47 ( 39.01%)

               glibc     madvise
                2.21          v2
User          141.86      142.28
System         57.94        0.60
Elapsed       102.02       72.66

Note that almost a minutes worth of system time is eliminted and the
program completes 28% faster on average.

To illustrate the problem without python this is a basic test-case for
the worst case scenario where every free is a madvise followed by a an alloc

/* gcc bench-free.c -lpthread -o bench-free */
static int num = 1024;

void __attribute__((noinline,noclone)) dostuff (void *p)
{
}

void *worker (void *data)
{
  int i;

  for (i = num; i--;)
    {
      void *m = malloc (48*4096);
      dostuff (m);
      free (m);
    }

  return NULL;
}

int main()
{
  int i;
  pthread_t t;
  void *ret;
  if (pthread_create (&t, NULL, worker, NULL))
    exit (2);
  if (pthread_join (t, &ret))
    exit (3);
  return 0;
}

Before the patch, this resulted in 1024 calls to madvise. With the patch applied,
madvise is called twice because the default trim threshold is high enough to avoid
this.

This a more complex case where there is a mix of frees. It's simply a different worker
function for the test case above

void *worker (void *data)
{
  int i;
  int j = 0;
  void *free_index[num];

  for (i = num; i--;)
    {
      void *m = malloc ((i % 58) *4096);
      dostuff (m);
      if (i % 2 == 0) {
        free (m);
      } else {
        free_index[j++] = m;
      }
    }
  for (; j >= 0; j--)
    {
      free(free_index[j]);
    }

  return NULL;
}

glibc 2.21 calls malloc 90305 times but with the patch applied, it's
called 13438. Increasing the trim threshold will decrease the number of
times it's called with the option of eliminating the overhead.

ebizzy is meant to generate a workload resembling common web application
server workloads. It is threaded with a large working set that at its core
has an allocation, do_stuff, free loop that also hits this case. The primary
metric of the benchmark is records processed per second. This is running on
my desktop which is a single socket machine with an I7-4770 and 8 cores.
Each thread count was run for 30 seconds. It was only run once as the
performance difference is so high that the variation is insignificant.

                glibc 2.21              patch
threads 1            10230              44114
threads 2            19153              84925
threads 4            34295             134569
threads 8            51007             183387

Note that the saving happens to be a concidence as the size allocated
by ebizzy was less than the default threshold. If a different number of
chunks were specified then it may also be necessary to tune the threshold
to compensate

This is roughly quadrupling the performance of this benchmark. The difference in
system CPU usage illustrates why.

ebizzy running 1 thread with glibc 2.21
10230 records/s 306904
real 30.00 s
user  7.47 s
sys  22.49 s

22.49 seconds was spent in the kernel for a workload runinng 30 seconds. With the
patch applied

ebizzy running 1 thread with patch applied
44126 records/s 1323792
real 30.00 s
user 29.97 s
sys   0.00 s

system CPU usage was zero with the patch applied. strace shows that glibc
running this workload calls madvise approximately 9000 times a second. With
the patch applied madvise was called twice during the workload (or 0.06
times per second).

2015-02-10  Mel Gorman  <mgorman@suse.de>

  [BZ #17195]
  * malloc/arena.c (free): Apply trim threshold to per-thread heaps
    as well as the main arena.
2015-04-02 12:14:14 +05:30
H.J. Lu a3d9ab5070 Limit threads sharing L2 cache to 2 for SLM/KNL
Silvermont and Knights Landing have a modular system design with two cores
sharing an L2 cache.  If more than 2 cores are detected to shared L2 cache,
it should be adjusted for Silvermont and Knights Landing.

	[BZ #18185]
	* sysdeps/x86_64/cacheinfo.c (init_cacheinfo): Limit threads
	sharing L2 cache to 2 for Silvermont/Knights Landing.
2015-03-31 13:18:10 -07:00
H.J. Lu 83569fb894 Add a testcase for copy reloc against protected data
Linkers in some versions of binutils 2.25 and 2.26 don't support protected
data symbol with error messsage like:

/usr/bin/ld: copy reloc against protected `bar' is invalid
/usr/bin/ld: failed to set dynamic section sizes: Bad value

We check if linker supports copy reloc against protected data symbol to
avoid running the test if linker is broken.

	[BZ #17711]
	* config.make.in (have-protected-data): New.
	* configure.ac: Check linker support for protected data symbol.
	* configure: Regenerated.
	* elf/Makefile (modules-names): Add tst-protected1moda and
	tst-protected1modb if $(have-protected-data) is yes.
	(tests): Add tst-protected1a and tst-protected1b if
	$(have-protected-data) is yes.
	($(objpfx)tst-protected1a): New.
	($(objpfx)tst-protected1b): Likewise.
	(tst-protected1modb.so-no-z-defs): Likewise.
	* elf/tst-protected1a.c: New file.
	* elf/tst-protected1b.c: Likewise.
	* elf/tst-protected1mod.h: Likewise.
	* elf/tst-protected1moda.c: Likewise.
	* elf/tst-protected1modb.c: Likewise.
2015-03-31 05:21:12 -07:00
H.J. Lu 62da1e3b00 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.
2015-03-31 05:16:57 -07:00
Martin Galvan 675ddb7184 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.
2015-03-28 01:50:12 -04:00
Martin Galvan 4d611e1261 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.
2015-03-28 00:44:22 -04:00
Roland McGrath 7285eb535a Convert dlfcn/tststatic to use test-skeleton. 2015-03-27 12:55:25 -07:00
Alan Modra 19a6a3acd1 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.
2015-03-26 12:30:45 +10:30
Joseph Myers efd5b641dd 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.
2015-03-25 22:21:20 +00:00
Joseph Myers e9b1015112 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.
2015-03-25 21:57:04 +00:00
Joseph Myers 9fa55373e1 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.
2015-03-25 21:21:18 +00:00
Joseph Myers 38755f1421 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.
2015-03-25 17:53:58 +00:00
Joseph Myers a9fe4c5aa8 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.
2015-03-25 15:17:54 +00:00
Alan Modra afcd9480fe 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.
2015-03-25 15:53:47 +10:30
Alan Modra da9f333410 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
2015-03-25 15:45:36 +10:30
Joseph Myers 8d6439712d 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.
2015-03-25 00:30:10 +00:00
Joseph Myers bc899ea090 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.
2015-03-25 00:05:13 +00:00
Joseph Myers 239ed6f309 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.
2015-03-24 23:48:04 +00:00
Joseph Myers a737e8263a 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.
2015-03-24 23:30:19 +00:00
Joseph Myers 7c84a5042f 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.
2015-03-24 23:06:28 +00:00
Roland McGrath 7e9c7b9b68 Minor cleanups in libio/iofdopen.c 2015-03-23 13:46:36 -07:00
Florian Weimer 98734cc501 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.
2015-03-23 16:34:48 +01:00
Florian Weimer 2b028564f1 Avoid SIGFPE in wordexp [BZ #18100]
Check for a zero divisor and integer overflow before performing
division in arithmetic expansion.
2015-03-23 16:12:38 +01:00
Alan Modra 59261ad3eb 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.
2015-03-23 15:33:59 +10:30
Samuel Thibault 9e70234cbd 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.
2015-03-23 00:31:02 +01:00
Samuel Thibault 661a7dbad0 Fix visibility of EXTPROC macro
* bits/termios.h [!__USE_MISC] (EXTPROC): Do not define.
2015-03-22 17:29:14 +01:00
Joseph Myers 6a9350c854 Note old commit as having resolved bug 11505. 2015-03-21 17:50:13 +00:00
Samuel Thibault 868df0f9e9 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.
2015-03-21 04:49:44 +01:00
Samuel Thibault d583531a9e Add missing dependency
* sysdeps/mach/hurd/Makefile ($(common-objpfx)errnos.d): Depend on
	libc-modules.h
2015-03-21 01:19:23 +01:00
Roland McGrath 298e5d56dc ARM: Fix memcpy & memmove for [ARM_ALWAYS_BX] 2015-03-19 12:45:24 -07:00
Chris Metcalf becb26b84b linux-generic: add a README 2015-03-19 13:33:01 -04:00
Joseph Myers c2f5813ae0 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.
2015-03-18 17:05:38 +00:00
Brad Hubbard ed6b0fe710 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)
2015-03-18 14:51:26 +05:30
Alexandre Oliva f8aeae3473 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.
2015-03-17 00:31:49 -03:00
H.J. Lu b97eb2bdb1 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.
2015-03-16 14:59:14 -07:00
Paul Eggert cb21929049 * stdlib/setenv.c (__add_to_environ): Revert previous change. 2015-03-15 17:06:21 -07:00
Andreas Schwab a3905fd9de m68k: fix 64-bit arithmetic in atomic operations (bug 18128) 2015-03-14 22:27:36 +01:00
Paul Eggert 2ecccaede9 * stdlib/setenv.c (__add_to_environ):
Dump core quickly if setenv (..., NULL, ...) is called.
2015-03-13 10:14:03 -07:00
Roland McGrath cdaf79d0af ARM: Rewrite sysdeps/arm/tls-macros.h 2015-03-13 10:10:09 -07:00
Carlos O'Donell cf9313e7d1 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.
2015-03-13 09:49:24 -04:00
Joseph Myers 7d67a196b6 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>.
2015-03-12 18:43:21 +00:00
Yaakov Selkowitz af85ebcdf7 manual: fix XPG basename prototype
* manual/string.texi (XPG basename): Fix prototype.
2015-03-12 17:56:46 +01:00
Stefan Liebler 2e807f2959 S/390: Fix setcontext/swapcontext which are not restoring sigmask. 2015-03-12 11:08:11 +01:00
Stefan Liebler 1b2bebe6b7 S/390: Regenerate ULPs 2015-03-12 11:04:13 +01:00
Aurelien Jarno 6a1cf708dd 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.
2015-03-11 21:07:32 -04:00
Paul Pluzhnikov a2d4cf72c0 Fix BZ #18043 comment # 19: don't call undefined setenv(..., NULL, 1). 2015-03-11 08:55:50 -07:00
Adhemerval Zanella 5ca10a0c9a 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.
2015-03-11 09:01:05 -04:00
Mike Frysinger b42e14ff3e hppa: update __O_SYNC fix with [BZ #18068] 2015-03-11 03:33:07 -04:00
Carlos O'Donell e4363cfb57 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.
2015-03-11 02:48:59 -04:00
John David Anglin fae1aa8d22 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.
2015-03-11 02:48:22 -04:00
Joseph Myers 068a627455 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.
2015-03-11 01:14:34 +00:00
Roland McGrath 44a6213c8e Let tests result in UNSUPPORTED; use that for unbuildable C++ cases 2015-03-10 15:13:14 -07:00
Roland McGrath d3821ab0ac Harmonize posix/regcomp.c with gnulib: comment formatting 2015-03-10 13:53:34 -07:00
Carlos O'Donell 85ca85ae9a hppa: Update libm-test-ulps. 2015-03-10 16:09:37 -04:00
Joseph Myers 6411f81da9 Add test for bug 18104.
[BZ #18104]
	* math/auto-libm-test-in: Add another test of pow.
	* math/auto-libm-test-out: Regenerated.
2015-03-10 17:53:40 +00:00
Adhemerval Zanella d421868bb8 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.
2015-03-10 09:38:54 -04:00
Joseph Myers a2f8be9c83 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.
2015-03-10 00:32:29 +00:00
Paul Pluzhnikov 01d032e0bb Minor refactoring:
* posix/wordexp.c (CHAR_IN_SET): New macro.
	(parse_param): Use it.
2015-03-09 14:41:35 -07:00
Adhemerval Zanella d439bc56e1 Update powerpc-fpu ULPs. 2015-03-09 13:42:42 -04:00
Paul Pluzhnikov 5f85a4bf94 Fix BZ #18043 (c4): buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param 2015-03-09 07:22:36 -07:00
Paul Pluzhnikov f8ba70e9f8 Fix off-by-one which caused BZ #18042 and add a test for it. 2015-03-08 21:55:13 -07:00
Paul Pluzhnikov 36103ba2f5 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).
2015-03-08 21:37:31 -07:00
Paul Pluzhnikov 18d26750dd Cleanup: in preparation for fixing BZ #16734, fix memory leaks exposed by
switching fopen()ed streams from mmap to malloc.
2015-03-08 09:46:53 -07:00
Samuel Thibault 9f95dc5d22 hurd: Make libc able to call pthread stubs
* sysdeps/mach/hurd/bits/libc-lock.h [_LIBC]: Include
	<bits/libc-lockP.h>
2015-03-08 11:26:57 +01:00
Joseph Myers b838844bc5 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.
2015-03-07 01:39:42 +00:00
H.J. Lu e0ed2fb40a 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.
2015-03-06 17:05:42 -08:00
Joseph Myers fa9dda6493 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>.
2015-03-07 00:36:02 +00:00
Roland McGrath 4acc27ed0a Document test-wrapper-env-only in INSTALL. 2015-03-06 10:59:15 -08:00
Roland McGrath 00f00cfc37 ChangeLog format 2015-03-06 10:52:53 -08:00
Paul Pluzhnikov 895c30cb00 Fix BZ #18043: buffer-overflow (read past the end) in wordexp/parse_dollars/parse_param 2015-03-06 09:13:16 -08:00
Vincent Bernat 5df56c7e3a time: ensure failing strptime() tests are reported correctly 2015-03-06 06:06:26 -05:00
Samuel Thibault 1cdf2ea1fa Fix aio_error thread-safety.
* sysdeps/pthread/aio_error.c: New file
* sysdeps/pthread/aio_misc.c: Remove optimistic comment about
synchronization.
2015-03-06 11:32:24 +01:00
Florian Weimer 1597b7447a 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.
2015-03-06 11:06:33 +01:00
Florian Weimer 627e7a5f5b vfprintf: Introduce JUMP_TABLE_BASE_LABEL
This makes the offset handling more explicit and avoids
cross-references between the jump tables.
2015-03-06 10:29:49 +01:00
Florian Weimer d176a41a62 vfprintf: Introduce THOUSANDS_SEP_T
This avoids preprocessor conditionals in function declarations.
2015-03-06 10:26:58 +01:00
Rical Jasan 7e7af3496e 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.
2015-03-06 00:59:49 -05:00
Mike Frysinger 4ca8ddfb05 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.
2015-03-06 00:57:43 -05:00
Roland McGrath 9162c01d09 Avoid re-exec-self in bug-setlocale1. 2015-03-05 12:58:49 -08:00
H.J. Lu 209826bcf2 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.
2015-03-05 08:40:41 -08:00
Roland McGrath 8bff5aab5b Define ETH_ALEN in generic <netinet/if_ether.h>. 2015-03-04 16:11:31 -08:00
Roland McGrath 2752f3381b Split rpcent tests out of tst-netdb. 2015-03-04 15:55:38 -08:00
Roland McGrath 2cfe32bc05 Conditionalize some test code for SIGRTMIN, SA_SIGINFO. 2015-03-04 15:14:56 -08:00
Roland McGrath e27176eea8 Avoid more C++ tests. 2015-03-04 14:11:39 -08:00
Roland McGrath e4693aa7c1 Avoid C++ tests when the C++ cannot be linked. 2015-03-04 13:52:45 -08:00
Andreas Schwab 8e2e833ac4 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.
2015-03-04 11:52:55 +01:00
Adhemerval Zanella 85b290451e 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.
2015-03-03 10:01:49 -05:00
Alan Modra a0af371c25 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.
2015-03-03 23:43:18 +10:30
Roland McGrath 47465629e7 Deglobalize internal variables in timer_routines.c. 2015-03-02 15:44:27 -08:00
Joseph Myers 6d08b0223a 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.
2015-03-02 23:05:55 +00:00
Paul Pluzhnikov c2c6d39fab Fix BZ 18036 buffer overflow (read past end of buffer) in internal_fnmatch 2015-03-02 13:34:22 -08:00
Andreas Schwab e8b6be0016 Fix parallel build error 2015-03-02 15:56:22 +01:00
Florian Weimer 1a2d98aff2 _nss_nis_initgroups_dyn: Return status instead of NSS_STATUS_SUCCESS 2015-03-02 10:08:12 +01:00
Alexandre Oliva e7f07af50b 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.
2015-02-27 22:18:56 -03:00
Roland McGrath c7b19ca99a Convert dlfcn/tststatic2 to use test-skeleton. 2015-02-27 15:54:33 -08:00
H.J. Lu ef4ad06fe5 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.
2015-02-27 14:13:28 -08:00
Joseph Myers 2ca725c594 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.
2015-02-27 17:48:37 +00:00
Wilco Dijkstra af96be3482 Rather than using a C implementation of memmove, directly call memmove, which
typically has a much faster optimized implementation.
2015-02-27 14:44:41 +00:00
Wilco Dijkstra ddcf6798d3 Rather than using a C implementation of memset, directly call memset, which
typically has a much faster optimized implementation.
2015-02-27 14:41:46 +00:00
John David Anglin 49f476f479 hppa: fix __O_SYNC to match the kernel 2015-02-27 01:46:01 -05:00
Joseph Myers f8ab5d38fd Add comment to CSTR macro in k_standard.c.
* sysdeps/ieee754/k_standard.c (CSTR): Add comment.
2015-02-27 01:12:19 +00:00
Joseph Myers 31331a07a5 Avoid -Wno-write-strings for k_standard.c.
We want to avoid -Wno- options in makefiles as far as possible, by
cleaning up the underlying issues if possible or failing that by using
diagnostic pragmas.  This patch eliminates the use of
-Wno-write-strings for sysdeps/ieee754/k_standard.c by using casts in
the source file to cast away const; those casts are encapsulated in a
macro that also deals with the choice of strings for float / double /
long double functions (for which the logic was previously replicated
many times).

Tested for x86_64; the only change to disassembly of installed
stripped shared libraries was a line number in an assertion.

	* sysdeps/ieee754/k_standard.c (CSTR): New macro.
	(__kernel_standard): Use CSTR macro when setting exc.name.
	* sysdeps/ieee754/Makefile [$(subdir) = math]
	(CFLAGS-k_standard.c): Remove variable.
2015-02-26 22:50:54 +00:00
Joseph Myers 09220e6634 Avoid uninitialized warnings in Bessel functions.
math/Makefile currently has:

  # The fdlibm code generates a lot of these warnings but is otherwise clean.
  override CFLAGS += -Wno-uninitialized

This is of course undesirable; warnings should be disabled as narrowly
as possible.  To remove this override, we need to fix files that
generate such warnings, or put warning-disabling pragmas in them.
This patch does so for Bessel function implementations, one of the
cases that have the warnings if the override is removed.  The warnings
arise because functions set pointer variables p and q only for certain
values of the function argument, then use them unconditionally.  As
the static functions in question only get called for arguments that
satisfy the last condition in the if/else chain, the natural fix is to
change the last "else if" to just "else", which this patch does.  (The
ldbl-128 / ldbl-128ibm implementation of these functions is
substantially different and looks like it already does use "else" in
the last case in the nearest corresponding code.)

Tested for x86_64 and x86.

	* sysdeps/ieee754/dbl-64/e_j0.c (pzero): Change last case for
	setting p and q from "else if" to "else".
	(qzero): Likewise.
	* sysdeps/ieee754/dbl-64/e_j1.c (pone): Likewise.
	(qone): Likewise.
	* sysdeps/ieee754/flt-32/e_j0f.c (pzerof): Likewise.
	(qzerof): Likewise.
	* sysdeps/ieee754/flt-32/e_j1f.c (ponef): Likewise.
	(qonef): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j0l.c (pzero): Likewise.
	(qzero): Likewise.
	* sysdeps/ieee754/ldbl-96/e_j1l.c (pone): Likewise.
	(qone): Likewise.
2015-02-26 21:49:19 +00:00
Joseph Myers 1d9ab20c14 Fix ldbl-128/ldbl-128ibm acosl inaccuracy (bug 18038, bug 18039).
The ldbl-128 and ldbl-128ibm implementations of acosl have similar
bugs, using a threshold of 0x1p-57L to determine when they just return
pi/2.  Since the result pi/2 - asinl (x) is roughly pi/2 - x for small
x, the relevant cut-off is actually x being < 0.5ulp of 1.  This patch
fixes the implementations to use that cut-off and adds tests of small
acos arguments.

Tested for powerpc and mips64.  Also tested for x86_64 and x86; no
ulps updates needed.

	[BZ #18038]
	[BZ #18039]
	* sysdeps/ieee754/ldbl-128/e_acosl.c (__ieee754_acosl): Only
	return pi/2 for arguments below 0x1p-113L.
	* sysdeps/ieee754/ldbl-128ibm/e_acosl.c (__ieee754_acosl): Only
	return pi/2 for arguments below 0x1p-106L.
	* math/auto-libm-test-in: Add more tests of acos.
	* math/auto-libm-test-out: Regenerated.
2015-02-26 21:06:34 +00:00
Joseph Myers ec0ce0d3be Fix asin missing underflows (bug 16351).
Similar to various other bugs in this area, some asin implementations
do not raise the underflow exception for subnormal arguments, when the
result is tiny and inexact.  This patch forces the exception in a
similar way to previous fixes.

Tested for x86_64, x86, powerpc and mips64.

	[BZ #16351]
	* sysdeps/i386/fpu/e_asin.S (dbl_min): New object.
	(MO): New macro.
	(__ieee754_asin): Force underflow exception for results with small
	absolute value.
	* sysdeps/i386/fpu/e_asinf.S (flt_min): New object.
	(MO): New macro.
	(__ieee754_asinf): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/dbl-64/e_asin.c: Include <float.h> and <math.h>.
	(__ieee754_asin): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/flt-32/e_asinf.c: Include <float.h>.
	(__ieee754_asinf): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-128/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-128ibm/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/ldbl-96/e_asinl.c: Include <float.h>.
	(__ieee754_asinl): Force underflow exception for results with
	small absolute value.
	* sysdeps/x86_64/fpu/multiarch/e_asin.c [HAVE_FMA4_SUPPORT]:
	Include <math.h>.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 16351.
	* math/auto-libm-test-out: Regenerated.
2015-02-26 17:18:54 +00:00
Joseph Myers 380bd0fd24 Fix ldbl-128ibm logbl near powers of 2 (bug 18030).
The ldbl-128ibm implementation of logbl produces incorrect results
when the high part of the argument is a power of 2 and the low part a
nonzero number with the opposite sign (and so the returned exponent
should be 1 less than that of the high part).  For example, logbl
(0x1.ffffffffffffffp1L) returns 2 but should return 1.  (This is
similar to (fixed) bug 16740 for frexpl, and (fixed) bug 18029 for
ilogbl.)  This patch adds checks for that case.

Tested for powerpc.

	[BZ #18030]
	* sysdeps/ieee754/ldbl-128ibm/s_logbl.c (__logbl): Adjust exponent
	of power of 2 down when low part has opposite sign.
	* math/libm-test.inc (logb_test_data): Add more tests.
2015-02-26 15:14:58 +00:00
Andreas Schwab 4a28f4d55a Fix read past end of pattern in fnmatch (bug 18032) 2015-02-26 16:05:08 +01:00
Joseph Myers 524ae9ea2e Fix ldbl-128ibm ilogbl near powers of 2 (bug 18029).
The ldbl-128ibm implementation of ilogbl produces incorrect results
when the high part of the argument is a power of 2 and the low part a
nonzero number with the opposite sign (and so the returned exponent
should be 1 less than that of the high part).  For example, ilogbl
(0x1.ffffffffffffffp1L) returns 2 but should return 1.  (This is
similar to (fixed) bug 16740 for frexpl, and bug 18030 for logbl.)
This patch adds checks for that case.

Tested for powerpc.

	[BZ #18029]
	* sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c (__ieee754_ilogbl):
	Adjust exponent of power of 2 down when low part has opposite
	sign.
	* math/libm-test.inc (ilogb_test_data): Add more tests.
2015-02-26 12:57:21 +00:00
Alexandre Oliva 23d43090e0 Fix constness error just introduced in findlocale.
for  ChangeLog

	[BZ #15969]
	* locale/findlocale.c (_nl_find_locale): Fix constness error in
	the previous change.
2015-02-26 02:46:02 -03:00
Alexandre Oliva 0d822a016b BZ #15969: search locale archive again after alias expansion
If a locale alias is defined in locale.alias but not in an archive,
and the referenced locale is only present in the archive, setlocale
will fail if given the alias name.  This is unintuitive.  This patch
fixes it, arranging for the locale archive to be searched again after
alias expansion.

for  ChangeLog

	[BZ #15969]
	* locale/findlocale.c (_nl_find_locale): Retry archive search
	after alias expansion.
2015-02-26 02:16:51 -03:00
Roland McGrath ca681b7b7b Convert tst-iconv3 to use test-skeleton. 2015-02-25 16:01:13 -08:00
Roland McGrath fd1f2f1c3d Convert tst-iconv5 to use test-skeleton. 2015-02-25 15:55:08 -08:00
Roland McGrath d19df6ac5a Don't crash in iconv setup when getcwd fails. 2015-02-25 15:41:31 -08:00
Adhemerval Zanella 115e0de72a powerpc: Fix memmove static build
This patch fixes the missing "__memcpy_ppc" symbol for memmove-ppc64
object in static builds.  Since memcpy ifunc is not enabled in static
mode, the specialized symbols are not provided.  The patch changed the
it to just "__memcpy" instead.
2015-02-25 13:25:54 -05:00
Joseph Myers 137cef7d43 Fix ldbl-128ibm asinhl inaccuracy (bug 18020).
The ldbl-128ibm implementation of asinhl uses cut-offs of 0x1p28 and
0x1p-29 to determine when to use simpler formulas that avoid possible
overflow / underflow.  Both those cut-offs are inappropriate for this
format, resulting in large errors.  This patch changes the code to use
more appropriate cut-offs of 0x1p56 and 0x1p-56, adding tests around
the cut-offs for various floating-point formats.

Tested for powerpc.  Also tested for x86_64 and x86 and updated ulps.

	[BZ #18020]
	* sysdeps/ieee754/ldbl-128ibm/s_asinhl.c (__asinhl): Use 2**56 and
	2**-56 not 2**28 and 2**-29 as thresholds for simpler formulas.
	* math/auto-libm-test-in: Add more tests of asinh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-02-25 11:13:41 +00:00
Cong Wang cb43bb0d68 in.h: Coordinate in6_pktinfo and ip6_mtuinfo for kernel and glibc [BZ #15850]
Similarly to what we did for in6_addr, we need a macro
to guard in6_pktinfo and ip6_mtuinfo too.

Cc: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2015-02-25 00:13:28 -05:00
Benno Schulenberg 9be1052b6f sprof: Make an error message identical to two others, and more accurate. 2015-02-25 00:04:55 -05:00
Kevin Easton 6807b1db82 Reduce lock contention in __tz_convert() [BZ #16145] (partial fix)
This patch is an "easy win" partial fix for BZ #16145, which notes
the heavy contention on tzset_lock when multiple threads are converting
times with localtime_r().

In __tz_convert(), the lock does not need to be held after
__tzfile_compute() / __tz_compute() have been called, so we can move the
unlock up.  At this point there is still significant work to be done in
__offtime(), so we see some improvement (in my testing with 8 cores
banging on localtime_r(), ~20% improvement in throughput).
2015-02-24 23:58:59 -05:00
Miroslav Lichvar b433df00ae Update timex.h for ADJ_SETOFFSET.
ADJ_SETOFFSET is a new adjtimex() mode that can be used to precisely
step the clock. It was introduced in kernel 2.6.39.
2015-02-24 23:53:30 -05:00
Joseph Myers 440169d681 Fix ldbl-128ibm acoshl inaccuracy (bug 18019).
The ldbl-128ibm implementation of acoshl uses a cut-off of 0x1p28 to
determine when to use log(x) + log(2) as a formula.  That cut-off is
too small for this format, resulting in large errors.  This patch
changes it to a more appropriate cut-off of 0x1p56, adding tests
around the cut-offs for various floating-point formats.

Tested for powerpc.  Also tested for x86_64 and x86 and updated ulps.

	[BZ #18019]
	* sysdeps/ieee754/ldbl-128ibm/e_acoshl.c (__ieee754_acoshl): Use
	2**56 not 2**28 as threshold for log (2x) formula.
	* math/auto-libm-test-in: Add more tests of acosh.
	* math/auto-libm-test-out: Regenerated.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
	* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
2015-02-25 00:01:15 +00:00
Mike Frysinger ba7d2c543f alloca: fix buf interaction
The stack-grows-down case is missing paren around the buf cast.

The stack-grows-up case is missing a cast with the buf assignment.
This leads to build failures due to -Werror:
vfprintf.c: In function '_IO_vfprintf_internal':
vfprintf.c:1738:16: error: initialization from incompatible pointer type [-Werror]
2015-02-24 13:29:40 -05:00
Joseph Myers 9438b237ab Fix x86/x86_64 scalb (qNaN, -Inf) (bug 16783).
Various x86 / x86_64 versions of scalb / scalbf / scalbl produce
spurious "invalid" exceptions for (qNaN, -Inf) arguments, because this
is wrongly handled like (+/-Inf, -Inf) which *should* raise such an
exception.  (In fact the NaN case of the code determining whether to
quietly return a zero or a NaN for second argument -Inf was
accidentally dead since the code had been made to return a NaN with
exception.)  This patch fixes the code to do the proper test for an
infinity as distinct from a NaN.

(Since the existing code does nothing to distinguish qNaNs and sNaNs
here, this patch doesn't either.  If in future we systematically
implement proper sNaN semantics following TS 18661-1:2014, there will
be lots of bugs to address - Thomas found lots of issues with his
patch <https://sourceware.org/ml/libc-ports/2013-04/msg00008.html> to
add SNaN tests (which never went in and would now require significant
reworking).)

Tested for x86_64 and x86.  Committed.

	[BZ #16783]
	* sysdeps/i386/fpu/e_scalb.S (__ieee754_scalb): Do not handle
	arguments (NaN, -Inf) the same as (+/-Inf, -Inf).
	* sysdeps/i386/fpu/e_scalbf.S (__ieee754_scalbf): Likewise.
	* sysdeps/i386/fpu/e_scalbl.S (__ieee754_scalbl): Likewise.
	* sysdeps/x86_64/fpu/e_scalbl.S (__ieee754_scalbl): Likewise.
	* math/libm-test.inc (scalb_test_data): Add more tests.
2015-02-24 17:30:02 +00:00
Paul Pluzhnikov 6909d27675 Fix BZ #17916 - fopen unbounded stack usage for ccs= modes 2015-02-24 08:05:34 -08:00
Eric Rannaud 65f6f938cd linux: open and openat ignore 'mode' with O_TMPFILE in flags
Both open and openat load their last argument 'mode' lazily, using
va_arg() only if O_CREAT is found in oflag. This is wrong, mode is also
necessary if O_TMPFILE is in oflag.

By chance on x86_64, the problem wasn't evident when using O_TMPFILE
with open, as the 3rd argument of open, even when not loaded with
va_arg, is left untouched in RDX, where the syscall expects it.

However, openat was not so lucky, and O_TMPFILE couldn't be used: mode
is the 4th argument, in RCX, but the syscall expects its 4th argument in
a different register than the glibc wrapper, in R10.

Introduce a macro __OPEN_NEEDS_MODE (oflag) to test if either O_CREAT or
O_TMPFILE is set in oflag.

Tested on Linux x86_64.

	[BZ #17523]
	* io/fcntl.h (__OPEN_NEEDS_MODE): New macro.
	* io/bits/fcntl2.h (open): Use it.
	(openat): Likewise.
	* io/open.c (__libc_open): Likewise.
	* io/open64.c (__libc_open64): Likewise.
	* io/open64_2.c (__open64_2): Likewise.
	* io/open_2.c (__open_2): Likewise.
	* io/openat.c (__openat): Likewise.
	* io/openat64.c (__openat64): Likewise.
	* io/openat64_2.c (__openat64_2): Likewise.
	* io/openat_2.c (__openat_2): Likewise.
	* sysdeps/mach/hurd/open.c (__libc_open): Likewise.
	* sysdeps/mach/hurd/openat.c (__openat): Likewise.
	* sysdeps/posix/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise.
	* sysdeps/unix/sysv/linux/generic/open.c (__libc_open): Likewise.
	(__open_nocancel): Likewise.
	* sysdeps/unix/sysv/linux/generic/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/open64.c (__libc_open64): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (__OPENAT): Likewise.
2015-02-24 13:19:22 +05:30
Siddhesh Poyarekar 3e3002ffea Skip logging for DNSSEC responses [BZ 14841]
DNSSEC defines a number of response types that one me expect when the
DO bit is set.  We don't process any of them, but since we do allow
setting the DO bit, skip them without logging an error since it is
only a nuisance.

Tested on x86_64.

	[BZ #14841]
	* resolv/gethnamaddr.c (getanswer): Skip logging if
	RES_USE_DNSSEC is set.
	* resolv/nss_dns/dns-host.c (getanswer_r): Likewise.
2015-02-24 13:17:29 +05:30
Mike Frysinger 9813dd5835 add changelog for previous commit 2015-02-24 00:15:23 -05:00
Alexandre Oliva 7b1ec6a05c Amendments to Unicode 7 update.
for  ChangeLog

	* include/stdc-predef.h (__STDC_ISO_10646__): Update to
	201304L, for Unicode 7.

for  localedata/ChangeLog

	* unicode-gen/ctype_compatibility.py: Use date ranges in
	copyright notice.
	* unicode-gen/ctype_compatibility_test_cases.py: Likewise.
	* unicode-gen/gen_unicode_ctype.py: Likewise.
	* unicode-gen/utf8_compatibility.py: Likewise.
	* unicode-gen/utf8_gen.py: Likewise.  Use upper case for
	global variables, use tuples for global constant arrays.  From
	Mike FABIAN.  Suggested by Mike Frysinger <vapier@gentoo.org>.
2015-02-23 11:35:24 -03:00
H.J. Lu d49499c128 Compile gcrt1.o with -fPIC
We compile gcrt1.o with -fPIC to support both "gcc -pg" and "gcc -pie -pg".

	[BZ #17836]
	* csu/Makefile (extra-objs): Add gmon-start.o if not builing
	shared library.  Add gmon-start.os otherwise.
	($(objpfx)g$(start-installed-name)): Use $(objpfx)S%
	$(objpfx)gmon-start.os if builing shared library.
	($(objpfx)g$(static-start-installed-name)): Likewise.
2015-02-23 06:28:33 -08:00
Andreas Schwab 5122580325 Fix failure of elf/tst-audit2 when compiled with GCC-5 2015-02-23 12:35:54 +01:00
Paul Pluzhnikov bdf1ff052a Fix BZ #17269 -- _IO_wstr_overflow integer overflow 2015-02-22 12:01:47 -08:00
Chung-Lin Tang 9529611240 Adjust timeouts for some tests, to accommodate slow processors,
often without FPUs.
2015-02-22 01:05:02 -08:00
Joseph Myers e4a399dc3d soft-fp: Adjust call to abort for kernel use.
soft-fp calls abort in various cases that the code doesn't handle, all
cases that should never actually occur for any supported choice of
types.

Calling an abort function is not appropriate for kernel use, so the
Linux kernel redefines abort as a macro in various ways in the ports
using this code, typically to "return 0" or similar.

One use of abort in soft-fp is inside a comma expression and doesn't
work with such a macro.  This patch changes it to use a statement
expression.

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

(There are two classes of aborts: those to make control flow visible
to the compiler, in default cases of switches over _FP_CLS_COMBINE,
which could reasonably change to __builtin_unreachable for glibc but
would still need to handle pre-4.5 compilers for kernel use, and those
intended to detect any use of soft-fp for combinations of types the
code doesn't know how to handle, which could reasonably become link
failures if the calls should always be optimized away.  But those are
separate possible future enhancements.)

	* soft-fp/op-common.h (_FP_FROM_INT): Wrap call to abort in
	expression inside statement expression.
2015-02-20 18:07:03 +00:00
Stefan Liebler 7133957fe8 s390: Use generic lowlevellock-futex.h
* sysdeps/unix/sysv/linux/s390/lowlevellock.h: Include
      <sysdeps/nptl/lowlevellock.h> and remove macros and
      functions that are now defined there.
      (SYS_futex): Remove.
      (lll_compare_and_swap): Remove.
      * sysdeps/s390/bits/atomic.h (atomic_exchange_acq): Define.
2015-02-20 10:48:06 +01:00
Joseph Myers 40176158f1 Fix scandir scandirat namespace (bug 17999).
The POSIX function scandir calls scandirat, which is not a POSIX
function.  This patch fixes this by making it use __scandirat and
making scandirat a weak alias.  There are no changes for scandir64 /
scandirat64 because those are both _GNU_SOURCE-only functions so no
namespace issue arises for them.

Tested for x86_64 that the disassembly of installed shared libraries
is unchanged by this patch.

	[BZ #17999]
	* dirent/scandir.c [!SCANDIR] (SCANDIRAT): Define to __scandirat
	instead of scandirat.
	* dirent/scandirat.c [!SCANDIRAT] (SCANDIRAT): Likewise.
	[!SCANDIRAT] (SCANDIRAT_WEAK_ALIAS): Define.
	[SCANDIRAT_WEAK_ALIAS] (scandirat): Define as weak alias of
	__scandirat.
	* include/dirent.h (scandirat): Do not use libc_hidden_proto.
	(__scandirat): Declare.  Use libc_hidden_proto.
	* conform/Makefile (test-xfail-POSIX2008/dirent.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/dirent.h/linknamespace): Likewise.
2015-02-19 17:18:51 +00:00
Joseph Myers 4629c866ad Fix atan / atan2 missing underflows (bug 15319).
This patch fixes bug 15319, missing underflows from atan / atan2 when
the result of atan is very close to its small argument (or that of
atan2 is very close to the ratio of its arguments, which may be an
exact division).

The usual approach of doing an underflowing computation if the
computed result is subnormal is followed.  For 32-bit x86, there are
extra complications: the inline __ieee754_atan2 in bits/mathinline.h
needs to be disabled for float and double because other libm functions
using it generally rely on getting proper underflow exceptions from
it, while the out-of-line functions have to remove excess range and
precision from the underflowing result so as to return an exact 0 in
the case where errno should be set for underflow to 0.  (The failures
I saw without that are similar to those Carlos reported for other
functions, where I haven't seen a response to
<https://sourceware.org/ml/libc-alpha/2015-01/msg00485.html>
confirming if my diagnosis is correct.  Arguably all libm functions
with float and double returns should remove excess range and
precision, but that's a separate matter.)

The x86_64 long double case reported in a comment in bug 15319 is not
a bug (it's an argument of LDBL_MIN, and x86_64 is an after-rounding
architecture so the correct IEEE result is not to raise underflow in
the given rounding mode, in addition to treating the result as an
exact LDBL_MIN being within the newly clarified documentation of
accuracy goals).  I'm presuming that the fpatan instruction can be
trusted to raise appropriate exceptions when the (long double) result
underflows (after rounding) and so no changes are needed for x86 /
x86_64 long double functions here; empirically this is the case for
the cases covered in the testsuite, on my system.

Tested for x86_64, x86, powerpc and mips64.  Only 32-bit x86 needs
ulps updates (for the changes to inlines meaning some functions no
longer get excess precision from their __ieee754_atan2* calls).

	[BZ #15319]
	* sysdeps/i386/fpu/e_atan2.S (dbl_min): New object.
	(MO): New macro.
	(__ieee754_atan2): For results with small absolute value, force
	underflow exception and remove excess range and precision from
	return value.
	* sysdeps/i386/fpu/e_atan2f.S (flt_min): New object.
	(MO): New macro.
	(__ieee754_atan2f): For results with small absolute value, force
	underflow exception and remove excess range and precision from
	return value.
	* sysdeps/i386/fpu/s_atan.S (dbl_min): New object.
	(MO): New macro.
	(__atan): For results with small absolute value, force underflow
	exception and remove excess range and precision from return value.
	* sysdeps/i386/fpu/s_atanf.S (flt_min): New object.
	(MO): New macro.
	(__atanf): For results with small absolute value, force underflow
	exception and remove excess range and precision from return value.
	* sysdeps/ieee754/dbl-64/e_atan2.c: Include <float.h> and
	<math.h>.
	(__ieee754_atan2): Force underflow exception for results with
	small absolute value.
	* sysdeps/ieee754/dbl-64/s_atan.c: Include <float.h> and
	<math_private.h>.
	(atan): Force underflow exception for results with small absolute
	value.
	* sysdeps/ieee754/flt-32/s_atanf.c: Include <float.h>.
	(__atanf): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/ldbl-128/s_atanl.c: Include <float.h> and
	<math.h>.
	(__atanl): Force underflow exception for results with small
	absolute value.
	* sysdeps/ieee754/ldbl-128ibm/s_atanl.c: Include <float.h>.
	(__atanl): Force underflow exception for results with small
	absolute value.
	* sysdeps/x86/fpu/bits/mathinline.h
	[!__SSE2_MATH__ && !__x86_64__ && __LIBC_INTERNAL_MATH_INLINES]
	(__ieee754_atan2): Only define inline for long double.
	* sysdeps/x86_64/fpu/multiarch/e_atan2.c
	[HAVE_FMA4_SUPPORT || HAVE_AVX_SUPPORT]: Include <math.h>.
	* math/auto-libm-test-in: Do not mark underflow exceptions as
	possibly missing for bug 15319.  Add more tests of atan2.
	* math/auto-libm-test-out: Regenerated.
	* math/libm-test.inc (casin_test_data): Do not mark underflow
	exceptions as possibly missing for bug 15319.
	(casinh_test_data): Likewise.
	* sysdeps/i386/fpu/libm-test-ulps: Update.
2015-02-18 21:10:49 +00:00
Steve Ellcey 9ee16d8b34 2015-02-18 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/unix/sysv/linux/mips/bits/endian.h: Remove.
	* sysdeps/mips/bits/endian.h: Fix comments.
2015-02-18 10:51:37 -08:00
Joseph Myers 4ffb177155 Fix search.h namespace (bug 17996).
The implementation of the (XSI POSIX) functions hsearch / hcreate /
hdestroy uses hsearch_r / hcreate_r / hdestroy_r, which are not POSIX
functions.  This patch makes those into weak aliases for __*_r and
uses those names for the calls within libc.

Tested for x86_64 that the disassembly of installed shared libraries
is unchanged by this patch.

	[BZ #17996]
	* include/search.h (hcreate_r): Don't use libc_hidden_proto.
	(hdestroy_r): Likewise.
	(hsearch_r): Likewise.
	(__hcreate_r): Declare and use libc_hidden_proto.
	(__hdestroy_r): Likewise.
	(__hsearch_r): Likewise.
	* misc/hsearch.c (hsearch): Call __hsearch_r instead of hsearch_r.
	(hcreate): Call __hcreate_r instead of hcreate_r.
	(__hdestroy): Call __hdestroy_r instead of hdestroy_r.
	* misc/hsearch_r.c (hcreate_r): Rename to __hcreate_r and define
	as weak alias of __hcreate_r.
	(hdestroy_r): Rename to __hdestroy_r and define as weak alias of
	__hdestroy_r.
	(hsearch_r): Rename to __hsearch_r and define as weak alias of
	__hsearch_r.
	* conform/Makefile (test-xfail-XPG3/search.h/linknamespace):
	Remove variable.
	(test-xfail-XPG4/search.h/linknamespace): Likewise.
	(test-xfail-UNIX98/search.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/search.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/search.h/linknamespace): Likewise.
2015-02-18 18:47:34 +00:00
Siddhesh Poyarekar 94c5a52a84 Consolidate arena_lookup and arena_lock into a single arena_get
This seems to have been left behind as an artifact of some old changes
and can now be merged.  Verified that the only generated code change
on x86_64 is that of line numbers in asserts, like so:

@@ -27253,7 +27253,7 @@ Disassembly of section .text:
   416f09:      48 89 42 20             mov    %rax,0x20(%rdx)
   416f0d:      e9 7e f6 ff ff          jmpq   416590 <_int_free+0x230>
   416f12:      b9 3f 9f 4a 00          mov    $0x4a9f3f,%ecx
-  416f17:      ba d5 0f 00 00          mov    $0xfd5,%edx
+  416f17:      ba d6 0f 00 00          mov    $0xfd6,%edx
   416f1c:      be a8 9b 4a 00          mov    $0x4a9ba8,%esi
   416f21:      bf 6a 9c 4a 00          mov    $0x4a9c6a,%edi
   416f26:      e8 45 e8 ff ff          callq  415770 <__malloc_assert>
2015-02-18 11:06:06 +05:30
Carlos O'Donell 8a35c3fe12 Use alignment macros, pagesize and powerof2.
We are replacing all of the bespoke alignment code with
ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN.
This cleans up malloc/malloc.c, malloc/arena.c, and
elf/dl-reloc.c. It also makes all the code consistently
use pagesize, and powerof2 as required.

Code size is reduced with the removal of precomputed
pagemask, and use of pagesize instead. No measurable
difference in performance.

No regressions on x86_64.
2015-02-17 19:29:15 -05:00
Joseph Myers 1a2325c06c Fix posix_spawn getrlimit64 namespace (bug 17991).
posix_spawn (a standard POSIX function) brings in a use of getrlimit64
(not a standard POSIX function).  This patch fixes this by using
__getrlimit64 and making getrlimit64 a weak alias.

This is more complicated than some such changes because of files that
define getrlimit64 in their own way using symbol versioning after
including the main sysdeps/unix/sysv/linux/getrlimit64.c with a
getrlimit macro defined.  There are various existing patterns for such
cases in glibc; the one I've used here is that a getrlimit64 macro
disables the weak_alias / libc_hidden_weak calls, leaving it to the
including file to define the getrlimit64 name in whatever way is
appropriate.

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

	[BZ #17991]
	* include/sys/resource.h (__getrlimit64): Declare.  Use
	libc_hidden_proto.
	* resource/getrlimit64.c (getrlimit64): Rename to __getrlimit64
	and define as weak alias of __getrlimit64.  Use libc_hidden_weak.
	* sysdeps/posix/spawni.c (__spawni): Call __getrlimit64 instead of
	getrlimit64.
	* sysdeps/unix/sysv/linux/getrlimit64.c (getrlimit64): Rename to
	__getrlimit64.
	[!getrlimit64] (getrlimit64): Define as weak alias of
	__getrlimit64.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/i386/getrlimit64.c (getrlimit64): Define
	using __getrlimit64 not __new_getrlimit64.
	(__GI_getrlimit64): Likewise.
	* sysdeps/unix/sysv/linux/mips/getrlimit64.c (getrlimit64):
	Likewise.
	(__GI_getrlimit64): Likewise.
	(__old_getrlimit64): Use __getrlimit64 not __new_getrlimit64.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list
	(getrlimit): Add __getrlimit64 alias.
	* sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (getrlimit):
	Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/spawn.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/spawn.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/spawn.h/linknamespace): Likewise.
2015-02-18 00:26:35 +00:00
Paul Pluzhnikov 8ae4bb5a38 Cleanup: add missing #include's
* libio/fileops.c: Add missing sys/mman.h
	* libio/iopopen.c: Add missing fcntl.h, remove redundant unistd.h
2015-02-17 16:03:41 -08:00
Joseph Myers 18a218b74c Refine documentation of libm exceptions goals.
This patch refines the math.texi documentation of the goals for when
libm function raise the inexact and underflow exceptions.  The
previous text was problematic in some cases around the underflow
threshold.

* Strictly, it would have meant that if the mathematical result of pow
  was very slightly below DBL_MIN, for example, it was required to
  raise the underflow exception; although normally a few ulps error
  would be OK, if that error meant the computed value was slightly
  above DBL_MIN it would fail the previously described underflow
  exception goal.

* Similarly, strict IEEE semantics would imply that sin (DBL_MIN), in
  round-to-nearest mode, underflows on before-rounding but not
  after-rounding architectures, while returning DBL_MIN; the previous
  wording would have required an underflow exception, so preventing
  checks for a result with absolute value below DBL_MIN from being
  sufficient checks to determine whether the exception is required.
  (Under the previous wording, checks for a result with absolute value
  <= DBL_MIN wouldn't have been sufficient either, because in
  FE_TOWARDZERO mode a result of DBL_MIN definitely does not result
  from an underflowing infinite-precision result.)

* The previous wording about rounding infinite-precision values could
  be taken to mean all exceptions including "inexact" must be
  consistent with some such value.  That would mean that a result of
  DBL_MIN in FE_UPWARD mode with "inexact" raised must also have
  "underflow" raised on before-rounding architectures.  Again, that
  would cause problems for computing a result (possibly with spurious
  "inexact" exceptions) and then using a rounding-mode-independent
  test for results with absolute value below DBL_MIN to determine
  whether an underflow exception must be forced in case the underflows
  from intermediate computations happened to be exact.

By refining the documentation, this patch avoids stating goals for
accuracy close to the underflow threshold that were stricter than
applied anywhere else, and allows the implementation strategy of:
compute a result within a few ulps, taking care to avoid underflows in
intermediate computations, then force an underflow exception if that
result was subnormal.  Only fully-defined functions such as fma need
to take greater care about the exact underflow threshold (including
its dependence on whether the architecture is before-rounding or
after-rounding, and on the rounding mode on after-rounding
architectures).

(If the rounding mode is changed as part of the computation, it's
still necessary to ensure that not just intermediate computations, but
the final computation of the result to be returned, do not raise
underflow if that result is the least normal value and underflow would
be inconsistent with the original rounding mode.  Since such code can
readily discard exceptions as part of saving and restoring the
rounding mode - SET_RESTORE_ROUND_NOEX etc. - I don't think that
should be a problem in practice.)

	* manual/math.texi (Errors in Math Functions): Clarify goals
	regarding inexact and underflow exceptions.
2015-02-17 23:41:27 +00:00
Steve Ellcey e72ad0ef31 2015-02-17 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memcpy.S: Move R6 PREFETCH_STORE_HINT check.
	* sysdeps/mips/memset.S: Ditto.
2015-02-17 13:38:49 -08:00
Steve Ellcey 2caa4099de 2015-02-17 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/bits/endian.h (__MIPSEL): Use #ifdef instead of #if.
2015-02-17 10:04:33 -08:00
Stefan Liebler f20bfc9b5e S390: Build failure due to nptl/pt-longjmp.c changes. 2015-02-17 08:47:49 +01:00
Torvald Riegel 71c06b69d3 ia64: Remove custom lowlevellock.h
ia64 seems to use the same implementation of low-level locks as the
generic Linux lowlevellock.h.  The futex syscalls are somewhat
different, but Roland thought it shouldn't matter.  Note that the futex
calls are on the slow path always (except for PI mutexes).

Removing the custom low-level lock implementation will make further
refactoring easier, for example adding proper error checking to futex
operations.
2015-02-17 02:45:12 -05:00
Mike Frysinger a9a05adb24 ia64: drop custom getpagesize
This is equivalent to the common linux version now, so we can drop it.
2015-02-17 02:37:20 -05:00
Joseph Myers ce8fc784e6 Fix sign of remquo zero remainder in round-downward mode (bug 17987).
Various remquo implementations produce a zero remainder with the wrong
sign (a zero remainder should always have the sign of the first
argument, as specified in IEEE 754) in round-downward mode, resulting
from the sign of 0 - 0.  This patch checks for zero results and fixes
their sign accordingly.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #17987]
	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Ensure sign of
	zero result does not depend on the sign resulting from
	subtraction.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Likewise.
	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
	* math/libm-test.inc (remquo_test_data): Add more tests.
2015-02-17 00:41:50 +00:00
Paul Eggert 0d7036bdb1 * manual/time.texi (TZ Variable): glibc no longer comes with tzdata.
Problem reported by J William Piggott.
2015-02-16 15:32:34 -08:00
Joseph Myers a820f9b3c0 Fix remquo spurious overflows (bug 17978).
Various remquo implementations, when computing the last three bits of
the quotient, have spurious overflows when 4 times the second argument
to remquo overflows.  These overflows can in turn cause bad results in
rounding modes where that overflow results in a finite value.  This
patch adds tests to avoid the problem multiplications in cases where
they would overflow, similar to those that control an earlier
multiplication by 8.

Tested for x86_64, x86, mips64 and powerpc.

	[BZ #17978]
	* sysdeps/ieee754/dbl-64/s_remquo.c (__remquo): Do not form
	products 4 * y and 2 * y where those would overflow.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Likewise.
	* sysdeps/ieee754/flt-32/s_remquof.c (__remquof): Likewise.
	* sysdeps/ieee754/ldbl-128/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_remquol.c (__remquol): Likewise.
	* sysdeps/ieee754/ldbl-96/s_remquol.c (__remquol): Likewise.
	* math/libm-test.inc (remquo_test_data): Add more tests.
2015-02-16 22:38:28 +00:00
Joseph Myers be802953a1 Fix MIPS _ABIO64 -Werror=undef build.
I see an error

../sysdeps/mips/memcpy.S:209:68: error: "_ABIO64" is not defined [-Werror=undef]
 #if defined(_MIPS_SIM) && ((_MIPS_SIM == _ABIO32) || (_MIPS_SIM == _ABIO64))
                                                                    ^
cc1: some warnings being treated as errors

in MIPS builds.  This patch arranges for _ABIO64 to be defined with
the same value as GCC uses when building for O64 (the ABI itself isn't
supported by glibc, but defining the macro seems the simplest way of
avoiding the error in code that may be shared with other C libraries).

	* sysdeps/mips/sgidefs.h [!_ABIO64] (_ABIO64): New macro.
2015-02-16 22:25:02 +00:00
Joseph Myers e5e72fe9cd Fix MIPS _COMPILING_NEWLIB -Werror=undef build.
I see an error

../sysdeps/mips/strcmp.S:25:7: error: "_COMPILING_NEWLIB" is not defined [-Werror=undef]
 #elif _COMPILING_NEWLIB
       ^
cc1: some warnings being treated as errors

in MIPS builds.  (This is with GCC 4.9; it's possible that the DR#412
change in GCC 5 - see
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60570> - means that
-Wundef diagnostics no longer occur for #elif conditions where a
previous group's condition was true, just as with other errors there.)
This patch duly adjusts the conditionals to test whether
_COMPILING_NEWLIB is defined.

	* sysdeps/mips/memcpy.S [_COMPILING_NEWLIB]: Change condition to
	[defined _COMPILING_NEWLIB].
	* sysdeps/mips/memset.S [_COMPILING_NEWLIB]: Likewise.
	* sysdeps/mips/strcmp.S [_COMPILING_NEWLIB]: Likewise.
2015-02-16 22:18:53 +00:00
Joseph Myers 86c56b164c Fix MIPS __mips_isa_rev -Werror=undef build.
I see an error

In file included from ../sysdeps/mips/include/sys/asm.h:20:0,
                 from ../sysdeps/mips/start.S:39:
../sysdeps/mips/sys/asm.h:421:5: error: "__mips_isa_rev" is not defined [-Werror=undef]
 #if __mips_isa_rev < 6
     ^
cc1: some warnings being treated as errors

in MIPS builds.  As sys/asm.h is an installed header, it seems better
to test for !defined __mips_isa_rev here, instead of defining it to 0
as done in sysdeps/unix/mips/sysdep.h, to avoid perturbing any code
outside glibc that tests whether __mips_isa_rev is defined; this patch
does so.

	* sysdeps/mips/sys/asm.h [__mips_isa_rev < 6]: Change condition to
	[!defined __mips_isa_rev || __mips_isa_rev < 6].
2015-02-16 22:12:15 +00:00
Torvald Riegel 35264d1442 Make error checking effective in nptl/tst-cond25.c. 2015-02-16 18:11:14 +01:00
Matthew Fortune 6f49e32aa5 ia64: remove fixed page size macros and others [BZ #17792]
Remove IA64 PAGE_SIZE related macros as PAGE_SIZE is not defined.
Also remove macros that are only used for BFD's trad-core support
which is not relavant for IA64 according to the thread starting
here:

https://sourceware.org/ml/libc-ports/2013-11/msg00028.html

This patch is neither built nor tested but is equivalent to a MIPS
patch for the same fix.
2015-02-15 00:59:00 -05:00
Steve Ellcey e525154e84 2015-02-13 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/bits/endian.h (__MIPSEB): Use #ifdef instead of #if.
	* sysdeps/mips/memcpy.S (__MIPSEB): Ditto.
	* sysdeps/mips/memset.S (__MIPSEB): Ditto.
2015-02-13 17:38:06 -08:00
Roland McGrath 4ab770b7b1 Add placeholder c++-types.data and *.abilist files. 2015-02-13 15:41:34 -08:00
Joseph Myers d9afe48d55 Fix dbl-64/wordsize-64 remquo (bug 17569).
The dbl-64/wordsize-64 remquo implementation follows similar logic to
various other implementations, but where that logic computes some
absolute values, it wrongly uses a previously computed bit-pattern for
the absolute value of the first argument, where actually it needs the
absolute value of the first argument mod 8 times the second.  This
patch fixes it to compute the correct absolute value.

The integer quotient result of remquo is only specified mod 8
(including its sign); architecture-specific versions may well vary in
what results they give for higher bits of that result (and indeed bug
17569 gives an example correct result from __builtin_remquo giving 9
for that result, where the particular glibc implementation used in
that bug report would give 1 after this fix).  Thus, this patch adapts
the tests of remquo to test that result only mod 8, to allow for such
variation when tests with higher quotient are included.

Tested for x86_64 and x86.

	[BZ #17569]
	* sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c (__remquo):
	Compute absolute value of x as modified by fmod, not original
	value of x.
	* math/libm-test.inc (RUN_TEST_ffI_f1): Rename to
	RUN_TEST_ffI_f1_mod8.  Check extra return value mod 8.
	(RUN_TEST_LOOP_ffI_f1): Rename to RUN_TEST_LOOP_ffI_f1_mod8.  Call
	RUN_TEST_ffI_f1_mod8.
	(remquo_test_data): Add more tests.
2015-02-13 21:54:44 +00:00
Roland McGrath 3846188b21 NPTL: Initializer for .init_array-only configurations. 2015-02-13 13:19:11 -08:00
Joseph Myers 95c26233a1 Fix powerpc software sqrtf (bug 17967).
Similarly to sqrt in
<https://sourceware.org/ml/libc-alpha/2015-02/msg00353.html>, the
powerpc sqrtf implementation for when _ARCH_PPCSQ is not defined also
relies on a * b + c being contracted into a fused multiply-add.
Although this contraction is not explicitly disabled for e_sqrtf.c, it
still seems appropriate to make the file explicit about its
requirements by using __builtin_fmaf; this patch does so.
Furthermore, it turns out that doing so fixes the observed inaccuracy
and missing exceptions (that is, that without explicit __builtin_fmaf
usage, it was not being compiled as intended).

Tested for powerpc32 (hard float).

	[BZ #17967]
	* sysdeps/powerpc/fpu/e_sqrtf.c (__slow_ieee754_sqrtf): Use
	__builtin_fmaf instead of relying on contraction of a * b + c.
2015-02-13 16:20:36 +00:00
J William Piggott 3f293d614c [BZ #17969]
* manual/time.texi (TZ Variable): The zoneinfo path is
/usr/share/zoneinfo.
2015-02-12 22:21:13 -05:00
Joseph Myers e8bd5286c6 Fix powerpc software sqrt (bug 17964).
As Adhemerval noted in
<https://sourceware.org/ml/libc-alpha/2015-01/msg00451.html>, the
powerpc sqrt implementation for when _ARCH_PPCSQ is not defined is
inaccurate in some cases.

The problem is that this code relies on fused multiply-add, and relies
on the compiler contracting a * b + c to get a fused operation.  But
sysdeps/ieee754/dbl-64/Makefile disables contraction for e_sqrt.c,
because the implementation in that directory relies on *not* having
contracted operations.

While it would be possible to arrange makefiles so that an earlier
sysdeps directory can disable the setting in
sysdeps/ieee754/dbl-64/Makefile, it seems a lot cleaner to make the
dependence on fused operations explicit in the .c file.  GCC 4.6
introduced support for __builtin_fma on powerpc and other
architectures with such instructions, so we can rely on that; this
patch duly makes the code use __builtin_fma for all such fused
operations.

Tested for powerpc32 (hard float).

2015-02-12  Joseph Myers  <joseph@codesourcery.com>

	[BZ #17964]
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Use
	__builtin_fma instead of relying on contraction of a * b + c.
2015-02-12 23:05:37 +00:00
Roland McGrath 96a157490c Use -Werror=undef for assembly code. 2015-02-12 13:57:32 -08:00
Roland McGrath 04f5a636b6 Support after-link variable to run a final step on binaries. 2015-02-12 13:38:47 -08:00
Rüdiger Sonderfeld 87a629c5d7 Document tv_sec is of type time_t:
The tv_sec is of type time_t in both struct timeval and struct timespec.
This matches the implementation and also the relevant standard (checked
C11 for timespec and opengroup for timeval).
2015-02-12 15:08:58 -05:00
Joseph Myers 03d95bd483 Fix exp2 spurious underflows (bug 16560).
This patch fixes the remaining part of bug 16560, spurious underflows
from exp2 of arguments close to 0 (when the result is close to 1, so
should not underflow), by just using 1+x instead of a more complicated
calculation when the argument is sufficiently small.

Tested for x86_64, x86 and mips64.

	[BZ #16560]
	* math/e_exp2l.c [LDBL_MANT_DIG == 106] (LDBL_EPSILON): Undefine
	and redefine.
	(__ieee754_exp2l): Do not multiply small fractional parts by
	M_LN2l.
	* sysdeps/i386/fpu/e_exp2l.S (__ieee754_exp2l): Just add 1 to
	small argument.
	* sysdeps/ieee754/dbl-64/e_exp2.c (__ieee754_exp2): Likewise.
	* sysdeps/ieee754/flt-32/e_exp2f.c (__ieee754_exp2f): Likewise.
	* sysdeps/x86_64/fpu/e_exp2l.S (__ieee754_exp2l): Likewise.
	* math/auto-libm-test-in: Add more tests of exp2.
	* math/auto-libm-test-out: Regenerated.
2015-02-12 19:02:45 +00:00
Rajalakshmi Srinivasaraghavan 98408b95b1 powerpc: POWER7 strncpy optimization for unaligned string
This patch optimizes strncpy for power7 for unaligned source or
destination address. The source or destination address is aligned
to doubleword and data is shifted based on the alignment and
added with the previous loaded data to be written as a doubleword.
For each load, cmpb instruction is used for faster null check.

The new optimization shows 10 to 70% of performance improvement
for longer string though it does not show big difference on string
size less than 16 due to additional checks.Hence this new algorithm
is restricted to string greater than 16.
2015-02-12 13:16:08 -05:00
Adhemerval Zanella 6f74150338 powerpc: Fix TABORT encoding for little endian
This patch fix the TABORT encoding for toolchains with no support for
HTM builtins.
2015-02-12 05:34:16 -06:00
Andreas Schwab 2868e0703d Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
pthread_mutexattr_settype adds PTHREAD_MUTEX_NO_ELISION_NP to kind,
which is an internal flag that pthread_mutexattr_gettype shouldn't
expose, since pthread_mutexattr_settype wouldn't accept it.
2015-02-12 09:26:00 +01:00
Samuel Thibault ebf27d12e6 Revert "hurd: Fix abi-tag, following ba90e05"
and revert the corresponding part of ba90e05 which was making the fix
	necessary.

	* abi-tags: Revert ae20c9a: rename back gnu into gnu-gnu.
	* configure.ac, configure: Revert ba90e05: modify gnu-* host_os back
	into gnu-gnu, and update comment to refer to abi-tags.
2015-02-11 23:51:51 +00:00
Joseph Myers d435569cd6 Fix sincos errno setting (bug 15467).
This patch makes sincos set errno to EDOM when passed an infinity,
similarly to sin and cos.

Tested for x86_64, x86, powerpc and mips64.  I don't know if the
architecture-specific implementations for ia64 and m68k might need
corresponding fixes.

2015-02-11  Joseph Myers  <joseph@codesourcery.com>

	[BZ #15467]
	* sysdeps/ieee754/dbl-64/s_sincos.c: Include <errno.h>.
	(__sincos): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/flt-32/s_sincosf.c: Include <errno.h>.
	(SINCOSF_FUNC): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-128/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-128ibm/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* sysdeps/ieee754/ldbl-96/s_sincosl.c: Include <errno.h>.
	(__sincosl): Set errno to EDOM for infinite argument.
	* math/libm-test.inc (sincos_test_data): Test errno setting.
2015-02-11 23:17:25 +00:00
Leonhard Holz d35273f274 Remove unused definitions 2015-02-11 12:50:53 +01:00
Joseph Myers 306bc0d1ed Remove sysdeps/mips soft-fp subdirectories.
As noted in
<https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>, soft-fp
sysdeps subdirectories (and more generally, subdirectories where
sysdeps/foo/Implies contains foo/bar) are unnecessary and should be
eliminated.  This patch does so for MIPS.

Tested for MIPS64 (all three ABIs, soft-float) that installed stripped
shared libraries are unchanged by this patch.

	* sysdeps/mips/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/mips/mips32/sfp-machine.h: ... here.
	* sysdeps/mips/mips64/soft-fp/Makefile: Move to ....
	* sysdeps/mips/mips64/Makefile: ... here.
	* sysdeps/mips/mips64/soft-fp/e_sqrtl.c: Move to ....
	* sysdeps/mips/mips64/e_sqrtl.c: ... here.
	* sysdeps/mips/mips64/soft-fp/sfp-machine.h: Move to ....
	* sysdeps/mips/mips64/sfp-machine.h: ... here.
	* sysdeps/mips/mips32/Implies: Remove mips/soft-fp.
	* sysdeps/mips/mips64/n32/Implies: Remove mips/mips64/soft-fp.
	* sysdeps/mips/mips64/n64/Implies: Likewise.
2015-02-10 22:01:39 +00:00
Roland McGrath 92b67e8def Clean up math/test-snan. 2015-02-10 13:55:29 -08:00
Evangelos Foutras 132a1328ec Fix __memcpy_chk on non-SSE2 CPUs
In commit 8b4416d, the 1: jump label in __mempcpy_chk was accidentally
moved.  This resulted in failures of mempcpy on CPU without SSE2.
2015-02-10 21:39:06 +10:00
Adhemerval Zanella bc0cdc4981 powerpc: drop R_PPC_REL16 check
Current minimum support binutils (2.22) supports R_PPC_REL16 as default,
so no need to extra configure checks.
2015-02-10 06:09:22 -05:00
Adhemerval Zanella 83658961f0 powerpc: sysdeps/powerpc configure cleanup
Current minimum binutils supported (2.22) has ".machine altivec" support
as default, so there is no need to add a configure check for such
functionality.  This patches removes the configure checks for it.
2015-02-10 06:08:24 -05:00
Adhemerval Zanella 10169938b1 powerpc: wordcopy/memmove cleanup for ppc32
This patch cleanup some multiarch code related to memmmove
optimization. Initial IFUNC support added specialized wordcopy
symbols which turned in local IFUNC calls used by memmove default
implementation.  The patch removes the internal IFUNC for wordcopy
symbols and uses local branches in the memmmove optimization instead.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 8548a53d69 powerpc: multiarch Makefile cleanup for powerpc32
This patch cleanups the multiarch Makefile by putting the wide chars
implementation to correct wcsmbs rule.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella b269211467 powerpc: wordcopy/memmove cleanup for ppc64
This patch cleanup some multiarch code related to memmmove
optimization. Initial IFUNC support added specialized wordcopy
symbols which turned in local IFUNC calls used by memmove default
implementation.

This change by removing then and used the optimized memmove instead
for supported chips.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 18e270aada powerpc: Remove POWER7 wordcopy ifunc
This patch remove the POWER7 ifunc wordcopy function
(_wordcopy_*_power7), since now GLIBC provides a optimized memmove/bcopy
for POWER7.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 6f0993a638 powerpc: Simplify bcopy default implementation
This patch simplify the default bcopy symbol for powerpc64 by just using
memmove instead of implementing using the default bcopy.  Since the
symbol is deprecated, it trades speed by code size.
2015-02-09 06:42:28 -05:00
Adhemerval Zanella 3001e54c57 powerpc: multiarch Makefile cleanup for powerpc64
This patch cleanups the multiarch Makefile by putting the wide chars
implementation to correct wcsmbs rule.
2015-02-09 06:42:27 -05:00
Andreas Schwab 59b61c82fe Fix value of O_TMPFILE for architectures with non-default O_DIRECTORY (bug 17912) 2015-02-09 10:41:48 +01:00
Samuel Thibault 28b067571e hurd: fix unwind-resume.c build 2015-02-08 18:46:00 +01:00
Samuel Thibault ff78268891 hurd: fix unwind-resume.c build 2015-02-08 18:35:54 +01:00
Samuel Thibault ebd7aede60 Fix time/getdate.c build. 2015-02-08 17:45:25 +01:00
Samuel Thibault ae20c9a17c hurd: Fix abi-tag, following ba90e05 2015-02-08 05:38:03 +01:00
Samuel Thibault 4fc81a777a hurd: fix tls.h build 2015-02-08 05:06:17 +01:00
Samuel Thibault a5eb23deb6 hurd: Ignore bytes beyond sockaddr length for AF_UNIX 2015-02-08 04:26:54 +01:00
Paul Eggert 3999d26ead Add ersatz _Static_assert on older C hosts
* misc/sys/cdefs.h (_Static_assert): Define a substitute, if on a
pre-C11 C platform that is not known to support _Static_assert.
2015-02-07 14:43:27 -08:00
Samuel Thibault f96ec27aa9 hurd: fix compilation of signal.h in C++ 2015-02-07 22:41:23 +01:00
Samuel Thibault 22395607bc hurd: fix compilation of signal.h in C++ 2015-02-07 22:35:35 +01:00
Samuel Thibault f05826f07f hurd: add basic types for ioctls 2015-02-07 22:26:09 +01:00
Samuel Thibault e86c5b6459 hurd: support mmap with PROT_NONE 2015-02-07 22:22:40 +01:00
Samuel Thibault c187253fc2 hurdselect: remove dead code.
This removes code which actually never happens, and is already taken
care of in the function.

This is in the second part of select, when the __mach_msg() function
over the portset has returned something else than MACH_MSG_SUCCESS. I
guess in the past the value returned by __mach_msg() was stored in err,
so this code was necessary to set back err to 0, but now it is stored in
msgerr, so err is already still 0 by default. It can thus never contain
MACH_RCV_TIMED_OUT, i.e. the code is dead. The first case mentioned in
the comment is already handled: on time out with no message, err is
already still the default 0. On time out due to poll, err would still be
0, unless some of the io_select RPCs has returned EINTR, in which case
it contains EINTR. If any other io_select RPCs had returned a proper
answer, got!=0, and thus err is set to 0 just below. The code is thus
indeed not useful any more.
2015-02-07 22:18:03 +01:00
Samuel Thibault e9a5bc1c18 hurd: fix sigstate locking
It looks like _hurd_thread_sigstate used to return with the sigstate
lock held long ago, but since that's no longer the case, don't unlock
something that isn't locked.

Note that it's unlikely this change fixes anything in practice since
its current implementation (on i386) makes this call a nop.
2015-02-07 22:16:19 +01:00
Samuel Thibault a9a002fb6c hurdselect: Let select get interrupted by signals
We need to set MACH_RCV_INTERRUPT to avoid __mach_msg just looping on signals,
and then we can handle the interruption.
2015-02-07 22:13:46 +01:00
Samuel Thibault bd959902bc hurd: map nice levels 1-to-1 with Mach prio levels 2015-02-07 22:09:09 +01:00
Samuel Thibault d5131d3c1e hurd: allow poll() array bigger than FD_SETSIZE 2015-02-07 22:07:38 +01:00
Samuel Thibault 5d2556c4fa hurd: fix f?chflags prototypes, declare them and their flags 2015-02-07 21:56:15 +01:00
Samuel Thibault e2049d17a0 hurd: fix build with pthread aio 2015-02-07 21:48:32 +01:00
Roland McGrath f8d1bb4c25 ARM: Add missing sfi_breg in LDR_GLOBAL macro. 2015-02-06 14:42:18 -08:00
Roland McGrath 022f481264 NPTL: Conditionalize some sanity tests for SIGCANCEL/SIGSETXID. 2015-02-06 12:31:11 -08:00
Roland McGrath 1ac074e66e Conditionalize use of SIGRTMIN in nptl/tst-locale1.c. 2015-02-06 12:30:58 -08:00
Roland McGrath f50ad78b91 Don't set unused field in rt/tst-timer2. 2015-02-06 12:30:38 -08:00
Roland McGrath 9e7265f4e5 NPTL: Build tests using clone directly only for Linux. 2015-02-06 12:30:23 -08:00
Roland McGrath 62ad2abcd6 Use signal rather than sigaction in nptl/tst-cleanup2. 2015-02-06 12:30:05 -08:00
Roland McGrath cfa69b0bb2 Conditionalize some tests' use of SA_SIGINFO. 2015-02-06 12:29:50 -08:00
Roland McGrath 8272780608 Do not use SA_NOCLDWAIT in tst-pselect. 2015-02-06 12:29:39 -08:00
Roland McGrath da3a1594af Move tst-getlogin to login/ subdirectory. 2015-02-06 12:29:27 -08:00
Roland McGrath b65c0ff9fc Fix libio/tst-atime not to presume ST_NOATIME exists. 2015-02-06 12:24:16 -08:00
Roland McGrath 56606ab3b8 Fix dirent/tst-fdopendir not to presume O_NOATIME exists. 2015-02-06 12:23:35 -08:00
Roland McGrath ebf7d6eedb Fix nptl/tst-kill5 not to presume SIGRTMAX exists. 2015-02-06 12:22:23 -08:00
Roland McGrath ca0e0675a7 Clean up nptl/tst-join5 use of nanosleep. 2015-02-06 12:21:38 -08:00
Roland McGrath 8c28bbc6d9 Clean up NPTL system to be compat-only. 2015-02-06 10:53:38 -08:00
Roland McGrath ec2a88b3c6 Clean up NPTL longjmp to be compat-only. 2015-02-06 10:53:27 -08:00
Roland McGrath beff1d132c Clean up NPTL fork to be compat-only. 2015-02-06 10:53:07 -08:00
Roland McGrath ea02c6b812 x86: Clean up __vdso_clock_gettime variable. 2015-02-06 10:44:11 -08:00
Roland McGrath a1309c2bd0 Exclude rpcent functions and NSS backends for rpc, key when excluding sunrpc. 2015-02-06 10:43:19 -08:00
Roland McGrath ac9e0e5e40 Clean up sysdep-dl-routines variable. 2015-02-06 10:42:08 -08:00
Joseph Myers 1c7a4a51a3 soft-fp: Fix _FP_FMA when product is zero and third argument is finite (bug 17932).
soft-fp's _FP_FMA fails to set the result's exponent for cases where
the result of the multiplication is 0, yielding incorrect (arbitrary,
depending on uninitialized values) results for those cases.  This
affects libm for architectures using soft-fp to implement fma.  This
patch adds the exponent setting and tests for this case.

Tested for ARM soft-float (which uses soft-fp fma), x86_64 and x86 (to
verify not introducing new libm test failures there).

(This bug showed up in testing my patch to move the Linux kernel to
current soft-fp.  math/Makefile has "override CFLAGS +=
-Wno-uninitialized" which would have stopped compiler warnings from
showing up this problem, although I wouldn't be surprised if removing
that shows spurious warnings from this code, if the compiler fails to
follow that various cases where the exponent is uninitialized don't
need it initialized because the class is set to a value meaning the
uninitialized exponent isn't used.)

	[BZ #17932]
	* soft-fp/op-common.h (_FP_FMA): Set exponent of result in case
	where multiplication results in zero and third argument is finite
	and nonzero.
	* math/auto-libm-test-in: Add more tests of fma.
	* math/auto-libm-test-out: Regenerated.
2015-02-06 15:44:07 +00:00
Joseph Myers 61f006c12d soft-fp: Refine FP_EX_DENORM handling for comparisons.
In <https://sourceware.org/ml/libc-alpha/2014-09/msg00488.html>, I
noted that comparisons in soft-fp did not set FP_EX_DENORM unless
denormal operands were flushed to zero.

This patch fixes soft-fp to check for denormal operands for
comparisons and set that exception whenever FP_EX_DENORM is not zero.
In particular, for the one architecture for which the Linux kernel
defines FP_EX_DENORM (alpha), this corresponds to the existing logic
for comparisons and so allows that logic to be replaced by a simple
call to FP_CMP_D when soft-fp is updated in the kernel.

Tested for powerpc (e500) that installed stripped shared libraries are
unchanged by this patch.

	* soft-fp/op-common.h (_FP_CMP_CHECK_DENORM): New macro.
	(_FP_CMP_CHECK_FLUSH_ZERO): Likewise.
	(_FP_CMP): Use_FP_CMP_CHECK_DENORM and _FP_CMP_CHECK_FLUSH_ZERO.
	(_FP_CMP_EQ): Likewise.
	(_FP_CMP_UNORD): Use _FP_CMP_CHECK_DENORM.
2015-02-06 15:41:49 +00:00
Joseph Myers 639e42eb90 soft-fp: Support floating-point extensions without quieting sNaNs.
One special case needed in soft-fp to replace the old version in the
Linux kernel is extending from a narrower floating-point format to a
wider one without quieting signaling NaNs.  (This is for
arch/powerpc/math-emu/lfs.c, where previously it used the old FP_CONV
which didn't do anything special for NaNs, then handled packing
specially for NaNs to avoid quieting at packing time, and discarded
the exceptions from unpacking.)

This patch accordingly refactors FP_EXTEND, creating a separate
_FP_EXTEND_CNAN that offers a choice of how NaNs are handled, with
FP_EXTEND reimplemented as a wrapper that provides the common case of
the IEEE operation that does quiet signaling NaNs and raise exceptions
for them.

Tested for powerpc (e500) that installed stripped shared libraries are
unchanged by this patch.

	* soft-fp/op-common.h (FP_EXTEND): Rename to _FP_EXTEND_CNAN with
	extra argument CHECK_NAN.  Redefine as wrapper around
	_FP_EXTEND_CNAN.
2015-02-06 15:39:17 +00:00
Carlos O'Donell 76c109f292 Fix missing ChangeLog attribution. 2015-02-06 02:04:37 -05:00
Carlos O'Donell 4e42b5b8f8 Update version.h and include/features.h for 2.21 release 2015-02-06 01:40:18 -05:00
Carlos O'Donell 3c0c543b87 hppa: Sync with pthread.h.
This reverts part of the previous commit to refactor pthread.h.
The refactoring must be done by having pthread.h include arch
bits headers, not the other way around. Then hppa provides the
arch bits header. For now we synchronzie again with pthread.h
and include the entire contents in the hppa copy.
2015-02-06 01:59:32 -05:00
Paul Pluzhnikov 5bd80bfe9c CVE-2015-1472: wscanf allocates too little memory
BZ #16618

Under certain conditions wscanf can allocate too little memory for the
to-be-scanned arguments and overflow the allocated buffer.  The
implementation now correctly computes the required buffer size when
using malloc.

A regression test was added to tst-sscanf.
2015-02-06 00:34:51 -05:00
Carlos O'Donell 04cb913ddf glibc 2.21 pre-release update.
Update all translations.

Update contributions in the manual.

Update installation notes with information about newest working tools.

Reconfigure using exactly autoconf 2.69.

Regenerate INSTALL.
2015-02-05 23:14:38 -05:00
Carlos O'Donell 3f823f488a hppa: Remove warnings and fix conformance errors.
(1) Fix warnings.

This is a bulk update to fix all the warnings that were causing
build failures with -Werror on hppa.

The most egregious problems are in dl-fptr.c which needs to be
entirely rewritten, thus I've used -Wno-error for that.

(2) Fix conformance errors.

The sysdep.c file had __syscall_error and syscall in one file
which caused conformance issues by including syscall when
__syscall_error was linked to. The fix is obviously to split
the file and use syscall.c to implement syscall.
2015-02-05 21:37:47 -05:00