Commit Graph

17736 Commits

Author SHA1 Message Date
Adhemerval Zanella 96d6fd6c40 powerpc: Optimized st{r,p}cpy for POWER8/PPC64
This patch adds an optimized POWER8 strcpy using unaligned accesses.
For strings up to 16 bytes the implementation first calculate the
string size, like strlen, and issues a memcpy.  For larger strings,
source is first aligned to 16 bytes and then tested over a loop that
reads 16 bytes am combine the cmpb results for speedup.  Special case is
added for page cross reads.

It shows 30%-60% improvement over the optimized POWER7 one that uses
only aligned accesses.
2015-01-13 11:28:30 -05:00
Leonhard Holz 0f9e585480 Fix memory handling in strxfrm_l [BZ #16009]
[Modified from the original email by Siddhesh Poyarekar]

This patch solves bug #16009 by implementing an additional path in
strxfrm that does not depend on caching the weight and rule indices.

In detail the following changed:

* The old main loop was factored out of strxfrm_l into the function
do_xfrm_cached to be able to alternativly use the non-caching version
do_xfrm.

* strxfrm_l allocates a a fixed size array on the stack. If this is not
sufficiant to store the weight and rule indices, the non-caching path is
taken. As the cache size is not dependent on the input there can be no
problems with integer overflows or stack allocations greater than
__MAX_ALLOCA_CUTOFF. Note that malloc-ing is not possible because the
definition of strxfrm does not allow an oom errorhandling.

* The uncached path determines the weight and rule index for every char
and for every pass again.

* Passing all the locale data array by array resulted in very long
parameter lists, so I introduced a structure that holds them.

* Checking for zero src string has been moved a bit upwards, it is
before the locale data initialization now.

* To verify that the non-caching path works correct I added a test run
to localedata/sort-test.sh & localedata/xfrm-test.c where all strings
are patched up with spaces so that they are too large for the caching path.
2015-01-13 11:33:56 +05:30
Torvald Riegel c60ec0e016 Fix wake-up in sysdeps/nptl/fork.c. 2015-01-13 01:09:29 +01:00
Joseph Myers 5a9e4c09a2 Fix ldbl-96 scalblnl underflowing results (bug 17803).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) uses
a condition k <= -63 to determine when a standard underflowing result
tiny*__copysignl(tiny,x) should be returned.  However, that condition
corresponds to values with exponent -16446 or less, and in the case of
-16446, the correct result for round-to-nearest depends on whether the
value is exactly 0x1p-16446 (half the least subnormal) or more than
that.  This patch fixes the bug by changing the condition to k <= -64
and accordingly adjusting the exponent by 64 not 63 when converting to
a normal value.

Tested for x86_64.

	[BZ #17803]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (twom63): Rename to
	twom64.  Adjust value to 0x1p-64L.
	(__scalblnl): Only return standard underflowing result for K <=
	-64 not K <= -63; adjust exponent for underflowing result by 64
	not 63.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 23:02:14 +00:00
Joseph Myers 34e93d6c76 Fix ldbl-96 scalblnl for subnormal arguments (bug 17834).
The ldbl-96 implementation of scalblnl (used for x86_64 and ia64) is
incorrect for subnormal arguments (this is a separate bug from bug
17803, which is about underflowing results).  There are two problems
with the adjustments of subnormal arguments: the "two63" variable
multiplied by is actually 0x1p52L not 0x1p63L, so is insufficient to
make values normal, and then GET_LDOUBLE_EXP(es,x), used to extract
the new exponent, extracts it into a variable that isn't used, while
the value taken to by the new exponent is wrongly taken from the high
part of the mantissa before the adjustment (hx).  This patch fixes
both those problems and adds appropriate tests.

Tested for x86_64.

	[BZ #17834]
	* sysdeps/ieee754/ldbl-96/s_scalblnl.c (two63): Change value to
	0x1p63L.
	(__scalblnl): Get new exponent of adjusted subnormal value from ES
	not HX.
	* math/libm-test.inc (scalbn_test_data): Add more tests.
	(scalbln_test_data): Likewise.
2015-01-12 22:34:58 +00:00
Adhemerval Zanella ca677d3c3c Add x86 32 bit vDSO time function support
Linux 3.15 adds support for clock_gettime, gettimeofday, and time vDSO
(commit id 37c975545ec63320789962bf307f000f08fabd48).  This patch adds
GLIBC supports to use such symbol when they are avaiable.

Along with x86 vDSO support, this patch cleanup x86_64 code by moving
all common code to x86 common folder.  Only init-first.c is different
between implementations.
2015-01-12 16:03:58 -02:00
Adhemerval Zanella 49a9f6ab64 powerpc: Fix Copyright dates and CL entry
This patch fixes the copyright dates from files created by commit
8d2c0a5, 4b45943, and 56cf276.
2015-01-12 12:58:34 -05:00
Adhemerval Zanella 56cf276381 powerpc: abort transaction in syscalls
Linux kernel powerpc documentation states issuing a syscall inside a
transaction is not recommended and may lead to undefined behavior. It
also states syscalls does not abort transactoin neither they run in
transactional state.

To avoid side-effects being visible outside transactions, GLIBC with
lock elision enabled will issue a transaction abort instruction just
before all syscalls if hardware supports hardware transactions.
2015-01-12 06:32:08 -05:00
Adhemerval Zanella 4b45943a6f powerpc: Add adaptive elision to rwlocks
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory for rwlocks.  The logic is similar to the
one presented in pthread_mutex lock elision.
2015-01-12 06:30:54 -05:00
Adhemerval Zanella 8d2c0a593b powerpc: Add the lock elision using HTM
This patch adds support for lock elision using ISA 2.07 hardware
transactional memory instructions for pthread_mutex primitives.
Similar to s390 version, the for elision logic defined in
'force-elision.h' is only enabled if ENABLE_LOCK_ELISION is defined.

Also, the lock elision code should be able to be built even with
a compiler that does not provide HTM support with builtins.
However I have noted the performance is sub-optimal due scheduling
pressures.
2015-01-12 06:30:19 -05:00
Roland McGrath bc0ed9f755 Fix shm-directory.h #include. 2015-01-09 16:08:14 -08:00
Chung-Lin Tang 585d9c182d Remove divide from _ELF_DYNAMIC_DO_RELOC in elf/dynamic-link.h. 2015-01-09 09:40:29 -08:00
Matthew Fortune aee6626c30 MicroBlaze: Fix BZ17791 - Remove fixed page size macros and others
Microblaze apparently has a variable page size (see thread below) and
should not hard-code any page-size related macros.
Also remove macros that are only used for BFD's trad-core support
which is not relavant for microblaze also according to the thread
starting here:

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

This patch is neither built nor tested but mirrors a MIPS patch that
fixes the same issue.

Thanks,
Matthew

     * sysdepsysdeps/unix/sysv/linux/microblaze/sys/user.h
     (PAGE_SHIFT, PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Remove.
     (HOST_TEXT_START_ADDR, HOST_STACK_END_ADDR): Remove.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 17:34:46 +10:00
Torvald Riegel 9e560f4838 MicroBlaze: Remove custom lowlevellock.h.
2015-01-06  Torvald Riegel <triegel@redhat.com>

  * sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Delete file.

Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:58:49 +10:00
Torvald Riegel e1cfbd0c37 MicroBlaze: Remove custom pthread_once implementation on microblaze.
2015-01-06  Torvald Riegel <triegel@redhat.com>

  * sysdeps/unix/sysv/linux/microblaze/pthread_once.c: Delete file.

Signed-off-by: Torvald Riegel <triegel@redhat.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:56:33 +10:00
David Holsgrove cf71e44f1b MicroBlaze: Avoid pointer to integer conversion warning
2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

  * sysdeps/microblaze/jmpbuf-unwind.h (_jmpbuf_sp): Declare SP as void
    pointer and cast to uintptr_t.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:49:27 +10:00
David Holsgrove b360ee62d2 MicroBlaze: Fix volatile-register-var warning in READ_THREAD_POINTER
Resolves warning: 'optimization may eliminate reads and/or writes to
register variables'

2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

  * sysdeps/microblaze/nptl/tls.h: Remove inline
    __microblaze_get_thread_area and update READ_THREAD_POINTER.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:49:22 +10:00
David Holsgrove caff764e8c MicroBlaze: Fix integer-pointer conversion warning
2015-01-06  David Holsgrove <david.holsgrove@xilinx.com>

    * sysdeps/microblaze/nptl/tls.h (TLS_INIT_TP): Use NULL instead
      of 0.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2015-01-09 14:30:11 +10:00
Roland McGrath c97d27f1bb Some #include cleanup in aio/timer code. 2015-01-08 15:38:15 -08:00
Roland McGrath 08734ccd98 Clean up allocrtsig code. 2015-01-08 15:31:15 -08:00
Roland McGrath 7b052e33dd NPTL: Fix generic pthread_sigmask. 2015-01-08 14:26:51 -08:00
Roland McGrath cc40d25e50 NPTL: Fixed missed conditionalization of setxid hooey. 2015-01-08 13:41:14 -08:00
Roland McGrath 9287adf089 Add stub sys/procfs.h file 2015-01-08 13:24:56 -08:00
Roland McGrath 59ff172f80 NPTL: Refactor cpu_set_t validation to be sysdeps-controlled
This removes Linuxisms related to cpu_set_t validation from the
generic NPTL code and puts them into a new sysdeps header file.
2015-01-08 10:49:40 -08:00
Richard Henderson b92058573b Add -Wno-trampolines as needed 2015-01-08 08:32:44 -08:00
Chung-Lin Tang 1a0a8d152d Add Nios II definitions to elf/elf.h. 2015-01-08 08:02:43 -08:00
Adhemerval Zanella dd6e8af6ba powerpc: Fix compiler warning on some syscalls
GCC 5.0 emits an warning when using sizeof on array function parameters
and powerpc internal syscall macros add a check for such cases.  More
specifically, on powerpc64 and powerpc32 sysdep.h:

  if (__builtin_classify_type (__arg3) != 5 && sizeof (__arg3) > 8) \
          __illegally_sized_syscall_arg3 (); \

And for sysdeps/unix/sysv/linux/utimensat.c build GCC emits:

error: ‘sizeof’ on array function parameter ‘tsp’ will return size of
‘const struct timespec *’

This patch uses the address of first struct member instead of the struct
itself in syscall macro.
2015-01-08 08:03:31 -05:00
Joseph Myers 8116321f65 Fix libm feupdateenv namespace (bug 17748).
Concluding the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feupdateenv by making it a weak alias for
__feupdateenv and making the affected code call __feupdateenv.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  Also tested for ARM
(soft-float) that the math.h linknamespace tests now pass.

	[BZ #17748]
	* include/fenv.h (__feupdateenv): Use libm_hidden_proto.
	* math/feupdateenv.c (__feupdateenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Rename to __feupdateenv
	and define as weak alias of __feupdateenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
	(__feupdateenv): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Rename to
	__feupdateenv and define as weak alias of __feupdateenv.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feupdateenv): New inline
	function.
	* sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Use
	libm_hidden_def.
	* sysdeps/generic/math_private.h (default_libc_feupdateenv): Call
	__feupdateenv instead of feupdateenv.
	(default_libc_feupdateenv_test): Likewise.
	(libc_feresetround_ctx): Likewise.
2015-01-07 19:01:20 +00:00
Adhemerval Zanella 882dfe184a mips: Fix __libc_pread prototype
This patch fixes the __libc_pread prototype change from
14bb4e57c0.
2015-01-07 16:26:26 -02:00
Chris Metcalf 39a12f8db4 posix/regcomp: initialize union structure tag to avoid warning
We see some surprising warnings on tilegx with gcc 4.8.2:

In file included from regex.c:66:0:
regcomp.c: In function ‘parse_expression’:
regcomp.c:2849:15: error: ‘end_elem’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
       else if (br_elem->type == COLL_SYM)
               ^
regcomp.c:3109:34: note: ‘end_elem’ was declared here
       bracket_elem_t start_elem, end_elem;
                                  ^
regcomp.c:3109:22: error: ‘start_elem’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
       bracket_elem_t start_elem, end_elem;
                      ^

These warnings are not seen on x86, and in fact if I compile the
preprocessed tile sources with the x86 gcc 4.8.2, I don't see the
warnings.  I do see eqiuvalent warnings if I compile the
x86-preprocessed source code with tilegx gcc 4.8.2.

The fix here is to initialize the union type field appropriately in
a couple of places where we pass a union pointer to a subroutine that
"knows" what type the union is.  Setting the type explicitly seems like
a more robust way to manage such a data structure in any case.
2015-01-07 12:32:40 -05:00
Richard Earnshaw dc400d7b73 AArch64: Optimized implementations of strcpy and stpcpy. 2015-01-07 11:31:10 +00:00
Richard Earnshaw ec582ca0f3 AArch64 optimized implementation of strrchr. 2015-01-07 11:26:13 +00:00
Siddhesh Poyarekar 60f046a82d Fix typo in ChangeLog 2015-01-07 16:15:24 +05:30
Eric Biggers d5b1c5ed8b setenv fix memory leak when setting large, duplicate string (BZ #17658)
glibc maintains a binary tree of environment strings it malloc()ed
itself.  However, it's possible for it to malloc() a string, then find
that an identical string is already in the tree.  In this case, the
memory is leaked and is not freed if the application later calls
__libc_freeres().  Fix this by freeing 'new_value' when it's unneeded.

Test case:
	#include <stdlib.h>
	#include <string.h>

	int main()
	{
		char *p = calloc(100000, 1);
		memset(p, 'A', 99999);
		setenv("TESTVAR", p, 1);
		setenv("TESTVAR", p, 1);
		free(p);
	}

Leak that was reported by valgrind:
	100,008 bytes in 1 blocks are definitely lost in loss record 1 of 1
	   at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
	   by 0x4E6B3D4: __add_to_environ (setenv.c:176)
	   by 0x4C31B8F: setenv (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
	   by 0x400642: main (in /mnt/tmpfs/a.out)
2015-01-07 12:10:52 +05:30
Vladimir A. Nazarenko fb87ee96d7 Fix incorrect mount table entry parsing in __getmntent_r
When mount entry contains only four fields and have more then one space or
tab at the and, mp.mnt_freq and mp.mnt_passno will be set to some specific
values as side effect from parsing of previus mount entry. It is because
sscanf(""," %d %d ", &a, &b) returns -1, but this case is unprocessed.
Values of mp.mnt_freq and  mp.mnt_passno stays unchanged. This patch is
attempt to fix described issue by removing trailing tabs and spaces.
2015-01-06 19:51:01 -08:00
Joseph Myers 01238691bb Fix libm fesetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fesetround by making it a weak alias of
__fesetround and making the affected code call __fesetround.  An
existing __fesetround function in fenv_libc.h for powerpc is renamed
to __fesetround_inline.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fesetround failures disappear from the linknamespace
test results (feupdateenv remains to be addressed to complete fixing
bug 17748).

	[BZ #17748]
	* include/fenv.h (__fesetround): Declare.  Use libm_hidden_proto.
	* math/fesetround.c (fesetround): Rename to __fesetround and
	define as weak alias of __fesetround.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/alpha/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/arm/fesetround.c (fesetround): Likewise.
	* sysdeps/hppa/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/i386/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/ia64/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/m68k/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/mips/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/powerpc/fpu/fenv_libc.h (__fesetround): Rename to
	__fesetround_inline.
	* sysdeps/powerpc/fpu/fenv_private.h (libc_fesetround_ppc): Call
	__fesetround_inline instead of __fesetround.
	* sysdeps/powerpc/fpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.  Call __fesetround_inline instead of
	__fesetround.
	* sysdeps/powerpc/nofpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fesetround.c (fesetround):
	Likewise.
	* sysdeps/s390/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/sh/sh4/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/sparc/fpu/fesetround.c (fesetround): Likewise.
	* sysdeps/tile/math_private.h (__fesetround): New inline function.
	* sysdeps/x86_64/fpu/fesetround.c (fesetround): Rename to
	__fesetround and define as weak alias of __fesetround.  Use
	libm_hidden_weak.
	* sysdeps/generic/math_private.h (default_libc_fesetround): Call
	__fesetround instead of fesetround.
	(default_libc_feholdexcept_setround): Likewise.
	(libc_feholdsetround_ctx): Likewise.
	(libc_feholdsetround_noex_ctx): Likewise.
2015-01-07 00:41:23 +00:00
Joseph Myers cd42798aef Fix libm fesetenv namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fesetenv by making it a weak alias of
__fesetenv and making the affected code (including various copies of
feupdateenv which also gets called from C90 functions) call
__fesetenv.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fesetenv failures disappear from the linknamespace
test results (fsetround and feupdateenv remain to be addressed to
complete fixing bug 17748).

	[BZ #17748]
	* include/fenv.h (__fesetenv): Use libm_hidden_proto.
	* math/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv
	and define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/alpha/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/arm/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/fesetenv.c (fesetenv): Likewise.
	* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/ia64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/m68k/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/mips/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/powerpc/fpu/fesetenv.c (__fesetenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fesetenv.c (__fesetenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fesetenv.c (__fesetenv):
	Likewise.
	* sysdeps/s390/fpu/fesetenv.c (fesetenv): Rename to __fesetenv and
	define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fesetenv.c (fesetenv): Likewise.
	* sysdeps/sparc/fpu/fesetenv.c (__fesetenv): Use libm_hidden_def.
	* sysdeps/tile/math_private.h (__fesetenv): New inline function.
	* sysdeps/x86_64/fpu/fesetenv.c (fesetenv): Rename to __fesetenv
	and define as weak alias of __fesetenv.  Use libm_hidden_weak.
	* sysdeps/generic/math_private.h (default_libc_fesetenv): Use
	__fesetenv instead of fesetenv.
	(libc_feresetround_noex_ctx): Likewise.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/hppa/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/powerpc/nofpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feupdateenv.c
	(__feupdateenv): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/x86_64/fpu/feupdateenv.c (__feupdateenv): Likewise.
2015-01-06 23:36:20 +00:00
Ondřej Bílka 500bfbd492 Revert "Suppress warning in string/tester.c for gcc 4.9"
This reverts commit 9300797ee9.
2015-01-06 18:43:28 +01:00
H.J. Lu 1cf98e27a7 Mention bug fix for BZ #17806 2015-01-06 09:32:41 -08:00
Aurelien Jarno 38949026b3 resolv: fix rotate option
The rotate option doesn't work correctly, and only send the query to the
same server (the second in the list). The rotation code in itself is not
broken, but the nsaddrs structure is reinitialized each time at the
beginning of __libc_res_nsend unless RES_STAYOPEN is enabled.

This is due to a call to __res_iclose from the end of __libc_res_nsend
when answers from the name server have been received. This function
closes all the sockets, but doesn't free the addresses (it can do that,
but in that case the second argument is false).

This patch change the code of __res_iclose to clear statp->_u._ext.nsinit
 only when the addresses are actually freed.

	* resolv/res_init.c (__res_iclose): Only clear nsinit if the
	addresses have been freed.
2015-01-06 09:00:20 -08:00
Aurelien Jarno 5fe55e9c65 resolv: improve comments about nserv and nservall
The current comments concerning nserv and nservall are not really clear
and lead to confusion when reviewing an already complex code. Improve
them, there real meaning have been confirmed by a code analysis.

	* resolv/res_init.c (__res_vinit): Improve comments about nserv
	and nservall.
2015-01-06 09:00:20 -08:00
Ondřej Bílka 9300797ee9 Suppress warning in string/tester.c for gcc 4.9 2015-01-06 17:43:09 +01:00
Ondřej Bílka dc8ab01832 Add changelog 2015-01-06 17:35:24 +01:00
Adhemerval Zanella 14bb4e57c0 Function declaration cleanup
This patch changes the some function declaration from K&R style to
default ANSI C.

	* nptl/pthread_cancel.c (pthread_cancel): Use ANSI prototype.
	* nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait): Likewise.
	* nptl/pthread_cond_wait.c (__pthread_cond_wait): Likewise.
	* nptl/pthread_exit.c (__pthread_exit): Likewise.
	* nptl/pthread_join.c (pthread_join): Likewise.
	* nptl/pthread_timedjoin.c (pthread_timedjoin_np): Likewise.
	* sysdeps/posix/waitid.c (__waitid): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/arm/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/arm/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
	(__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
	(__libc_pwrite64): Likewsie.
	* sysdeps/unix/sysv/linux/mips/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/mips/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/mips/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/msgrcv.c (__libc_msgrcv): Likewise.
	* sysdeps/unix/sysv/linux/msgsnd.c (__libc_msgsnd): Likewise.
	* sysdeps/unix/sysv/linux/openat.c (OPENAT_NOT_CANCEL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c (__libc_pread):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
	(__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c (__libc_pwrite):
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
	(__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/preadv.c (PREADV): Likewise.
	* sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c (__libc_pwrite64): Likewise.
	* sysdeps/unix/sysv/linux/pwritev.c (__libc_pwritev): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread.c (__libc_pread): Likewise.
	* sysdeps/unix/sysv/linux/sh/pread64.c (__libc_pread64): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite.c (__libc_pwrite): Likewise.
	* sysdeps/unix/sysv/linux/sh/pwrite64.c (__libc_write64): Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c (__sigsuspend): Likewise.
	* sysdeps/unix/sysv/linux/sigtimedwait.c (__sigtimedwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwait.c (__sigwait): Likewise.
	* sysdeps/unix/sysv/linux/sigwaitinfo.c (__sigwaitinfo): Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c (__libc_msgrcv):
	Likewise.
2015-01-06 08:23:58 -08:00
Andrew Senkevich 10a5e112b6 Remove duplicated -frounding-math
No need to add -frounding-math.  math-flags in Makeconfig includes
-frounding-math.

	* math/Makefile (CFLAGS-test-float.c): Remove -frounding-math.
	(CFLAGS-test-double.c): Likewise.
	(CFLAGS-test-ldouble.c): Likewise.
	(CPPFLAGS-test-ifloat.c): Likewise.
	(CPPFLAGS-test-idouble.c): Likewise.
	(CPPFLAGS-test-ildoubl.c): Likewise.
	(CFLAGS-test-test-fenv.c): Remove variable.
	(CFLAGS-test-misc.c): Likewise.
2015-01-06 06:32:03 -08:00
H.J. Lu 57ada0e7e7 Define CLOCKS_PER_SEC type to the type clock_t
C99 specifies that CLOCKS_PER_SEC is an expression with the type clock_t.
This patch adds a generic <bits/time2.h> to define CLOCKS_PER_SEC and
provides the Linux/x86-64 version of <bits/time2.h> to support x32.

	[BZ #17797]
	* bits/time.h (CLOCKS_PER_SEC): Changed to ((clock_t) 1000000).
	* sysdeps/unix/sysv/linux/bits/time.h (CLOCKS_PER_SEC): Likewise.
	* sysdeps/unix/sysv/linux/clock.c (clock): _Static_assert
	CLOCKS_PER_SEC == 1000000.
	* time/clocktest.c (main): Replace %ld with %jd and cast to
	intmax_t.
2015-01-06 04:59:13 -08:00
Roland McGrath 46abb64d62 ARM: Consolidate with generic unwinder wrapper code 2015-01-05 15:42:16 -08:00
Steve Ellcey 61695fb2ba Merge branch 'master' of ssh://sourceware.org/git/glibc 2015-01-05 15:07:26 -08:00
Steve Ellcey 295a453e21 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memset.S (memset): Modify for mips32r6/mips64r6
	to avoid using stl/str to align destination.
2015-01-05 15:06:42 -08:00
Joseph Myers ef9faf1385 Fix libm feholdexcept namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of feholdexcept by making it a weak alias of
__feholdexcept and making the affected code call __feholdexcept.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that feholdexcept failures disappear from the
linknamespace test failures (fesetenv, fsetround and feupdateenv
remain to be addressed to complete fixing bug 17748).

	[BZ #17748]
	* include/fenv.h (__feholdexcept): Declare.  Use
	libm_hidden_proto.
	* math/feholdexcpt.c (feholdexcept): Rename to __feholdexcept and
	define as weak alias of __feholdexcept.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/alpha/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/arm/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/hppa/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/m68k/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/mips/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/nofpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/feholdexcpt.c
	(feholdexcept): Likewise.
	* sysdeps/s390/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/sparc/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Likewise.
	* sysdeps/generic/math_private.h (default_libc_feholdexcept): Use
	__feholdexcept instead of feholdexcept.
	(default_libc_feholdexcept_setround): Likewise.
2015-01-05 23:06:14 +00:00
Steve Ellcey 882c4b9f1d 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/memcpy.S: Add support for mips32r6/mips64r6.
2015-01-05 13:28:42 -08:00
Joseph Myers ac4c11f580 Fix MIPS n64 posix_fadvise namespace (bug 17796).
sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c defines
posix_fadvise64 as a strong alias for posix_fadvise (for
!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3) - i.e., for static
linking, which is the case when this matters), but it should be a weak
alias.  This patch makes it a weak alias.

Tested for MIPS that this fixes the observed linknamespace test
failures.

	[BZ #17796]
	* sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise.c
	[!SHLIB_COMPAT(libc, GLIBC_2_2, GLIBC_2_3_3)] (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 18:02:31 +00:00
Steve Ellcey 03403e3061 2015-01-05 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/mips/dl-machine.h (elf_machine_load_address): Replace
	bltzal with addiupc.
	(RTLD_START): Ditto.
2015-01-05 09:39:33 -08:00
Chris Metcalf 7ea793f39c tile: check error properly for vDSO calls
The tile vDSO vsyscalls were not properly setting the error value.
Conventionally, tile returns the same "non-negative success, negative
errno" value that x86 does (in r0), but it also returns "zero or positive
errno" in r1, which is what the regular syscall code checks.  This change
uses that convention for the vDSO calls as well.
2015-01-05 12:06:15 -05:00
Chris Metcalf 1dca195e1c lround: provide cast for wordsize-64 version if needed
Platforms with 64-bit registers where 32-bit values need to have the
high 32 bits set in a particular way need to have an explicit cast
when using the 64-bit sysdeps/ieee754/dbl-64/wordsize-64 version
of llround() as lround().  This includes tilegx32, and likely MIPS.
x32 does not need this, and AArch64 ILP32 will not either.  Require
it to be specified in sysdep.h to be explicit.
2015-01-05 11:59:32 -05:00
Joseph Myers ab70da77ea Fix ARM posix_fadvise64 namespace (bug 17793).
ARM posix_fadvise calls __posix_fadvise64_l64, to which
posix_fadvise64 is a strong alias, but posix_fadvise is a POSIX
function and posix_fadvise64 isn't.  This patch changes it into a weak
alias.

Tested for ARM that this fixes the corresponding linknamespace test
failures.

	[BZ #17793]
	* sysdeps/unix/sysv/linux/arm/posix_fadvise64.c (posix_fadvise64):
	Define as weak alias not strong alias.
2015-01-05 16:05:34 +00:00
Joseph Myers b8986484e4 Fix isblank / isascii / toascii namespace (bug 17635).
Use of isblank brings in isascii and toascii, but isblank is a C99
function and the other two aren't; similarly, isascii and toascii are
UNIX98 functions and bring in isblank, which isn't.  (Not a
conformance issue because of the is* and to* reservation, but still
contrary to glibc practice.)  This patch fixes this by splitting
isblank out of ctype-extn.c to a separate ctype-c99.c.  isblank_l is
also moved to a separate file, ctype-c99_l.c (non-XSI POSIX.1-2008 has
isblank_l, but isascii / toascii are marked OB XSI).  (In principle
all these functions could go in separate files - that's optimal for
static linking - but they are also all very small, and splitting them
all out is not needed to fix the present bug.)

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch - the ordering in which new and
existing sources are listed in ctype/Makefile is arranged so functions
go in the same order so that this comparison works).

	[BZ #17635]
	* ctype/ctype-c99.c: New file.  isblank implementation moved from
	...
	* ctype/ctype-extn.c: ... here.
	(__isblank_l): Move to ...
	* ctype/ctype-c99_l.c: ... here.  New file.
	* ctype/Makefile (routines): Add ctype-c99 and ctype-c99_l.
	* conform/Makefile (test-xfail-ISO99/ctype.h/linknamespace):
	Remove variable.
	(test-xfail-ISO11/ctype.h/linknamespace): Likewise.
	(test-xfail-XPG3/ctype.h/linknamespace): Likewise.
	(test-xfail-XPG4/ctype.h/linknamespace): Likewise.
	(test-xfail-UNIX98/ctype.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/ctype.h/linknamespace): Likewise.
2015-01-05 15:06:57 +00:00
Joseph Myers a287953a45 Fix wordsize-64 posix_fadvise64, posix_fallocate64 namespace (bug 17777).
On systems using sysdeps/unix/sysv/linux/wordsize-64, posix_fadvise64
and posix_fallocate64 (non-POSIX) are strong aliases for posix_fadvise
and posix_fallocate (POSIX), meaning references to the latter wrongly
bring in definitions of the former.  They should be weak aliases; this
patch makes them so.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17777]
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fadvise.c
	(posix_fadvise64): Define as weak alias not strong alias.
	* sysdeps/unix/sysv/linux/wordsize-64/posix_fallocate.c
	(posix_fallocate64): Likewise.
	* conform/Makefile (test-xfail-XOPEN2K/fcntl.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/mqueue.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/fcntl.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/mqueue.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/fcntl.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/mqueue.h/linknamespace): Likewise.
2015-01-05 14:37:07 +00:00
Matthew Fortune b1efe3bbcf Fix MIPS variable PAGE_SIZE bug (16191)
MIPS supports a variable page size but glibc defines a constant.
This causes at least two glibc tests to fail when the page size
does not match the hard-coded size:

inet/test-ifaddrs
inet/test_ifindex

	[BZ #16191]
	* NEWS: Mention bug fix.
	* sysdeps/unix/sysv/linux/mips/sys/user.h (PAGE_SHIFT): Remove.
	(PAGE_SIZE, PAGE_MASK, NBPG, UPAGES): Likewise.
	(HOST_TEXT_START_ADDR, HOST_DATA_START_ADDR): Likewise.
	(HOST_STACK_END_ADDR): Likewise.
2015-01-05 13:45:16 +00:00
Joseph Myers b93c2205ec Fix libm fegetround namespace (bug 17748).
Continuing the fixes for C90 libm functions calling C99 fe* functions,
this patch fixes the case of fegetround by making it a weak alias of
__fegetround and making the affected code call __fegetround.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fegetround failures disappear from the linknamespace
test failures (feholdexcept, fesetenv, fesetround and feupdateenv
remain to be addressed before bug 17748 is fully fixed, although this
patch may suffice to fix the failures in some cases, when the libc_fe*
functions are implemented but there is no architecture-specific sqrt
implementation in use so there were failures from fegetround used by
sqrt but no other such failures).

	[BZ #17748]
	* include/fenv.h (__fegetround): Declare.  Use libm_hidden_proto.
	* math/fegetround.c (fegetround): Rename to __fegetround and
	define as weak alias of __fegetround.  Use libm_hidden_weak.
	* sysdeps/aarch64/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/alpha/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/arm/fegetround.c (fegetround): Likewise.
	* sysdeps/hppa/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/i386/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/ia64/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/m68k/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/mips/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/powerpc/fpu/fegetround.c (fegetround): Likewise.
	Undefine after rather than before function definition; use
	parentheses around function name in definition.
	(__fegetround): Also undefine macro after function definition.
	* sysdeps/powerpc/nofpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.  Do not undefine as macro.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fegetround.c (fegetround):
	Likewise.
	* sysdeps/s390/fpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/sparc/fpu/fegetround.c (fegetround): Likewise.
	* sysdeps/tile/math_private.h (__fegetround): New inline function.
	* sysdeps/x86_64/fpu/fegetround.c (fegetround): Rename to
	__fegetround and define as weak alias of __fegetround.  Use
	libm_hidden_weak.
	* sysdeps/ieee754/dbl-64/e_sqrt.c (__ieee754_sqrt): Use
	__fegetround instead of fegetround.
2015-01-02 20:44:42 +00:00
Joseph Myers 253a59ccb5 Fix MIPS TIOCSER_TEMT namespace (bug 17782).
sysdeps/unix/sysv/linux/mips/bits/termios.h defines TIOCSER_TEMT
unconditionally, but it's in the user's namespace.  This patch
conditions it on __USE_MISC, as on powerpc.  I've filed bug 17783 for
the residual inconsistency in conditions on this macro (sparc defines
it for __USE_GNU only).

	[BZ #17782]
	* sysdeps/unix/sysv/linux/mips/bits/termios.h (TIOCSER_TEMT):
	Condition macro definition on [__USE_MISC].
2015-01-02 18:31:41 +00:00
Joseph Myers 27dae0113e Fix MIPS sa_flags type (bug 17781).
sysdeps/unix/sysv/linux/mips/bits/sigaction.h gives sa_flags type
unsigned int, but POSIX says it should be signed int.  This patch
gives it the correct type (the layout is unchanged, so there are no
ABI issues involved).

	[BZ #17781]
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h
	(struct sigaction): Change type of sa_flags field to int.
2015-01-02 18:30:32 +00:00
Joseph Myers 172019c0ec Fix MIPS bits/fcntl.h namespace (bug 17780).
sysdeps/unix/sysv/linux/mips/bits/fcntl.h has a structure field called
pad, which is in the user's namespace.  This patch changes it to
__glibc_reserved0.

	[BZ #17780]
	* sysdeps/unix/sysv/linux/mips/bits/fcntl.h (struct flock)
	[!__USE_FILE_OFFSET64 && _MIPS_SIM != _ABI64]: Rename pad field to
	__glibc_reserved0.
2015-01-02 18:29:24 +00:00
Joseph Myers 522ad1d6f7 Use single year in copyright notice in banner in ntpl/version.c.
* nptl/version.c (banner): Use single year in copyright notice.
2015-01-02 17:45:48 +00:00
Joseph Myers 9706dc5f53 Update copyright dates not handled by scripts/update-copyrights.
I've updated copyright dates in glibc for 2015.  This is the patch for
the changes not generated by scripts/update-copyrights and subsequent
build / regeneration of generated files.  Apart from the files updated
last time (of which sotruss.ksh had moved to sotruss.sh during the
year) this also updates nptl/version.c (missed from 2006 until
October) and sysdeps/unix/sysv/linux/lddlibc4.c (missed since 2009).

	* NEWS: Update copyright dates.
	* catgets/gencat.c (print_version): Likewise.
	* csu/version.c (banner): Likewise.
	* debug/catchsegv.sh: Likewise.
	* debug/pcprofiledump.c (print_version): Likewise.
	* debug/xtrace.sh (do_version): Likewise.
	* elf/ldconfig.c (print_version): Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/pldd.c (print_version): Likewise.
	* elf/sotruss.sh: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* iconv/iconv_prog.c (print_version): Likewise.
	* iconv/iconvconfig.c (print_version): Likewise.
	* locale/programs/locale.c (print_version): Likewise.
	* locale/programs/localedef.c (print_version): Likewise.
	* login/programs/pt_chown.c (print_version): Likewise.
	* malloc/memusage.sh (do_version): Likewise.
	* malloc/memusagestat.c (print_version): Likewise.
	* malloc/mtrace.pl: Likewise.
	* manual/libc.texinfo: Likewise.
	* nptl/version.c (banner): Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* nss/getent.c (print_version): Likewise.
	* nss/makedb.c (print_version): Likewise.
	* posix/getconf.c (main): Likewise.
	* scripts/test-installation.pl: Likewise.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
2015-01-02 16:54:45 +00:00
Will Newton b8607aac4f ARM: Remove configure check for binutils 2.21 for ARMv7
The default required version of binutils has been increased to 2.22
making this check redundant.

ChangeLog:

2015-01-02  Will Newton  <will.newton@linaro.org>

	* sysdeps/arm/armv7/configure: Removed.
	* sysdeps/arm/armv7/configure.ac: Likewise.
2015-01-02 16:52:40 +00:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Siddhesh Poyarekar b217c15fc3 Remove uses of sprintf in gen-posix-conf-vars.awk
Simply some code by replacing sprintf in the awk script.
2015-01-02 11:16:35 +05:30
Joseph Myers 73a268c759 Fix libm fegetenv namespace (bug 17748).
Some C90 libm functions call fegetenv via libc_feholdsetround*
functions in math_private.h.  This patch makes them call __fegetenv
instead, making fegetenv into a weak alias for __fegetenv as needed.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).  Also tested for ARM
(soft-float) that fegetenv failures disappear from the linknamespace
test failures (however, similar fixes will also be needed for
fegetround, feholdexcept, fesetenv, fesetround and feupdateenv before
this set of namespace issues covered by bug 17748 is fully fixed and
those linknamespace tests start passing).

	[BZ #17748]
	* include/fenv.h (__fegetenv): Use libm_hidden_proto.
	* math/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
	and define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/alpha/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/arm/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/hppa/fpu/fegetenv.c (fegetenv): Likewise.
	* sysdeps/i386/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/ia64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/m68k/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/mips/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/powerpc/fpu/fegetenv.c (__fegetenv): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fegetenv.c (__fegetenv): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fegetenv.c (__fegetenv):
	Likewise.
	* sysdeps/s390/fpu/fegetenv.c (fegetenv): Rename to __fegetenv and
	define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fegetenv.c (fegetenv): Likewise.
	* sysdeps/sparc/fpu/fegetenv.c (__fegetenv): Use libm_hidden_def.
	* sysdeps/tile/math_private.h (__fegetenv): New inline function.
	* sysdeps/x86_64/fpu/fegetenv.c (fegetenv): Rename to __fegetenv
	and define as weak alias of __fegetenv.  Use libm_hidden_weak.
	* sysdeps/generic/math_private.h (libc_feholdsetround_ctx): Use
	__fegetenv instead of fegetenv.
	(libc_feholdsetround_noex_ctx): Likewise.
2014-12-31 22:07:52 +00:00
Matthew Fortune 0bd956720c Add support for MIPS O32 FPXX and .MIPS.abiflags
* elf/elf.h (PT_MIPS_ABIFLAGS): Define.
	(Elf_MIPS_ABIFlags_v0): New structure.
	(EF_MIPS_FP64): Define.
	(MIPS_AFL_REG_NONE, MIPS_AFL_REG_32, MIPS_AFL_REG_64): Likewise.
	(MIPS_AFL_REG_128, MIPS_AFL_ASE_DSP, MIPS_AFL_ASE_DSP64): Likewise.
	(MIPS_AFL_ASE_DSPR2, MIPS_AFL_ASE_EVA, MIPS_AFL_ASE_MCU): Likewise.
	(MIPS_AFL_ASE_MDMX, MIPS_AFL_ASE_MIPS3D, MIPS_AFL_ASE_MT): Likewise.
	(MIPS_AFL_ASE_SMARTMIPS, MIPS_AFL_ASE_VIRT): Likewise.
	(MIPS_AFL_ASE_VIRT64, MIPS_AFL_ASE_MSA, MIPS_AFL_ASE_MSA64): Likewise.
	(MIPS_AFL_ASE_MIPS16, MIPS_AFL_ASE_MICROMIPS): Likewise.
	(MIPS_AFL_ASE_XPA, MIPS_AFL_EXT_XLR, MIPS_AFL_EXT_OCTEON2): Likewise.
	(MIPS_AFL_EXT_OCTEONP, MIPS_AFL_EXT_LOONGSON_3A): Likewise.
	(MIPS_AFL_EXT_OCTEON, MIPS_AFL_EXT_5900, MIPS_AFL_EXT_4010): Likewise.
	(MIPS_AFL_EXT_4100, MIPS_AFL_EXT_3900, MIPS_AFL_EXT_10000): Likewise.
	(MIPS_AFL_EXT_SB1, MIPS_AFL_EXT_4111, MIPS_AFL_EXT_4120): Likewise.
	(MIPS_AFL_EXT_5400, MIPS_AFL_EXT_5500): Likewise.
	(MIPS_AFL_EXT_LOONGSON_2E, MIPS_AFL_EXT_LOONGSON_2F): Likewise.
	(Val_GNU_MIPS_ABI_FP_ANY, Val_GNU_MIPS_ABI_FP_DOUBLE): New enum values.
	(Val_GNU_MIPS_ABI_FP_SINGLE, Val_GNU_MIPS_ABI_FP_SOFT): Likewise.
	(Val_GNU_MIPS_ABI_FP_OLD_64, Val_GNU_MIPS_ABI_FP_XX): Likewise.
	(Val_GNU_MIPS_ABI_FP_64, Val_GNU_MIPS_ABI_FP_64A): Likewise.
	(Val_GNU_MIPS_ABI_FP_MAX): Likewise.
	* sysdeps/mips/Makefile [subdir=elf]: Add tst-abi-interlink,
	tst-mode-switch-1, tst-mode-switch-2, tst-mode-switch-3 tests.
	* sysdeps/mips/bits/linkmap.h (struct link_map_machine): Add fpmode
	field.
	* sysdeps/mips/dl-machine.h (elf_machine_matches_host): Reject
	EF_MIPS_FP64.
	* sysdeps/mips/dl-machine-reject-phdr.h: New file.
	* sysdeps/mips/tst-abi-fp32mod.c: Likewise.
	* sysdeps/mips/tst-abi-fpxxmod.c: Likewise.
	* sysdeps/mips/tst-abi-fpxxomod.c: Likewise.
	* sysdeps/mips/tst-abi-fp64mod.c: Likewise.
	* sysdeps/mips/tst-abi-fp64amod.c: Likewise.
	* sysdeps/mips/tst-abi-interlink.c: Likewise.
	* sysdeps/mips/tst-mode-switch-1.c: Likewise.
	* sysdeps/mips/tst-mode-switch-2.c: Likewise.
	* sysdeps/mips/tst-mode-switch-3.c: Likewise.
	* sysdeps/unix/sysv/linux/mips/configure.ac (o32-fpabi): Define to
	record the current FP ABI extension.
	(mips-mode-switch): Define to show if kernel headers support mode
	switching.
	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
	* sysdeps/unix/sysv/linux/mips/ldsodefs.h: Increase maximum
	supported SYSV ABI version to 3.
	* sysdeps/unix/sysv/linux/mips/libc-abis: Add new MIPS_O32_FP64
	feature.
2014-12-31 21:09:21 +00:00
Rajalakshmi Srinivasaraghavan f59ad976ed powerpc: POWER7 strcpy optimization for unaligned strings
This patch optimizes strcpy for ppc64/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 word aligned optimization is also removed, since the new unaligned
code path shows better results handling word-aligned strings.

More combination of unaligned inputs is also added in benchtest
to measure the improvement.The new optimization shows 2 to 80% of
performance improvement for longer string though it does not show
big difference on string size less than 16 due to additional checks.
2014-12-31 14:35:59 -05:00
Joseph Myers 4a3d39994e Clean up powerpc fegetround / __fegetround inlines.
The natural fix for some linknamespace test failures, where C90 libm
functions call C99 <fenv.h> functions, is to make fe* into weak
aliases for __fe* and call __fe* from within libm as needed.

To do this, the __fe* names need to be available for that purpose -
that is, they must not be used for something other than aliases of
fe*.  On powerpc, however, __fegetround is an inline function in
fenv_libc.h, with no corresponding fegetround inline function;
fegetround has an equivalent macro expansion in bits/fenvinline.h, but
that is disabled if __NO_MATH_INLINES (which is defined for building
libm).

I see no need for that disabling; it's not even clear that
__NO_MATH_INLINES should affect <fenv.h>, and the results of
fegetround are completely defined so there is no semantic effect of
that disabling at all outside glibc.  The x86 inline feraiseexcept is
conditioned on __USE_EXTERN_INLINES not __NO_MATH_INLINES (but that's
an inline function rather than a macro).

This patch removes the __NO_MATH_INLINES conditional on that
fegetround macro, so resulting in it being expanded inline inside
glibc.  In turn, this means that direct calls to __fegetround from C99
functions in ldbl-128ibm can be changed to calls to fegetround, so
that nofpu fenv_libc.h files don't need to define __fegetround at all
and, by changing ldbl-128ibm files to use <fenv.h> not <fenv_libc.h>,
non-e500 nofpu no longer needs an fenv_libc.h file.

The other macros in fenvinline.h are left conditional on
__NO_MATH_INLINES, although since the only case where this should make
a difference is one involving undefined behavior (if the argument to
the function is not a valid exception macro).

The out-of-line definition for fegetround uses __fegetround (the
inline function removed by this patch).  So this continues to work,
the fenvinline.h header is made to define __fegetround, and then to
define fegetround to call __fegetround.

Tested for powerpc32 (hard float) that installed stripped shared
libraries are unchanged by this patch; also tested that powerpc-nofpu
build still works.  (This patch does not itself fix any bugs; it
simply cleans things up in preparation for separate bug fixes.)

	* sysdeps/powerpc/bits/fenvinline.h (fegetround): Rename macro to
	__fegetround and redefine to call __fegetround.  Remove condition
	on [!__NO_MATH_INLINES].
	* sysdeps/powerpc/fpu/fenv_libc.h (__fegetround): Remove inline
	function.
	* sysdeps/powerpc/nofpu/fenv_libc.h: Remove file.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fenv_libc.h (__fegetround):
	Remove macro.
	* sysdeps/ieee754/ldbl-128ibm/s_llrintl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	(__llrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_llroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_lrintl.c: Likewise.
	(__lrintl): Call fegetround instead of __fegetround.
	* sysdeps/ieee754/ldbl-128ibm/s_lroundl.c: Include <fenv.h>
	instead of <fenv_libc.h>.
	* sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
	(__rintl): Call fegetround instead of __fegetround.
2014-12-31 19:16:34 +00:00
Siddhesh Poyarekar 195f3afcbe Use one-dimension arrays in gen-posix-conf-vars.awk
True multi-dimensional arrays were introduced in awk 4.0 and we
support awk versions as early as 3.12.  Use a single subscript of the
form prefix_conf instead of two dimensions to work around this
limitation.  We also need one additional array of just the conf names
subscripted by the prefix_conf to print the names for the
specifications.

	* scripts/gen-posix-conf-vars.awk: Don't use multi-dimensional
	arrays.
2014-12-31 13:22:58 +05:30
H.J. Lu 7062bd4230 Don't check PI_STATIC_AND_HIDDEN in i386 dl-machine.h
PI_STATIC_AND_HIDDEN is always defined for i386.  There is no need to
check PI_STATIC_AND_HIDDEN in sysdeps/i386/dl-machine.h.

	[BZ #17775]
	* sysdeps/i386/dl-machine.h (PI_STATIC_AND_HIDDEN): Removed.
	(elf_machine_dynamic) [!PI_STATIC_AND_HIDDEN]: Likewise.
	(elf_machine_load_address) [!PI_STATIC_AND_HIDDEN]: Likewise.
2014-12-30 14:31:58 -08:00
Andrew Senkevich 07256e183e i386: Fix build by GCC 5.0
Fixed 3 "make check" failures on glibc 32bit built by gcc 5.0 due to EBX
was enabled for allocation:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html

Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
were failed because EBX was used as PIC register.

	* sysdeps/i386/tls-macros.h: Include <features.h>.
	(TLS_LE): Use non-PIC version for GCC >= 5.0.
	(TLS_IE): Likewise.
	(TLS_LD): Likewise.
	(TLS_GD): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Don't
	define for GCC >= 5.0.
2014-12-30 11:37:41 -08:00
Chris Metcalf 1ff950ad20 Fix some warnings in the absence of FP round/exception support
Due to tile missing a bunch of FP exception and rounding
support, the tests generate warnings.  These changes fix the
warnings by just not compiling some unused functions, and
adding some attribute ((unused)) tags.
2014-12-30 14:11:13 -05:00
Joseph Myers 0747f81811 Fix libm feraiseexcept namespace (bug 17723).
Various C90 and UNIX98 libm functions call feraiseexcept, which is not
in those standards.  This causes linknamespace test failures - except
on x86 / x86_64, where feraiseexcept is inline (for the relevant
constant arguments) in bits/fenv.h.

This patch fixes this by making those functions call __feraiseexcept
instead.  All changes are applied to all architectures rather than
considering the possibility that some might not be needed in some
cases (e.g. x86) as it seems most maintainable to keep architectures
consistent.

Where __feraiseexcept does not exist, it is added, with feraiseexcept
made a weak alias; where it is a strong alias, it is made weak.
libm_hidden_def / libm_hidden_proto are used with __feraiseexcept
(this might in some cases improve code generation for existing calls
to __feraiseexcept in some code on some architectures).  Where there
are dummy feraiseexcept macros (on architectures without
floating-point exceptions support, to avoid compile errors from
references to undefined FE_* macros), corresponding dummy
__feraiseexcept macros are added.  And on x86, to ensure
__feraiseexcept calls still get inlined, the inline function in
bits/fenv.h is refactored so that most of it can be reused in an
inline __feraiseexcept in a separate include/bits/fenv.h.

Calls are changed in C90/UNIX98 functions, but generally not in
functions missing from those standards.  They are also changed in
libc_fe* functions (on the basis that those might be used in any libm
function), and in feupdateenv (on the same basis - may be used, via
default libc_*, in any libm function - of course feupdateenv will need
changing to __feupdateenv in a subsequent patch to make that fully
namespace-clean).

No __feraiseexcept is added corresponding to the feraiseexcept in
powerpc bits/fenvinline.h, because that macro definition is
conditional on !defined __NO_MATH_INLINES, and glibc libm is built
with -D__NO_MATH_INLINES, so changing internal calls to use
__feraiseexcept should make no difference.

Tested for x86_64 (testsuite; the only change in disassembly of
installed shared libraries is a slight code reordering in clog10, of
no apparent significance).  Also tested for MIPS, where (in the
configuration tested) it eliminates math.h linknamespace failures for
n32 and n64 (some for o32 remain because of other issues).

	[BZ #17723]
	* include/fenv.h (__feraiseexcept): Use libm_hidden_proto.
	* math/fraiseexcpt.c (__feraiseexcept): Use libm_hidden_def.
	* sysdeps/aarch64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/arm/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/hppa/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/i386/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/ia64/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/m68k/coldfire/fpu/fraiseexcpt.c (feraiseexcept):
	Likewise.
	* sysdeps/microblaze/math_private.h (__feraiseexcept): New macro.
	* sysdeps/mips/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/powerpc/nofpu/fraiseexcpt.c (__feraiseexcept): Likewise.
	* sysdeps/powerpc/powerpc32/e500/nofpu/fraiseexcpt.c
	(__feraiseexcept): Likewise.
	* sysdeps/s390/fpu/fraiseexcpt.c (feraiseexcept): Rename to
	__feraiseexcept and define as weak alias of __feraiseexcept.  Use
	libm_hidden_weak.
	* sysdeps/sh/sh4/fpu/fraiseexcpt.c (feraiseexcept): Likewise.
	* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	* sysdeps/tile/math_private.h (__feraiseexcept): New macro.
	* sysdeps/unix/sysv/linux/alpha/fraiseexcpt.S (__feraiseexcept):
	Use libm_hidden_def.
	* sysdeps/x86_64/fpu/fraiseexcpt.c (__feraiseexcept): Use
	libm_hidden_def.
	(feraiseexcept): Define as weak not strong alias.  Use
	libm_hidden_weak.
	* sysdeps/x86/fpu/bits/fenv.h (__feraiseexcept_invalid_divbyzero):
	New inline function.  Factored out of ...
	(feraiseexcept): ... here.  Use __feraiseexcept_invalid_divbyzero.
	* sysdeps/x86/fpu/include/bits/fenv.h: New file.
	* math/e_scalb.c (invalid_fn): Call __feraiseexcept instead of
	feraiseexcept.
	* math/w_acos.c (__acos): Likewise.
	* math/w_asin.c (__asin): Likewise.
	* math/w_ilogb.c (__ilogb): Likewise.
	* math/w_j0.c (y0): Likewise.
	* math/w_j1.c (y1): Likewise.
	* math/w_jn.c (yn): Likewise.
	* math/w_log.c (__log): Likewise.
	* math/w_log10.c (__log10): Likewise.
	* sysdeps/aarch64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/aarch64/fpu/math_private.h
	(libc_feupdateenv_test_aarch64): Likewise.
	* sysdeps/alpha/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/arm/fenv_private.h (libc_feupdateenv_test_vfp): Likewise.
	* sysdeps/arm/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/m68k/fpu/feupdateenv.c (__feupdateenv): Likewise.
	* sysdeps/mips/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/powerpc/fpu/e_sqrt.c (__slow_ieee754_sqrt): Likewise.
	* sysdeps/s390/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sh/sh4/fpu/feupdateenv.c (feupdateenv): Likewise.
	* sysdeps/sparc/fpu/feupdateenv.c (__feupdateenv): Likewise.
2014-12-30 17:08:09 +00:00
H.J. Lu 126f6c7288 Replace %ld with %jd and cast to intmax_t 2014-12-30 08:10:19 -08:00
H.J. Lu fe342f5013 Replace %ld with %jd and cast to intmax_t 2014-12-30 08:09:43 -08:00
H.J. Lu 37f469007d Replace %ld with %jd and cast to intmax_t 2014-12-30 08:09:06 -08:00
H.J. Lu ad86fbc3d5 Replace %ld with %jd and cast to intmax_t 2014-12-30 08:08:29 -08:00
H.J. Lu 5d619de461 Replace %ld/%lu with %jd/%ju and cast to intmax_t/uintmax_t 2014-12-30 08:07:50 -08:00
H.J. Lu 6490d94537 Replace %ld with %jd and cast to intmax_t 2014-12-30 08:07:05 -08:00
H.J. Lu e401d5ca5d Replace %ld with %jd and cast to intmax_t 2014-12-30 08:06:35 -08:00
H.J. Lu 41fad83083 Replace %ld with %jd and cast to intmax_t 2014-12-30 08:05:47 -08:00
H.J. Lu 8d2b2763fc Replace %ld with %jd and cast to intmax_t 2014-12-30 08:04:43 -08:00
Andrew Senkevich 8b4416d83c i386: memcpy functions with SSE2 unaligned load/store
These new memcpy functions are the 32-bit version of x86_64 SSE2 unaligned
memcpy.  Memcpy average performace benefit is 18% on Silvermont, other
platforms also improved about 35%, benchmarked on Silvermont, Haswell, Ivy
Bridge, Sandy Bridge and Westmere, performance results attached in

https://sourceware.org/ml/libc-alpha/2014-07/msg00157.html

	* sysdeps/i386/i686/multiarch/bcopy-sse2-unaligned.S: New file.
	* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy-sse2-unaligned.S: Likewise.
	* sysdeps/i386/i686/multiarch/bcopy.S: Select the sse2_unaligned
	version if bit_Fast_Unaligned_Load is set.
	* sysdeps/i386/i686/multiarch/memcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/memcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove.S: Likewise.
	* sysdeps/i386/i686/multiarch/memmove_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy.S: Likewise.
	* sysdeps/i386/i686/multiarch/mempcpy_chk.S: Likewise.
	* sysdeps/i386/i686/multiarch/Makefile (sysdep_routines): Add
	bcopy-sse2-unaligned, memcpy-sse2-unaligned,
	memmove-sse2-unaligned and mempcpy-sse2-unaligned.
	* sysdeps/i386/i686/multiarch/ifunc-impl-list.c (MAX_IFUNC): Set
	to 4.
	(__libc_ifunc_impl_list): Test __bcopy_sse2_unaligned,
	__memmove_chk_sse2_unaligned, __memmove_sse2_unaligned,
	__memcpy_chk_sse2_unaligned, __memcpy_sse2_unaligned,
	__mempcpy_chk_sse2_unaligned, and __mempcpy_sse2_unaligned.
2014-12-30 07:19:38 -08:00
Chris Metcalf 6d6d7fde04 Fix a couple of -Wundef warnings. 2014-12-29 23:14:38 -05:00
Chris Metcalf cd2c37c979 tile: prefer inlines to macros in math_private.h. 2014-12-29 19:48:43 -05:00
Chris Metcalf e47b8d3bbc posix/Makefile: use $(objpfx) for files in before-compile.
This fixes a build failure with a separate build tree where
posix-conf-vars-def.h wasn't being built.
2014-12-29 10:58:25 -05:00
Siddhesh Poyarekar 7910c2ae73 Make type for spec variable size as size_t 2014-12-29 19:56:52 +05:30
Siddhesh Poyarekar 50cbbaa935 Use posix-conf-vars.list to generate spec array
This patch adds support to generate the spec array in getconf from the
conf.list.  The generated code is mostly unchanged.  the only changes
are due to the change in layout of the spec and val arrays in the ELF.

The val array can also be auto-generated from posix-conf-vars.list
once the remaining macros are added to it.

	* posix/posix-conf-vars.list (SPEC:XBS5): Add sysconf prefix.
	* posix/confstr.c: Define NEED_SPEC_ARRAY to 0.
	* posix/posix-envs.def: Likewise.
	* sysdeps/posix/sysconf.c: Likewise.
	* posix/getconf.c: Define NEED_SPEC_ARRAY to 1.
	(specs): Remove array.
	* scripts/gen-posix-conf-vars.awk: Support generation of specs
	array.
2014-12-29 19:56:27 +05:30
Siddhesh Poyarekar 3b566046c3 Add _POSIX namespace SYSCONF macros to posix-conf-vars.list
This fixes the remaining -Wundef warnings.  Tested on x86_64.

	* posix/posix-conf-vars.list: Add _POSIX sysconf namespace.
	* sysdeps/posix/sysconf.c: Include posix-conf-vars.h.
	(__sysconf): Use CONF_IS_* macros.
2014-12-29 19:56:01 +05:30
Siddhesh Poyarekar 4a6aca7bf8 Remove Wundef warnings for specification macros
This patch adds a file posix-conf-vars.list that is used to generate
macros to determine if a macro is defined as set, unset or not
defined.  gen-posix-conf-vars.awk processes this file and generates a
header (posix-conf-vars-def.h) with these macros.  A new header
posix-conf-vars.h includes this generated header and defines accessor
macros for the generated macros.

Tested on x86_64.

	* posix/Makefile (before-compile): Add posix-conf-vars-def.h.
	($(objpfx)posix-conf-vars-def.h): New target.
	* posix/posix-conf-vars.list: New file.
	* posix/posix-conf-vars.h: New file.
	* posix/confstr.c: Include posix-conf-vars.h.
	(confstr): Use CONF_IS_* macros.
	* posix/posix-envs.def: Include posix-conf-vars.h.  Use
	CONF_IS_* macros.
	* scripts/gen-posix-conf-vars.awk: New file.
2014-12-29 17:37:54 +05:30
Chris Metcalf 0025b4cc84 tile: add no-op fe*() routines for libc internal use
These avoid having tile generate real calls to the no-op
functions, which then causes linknamespace test failures.

It might make sense to factor all of these out into a common
header that can be shared by tile, microblaze, etc., but for
now just fix the test failures.
2014-12-26 18:39:47 -05:00
Chris Metcalf d8aaf74be9 linux/clock_settime: remove unnecessary vDSO definitions
These definitions were added back before __ASSUME_POSIX_CPU_TIMERS
was removed.  There used to be a vsyscall to clock_getres() in
maybe_syscall_settime_cpu(), but that function was removed in commit
26889eac.  The presence of the vsyscall definitions means that platforms
that don't provide clock_getres as a vsyscall hit a symbol redefinition
warning in this file, becoming fatal with -Werror.  Removing the
vsyscall definitions is the obvious fix.

No change to generated code on x86_64.
2014-12-26 16:34:02 -05:00
Chris Metcalf 5d24aa6056 tilegx: fix sysdep.h to avoid a redefinition warning
The symbol for HAVE_CLOCK_GETTIME_VSYSCALL was being
only conditionally defined under [SHARED].  However, it turns
out this causes a preprocessor symbol redefinition warning
when building clock_gettime.o.  Move the symbol definition
down to make it unconditional, like other platforms do.
2014-12-26 16:22:28 -05:00
Chris Metcalf 7c1395a7e4 tilegx32: avoid a a -Werror warning from unwinding
The _Unwind_GetCFA() routine returns a 64-bit value,
which we interpret as a pointer.  Add an intermediate
cast to long so that in ILP32 mode we don't get a warning
about casting a wrong-sized integer to a pointer.
2014-12-26 16:18:40 -05:00
Chris Metcalf 3c87c6167e tilegx: enable wordsize-64 support for ieee745 dbl-64.
I missed this during the initial port.  Some testing shows that
enabling this mode does, unsurprisingly, yield some nice speedups
on the math functions in question.
2014-12-23 14:04:35 -05:00
Richard Earnshaw f559d8cf29 * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy. 2014-12-23 08:58:18 -08:00
Florian Weimer 7d81e8d6db iconvdata/run-iconv-test.sh: Actually test iconv modules
Arjun Shankar noticed that this test case was not testing anything
because iconv was invoked without the required arguments.
2014-12-23 16:16:32 +01:00
Joseph Myers 90aa3d0945 Make __ASSUME_UTIMES hppa-specific.
This patch makes __ASSUME_UTIMES hppa-specific, removing mentions of
the macro from architecture-independent code and code for other
architectures.  (All other architectures either have the utimes
syscall in all relevant kernel versions, or use the asm-generic
interface so only have utimensat and won't get the utimes syscall.)  A
similar approach is used to that used for futimesat for MicroBlaze: if
the kernel is recent enough that the utimes syscall can be assumed to
be present, use the implementation in terms of the utimes syscall, and
otherwise use the linux/generic implementation in terms of utimensat.

Tested x86_64 that the disassembly of installed shared libraries is
unchanged by the patch.  Not tested for hppa.

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_UTIMES): Do
	not define.
	* sysdeps/unix/sysv/linux/utimes.c: Do not include
	<kernel-features.h>.
	(__utimes) [__NR_utimes]: Make code unconditional.
	(__utimes) [!__ASSUME_UTIMES]: Remove conditional code.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_UTIMES): Do not undefine.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_UTIMES): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_UTIMES): Define for [__LINUX_KERNEL_VERSION >= 0x030e00]
	instead of undefining for [__LINUX_KERNEL_VERSION < 0x030e00].
	* sysdeps/unix/sysv/linux/hppa/utimes.c: New file.
2014-12-22 21:42:03 +00:00
Steve Ellcey 4c0c0e2aef Fix preprocessor indentation in sysdeps/mips/memcpy.S.
Checked in as obvious.
2014-12-22 13:29:20 -08:00
Chris Metcalf b638f96a76 Fix namespace conformance issue with Bessel functions.
[BZ #17747]
The y0/y1/yn and j0/j1/jn functions provided a strong_alias
to the "l"-suffixed variants when no long double support is
being compiled.  This breaks namespace conformance when the
basename versions conform but the l-suffixed ones don't.
Fixed by making them weak aliases instead.
2014-12-22 15:24:17 -05:00
Chris Metcalf 0dacd7a3b9 tilegx: remove implicit boolean conversion in strstr.
[BZ #17746]
The __builtin_expect() truncated a uint64_t to a 32-bit long
in ILP32 mode, discarding the high 32 bits, and potentially
missing the NUL terminator that we were searching for with SIMD
operations.  Explicitly compare to zero to fix the problem.
2014-12-22 14:50:26 -05:00
Chris Metcalf 929011700c Update NEWS and ChangeLog with two tile bug fixes.
I committed fixes without references to bug numbers.

Bug 17744: commit 95dee05f.
Bug 17745: commit e969965a.
2014-12-22 14:45:02 -05:00
Steve Ellcey 528479c472 2014-12-22 Steve Ellcey <sellcey@imgtec.com>
* sysdeps/unix/mips/sysdep.h (__mips_isa_rev): Set
	to zero if not already defined.
2014-12-22 10:49:56 -08:00
Joseph Myers f56f91245a Split __kernel_standard* functions (fixes bug 17724).
Bug 17724 reports references to fesetround being brought in by
ldbl-128ibm rintl via references to __rintl from __kernel_standard_l.
Because all three __kernel_standard* functions are in the same file,
this gets brought in even though only the long double version
__kernel_standard_l needs __rintl, and the C90 functions use only
__kernel_standard.

This patch fixes this by splitting the three versions into separate
files; it's fine for long double functions to refer to fe* functions
directly, unless they get called by C90 double functions.

Tested for x86_64 (testsuite; the reordering of code means disassembly
of shared libraries can't usefully be compared).  Tested for powerpc
that the relevant issue disappears from the linknamespace test
output.

	[BZ #17724]
	* sysdeps/ieee754/k_standard.c: Don't include <float.h>.
	(__kernel_standard_f): Remove.  Moved to k_standardf.c.
	(__kernel_standard_l): Remove.  Moved to k_standardl.c with
	(char *) casts added.
	* sysdeps/ieee754/k_standardf.c: New file.
	* sysdeps/ieee754/k_standardl.c: Likewise.
	* math/Makefile (libm-support): Remove k_standard.
	(libm-calls): Add k_standard.
2014-12-22 18:45:50 +00:00
Steve Ellcey 9d1fc928a4 Remove trailing whitespace. 2014-12-22 10:36:49 -08:00
Steve Ellcey 2ef4b74a10 Add missing ChangeLog entries from Friday (Dec 19, 2014). 2014-12-22 10:35:32 -08:00
Wilco Dijkstra 8622d55688 Optimize to avoid an unnecessary FPCR read. 2014-12-22 17:14:55 +00:00
Wilco Dijkstra f3806bdbc1 Optimize to reduce FPCR/FPSR accesses. 2014-12-22 17:14:54 +00:00
Wilco Dijkstra 9b47df5814 Call libc_fetestexcept_aarch64. 2014-12-22 17:14:54 +00:00
Wilco Dijkstra 97be3cacec Call libc_fesetround_aarch64. 2014-12-22 16:57:41 +00:00
Joseph Myers 935ab81792 Fix resolver bind, getsockname namespace (bug 17733).
On Linux architectures using socketcall, the resolver ends up bringing
in strong symbols for bind and getsockname, which are not in
POSIX.1-1996.  This causes linknamespace test failures:

FAIL: conform/POSIX/pthread.h/linknamespace
FAIL: conform/POSIX/sched.h/linknamespace
FAIL: conform/POSIX/time.h/linknamespace

These functions are defined as strong symbols with __bind and
__getsockname as weak aliases.  This patch switches this to the other
way round by removing the NO_WEAK_ALIAS definitions and so letting the
default case in socket.S act; I see no reason for the existing
arrangements.

Tested for x86 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17733]
	* sysdeps/unix/sysv/linux/bind.S (NO_WEAK_ALIAS): Do not define.
	(__bind): Do not define as weak alias.
	* sysdeps/unix/sysv/linux/getsockname.S (NO_WEAK_ALIAS): Do not
	define.
	(__getsockname): Do not define as weak alias.
2014-12-22 12:46:27 +00:00
Will Newton cc8623f196 Require bison 2.7 or newer for regenerating intl/plural.y
The merge of the latest gettext code introduced changes to the yacc
parser source that are incompatible with versions of bison older
than 2.7. Add a configure check for the appropriate versions and
document the requirement in INSTALL.

ChangeLog:

2014-12-22  Will Newton  <will.newton@linaro.org>

	* manual/install.texi: Document that we require bison 2.7
	or above.
	* INSTALL: Regenerate.
	* configure.ac: Use AC_CHECK_PROG_VER instead of
	AC_PATH_PROG when checking for bison and check for
	version 2.7 or above.
	* configure: Regenerate.
2014-12-22 11:57:40 +00:00
Chris Metcalf e969965afd tile: separate ffsll from ffs
This avoids a linknamespace failure when ffs is legal
but ffsll is not.
2014-12-21 17:12:54 -05:00
Chris Metcalf a19ca65ade tile: remove localplt.data and use generic one again.
With the __tls_get_addr removed, it works for tile.
2014-12-21 16:09:36 -05:00
H.J. Lu 050f7298e1 Add hidden __tls_get_addr/___tls_get_addr alias
__tls_get_addr/___tls_get_addr is always defined in ld.so.  There is
no need to call them via PLT inside ld.so.  This patch adds the hidden
__tls_get_addr/___tls_get_addr aliases and calls them directly from
_dl_tlsdesc_dynamic.  There is no need to set up the EBX register in
i386 _dl_tlsdesc_dynamic when calling the hidden ___tls_get_addr.

	* elf/dl-tls.c (__tls_get_addr): Provide the hidden definition
	if not defined.
	* sysdeps/i386/dl-tls.h (___tls_get_addr): Provide the hidden
	definition.
	* sysdeps/i386/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
	hidden ___tls_get_addr.
	* sysdeps/x86_64/dl-tlsdesc.S (_dl_tlsdesc_dynamic): Call the
	hidden __tls_get_addr.
	* sysdeps/generic/localplt.data (__tls_get_addr): Removed.
	* sysdeps/unix/sysv/linux/i386/localplt.data (___tls_get_addr):
	Likewise.
2014-12-21 09:27:11 -08:00
Andreas Schwab 6df5547e93 m68k: remove @PLTPC from _dl_init call 2014-12-21 15:21:14 +01:00
Andreas Schwab c1764d5e79 Fix changelog typo 2014-12-21 15:21:14 +01:00
H.J. Lu 7432d613cd Remove @PLT from "call _dl_init@PLT" in _dl_start_user
_dl_start_user in ld.so calls the local function _dl_init.  There is no
need to go through PLT.

	* sysdeps/i386/dl-machine.h (_dl_start_user): Remove @PLT
	from "call _dl_init@PLT".
	* sysdeps/x86_64/dl-machine.h (_dl_start_user): Likewise.
	from "call _dl_init@PLT".
2014-12-21 05:27:31 -08:00
Anders Kaseorg 98fe149e34 manual: Correct guarantee about pointers compared by qsort()
C99, C11, POSIX, and the glibc implementation do guarantee that the
pointers passed to the qsort comparison function lie within the array.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-12-21 14:11:32 +01:00
Chris Metcalf d12455f596 tile: provide localplt.data with __tls_get_addr optional 2014-12-20 13:56:57 -05:00
Chris Metcalf 95dee05f17 tilegx: fix strstr to build and link better
The two_way_short_needle() routine included from str-two-way.h
is not used, so mark it so to avoid compiler warnings.

Calling strnlen() breaks linknamespace tests, so change it
to __strnlen().
2014-12-19 22:54:35 -05:00
Ondřej Bílka 3eb38795db Simplify strncat.
We rewrite strncat to use strnlen and malloc calls which simplifies code
an is faster as these functions are better optimized than original code.
2014-12-19 23:09:40 +01:00
David S. Miller 0d4ba8be9c Fix soft-fp build warning on sparc about strict aliasing.
* sysdeps/sparc/sparc32/soft-fp/q_neg.c (_Q_neg): Use a union to
	access the quad as both a long double and as a series of 4 words.
2014-12-19 13:45:31 -08:00
David S. Miller 6d4188dd7f Fix array bounds warnings in elf_get_dyanmic_info() on sparc with gcc-4.6
* get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a
	link_map->l_info array access.
2014-12-19 13:45:28 -08:00
Chris Metcalf 804c54f7b0 iconvdata/tst-loading: bump up timeout to 10s 2014-12-19 16:36:59 -05:00
Chris Metcalf 4ef91cdca8 math: increase timeout for math/atest-*.c
These tests run in the 2-5 second range on tilegx, so just bump
up the timeout to 10 seconds generically.
2014-12-19 15:11:04 -05:00
H.J. Lu afd176d6cf Replace -Wno-error with -fno-builtin-lround 2014-12-19 08:32:05 -08:00
Torvald Riegel a4a43a907c i386: Move futex functions from lowlevellock.h to lowlevellock-futex.h. 2014-12-19 15:27:35 +01:00
Torvald Riegel 76f71081cd Use generic lowlevellock-futex.h in x86_64 lowlevellock.h. 2014-12-19 15:21:12 +01:00
Torvald Riegel 6b814909b4 sh: Remove custom lowlevellock, barrier, condvar, and rwlock implementations. 2014-12-19 15:20:37 +01:00
H.J. Lu 9cd4d4abdc Compile s_llround.c with -Wno-error for x32 build
Since x32 returns 32-bit long int and 64-bit long long int in the
same 64-bit register, we make the 32b-bit lround an alias of the
64-bit llround.  Add -Wno-error for x32 build to silence the compiler.
2014-12-19 05:39:34 -08:00
H.J. Lu c9c1a2d02c Replace 1L with (mp_limb_t) 1
X86-64 and x32 use sysdeps/i386/ldbl2mpn.c.  res_ptr is a pointer
to mp_limb_t, which is long for i386 and x86-64 and long long for
x32.  On x32, I got

../sysdeps/x86_64/../i386/ldbl2mpn.c: In function ‘__mpn_extract_long_double’:
../sysdeps/x86_64/../i386/ldbl2mpn.c:72:4: error: left shift count >= width of type [-Werror]
    res_ptr[N - 1] &= ~(1L << ((LDBL_MANT_DIG - 1) % BITS_PER_MP_LIMB));
    ^
cc1: all warnings being treated as errors

This patch replaces 1L with (mp_limb_t) 1.  Verified on x32, i686 and
x86-64 with GCC 4.8.3.
2014-12-19 05:32:39 -08:00
Roland McGrath dd6904541f NPTL: Move fork state variables to initializer files. 2014-12-17 14:33:28 -08:00
Roland McGrath 74eb826cff NPTL: Remove gratuitous Linuxisms from gai_misc.h. 2014-12-17 14:07:18 -08:00
Roland McGrath c9ce306b9c Fix stub __if_freenameindex build error. 2014-12-17 13:22:41 -08:00
Roland McGrath af102d9529 Remove explicit inline on malloc perturb functions. 2014-12-17 10:41:28 -08:00
Joseph Myers ea41469b7a Fix profil_counter namespace (bug 17725).
On ARM, where profil_counter is not static, it is brought in by
references to various standard functions, as noted in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00890.html>, although
it is not a standard function itself.  I don't know if this also
causes test failures on SPARC, although I see no reason for it not to
do so.

This patch fixes this namespace issue.  profil_counter is renamed to
__profil_counter and made a weak alias on ARM and SPARC.  Because of
the uses in profil.c / sprofil.c it seems simplest to make the rename
globally, including on the other architectures for which
profil_counter was static and so the change is of no substance.  The
variant names profil_counter_* used in sprofil.c are also renamed to
start with __ so that undesired function names do not get exported in
static libc.

As I noted in bug 17726, profil_counter should probably be a compat
symbol on ARM and SPARC, so it wouldn't exist at all in static libc
even as a weak alias.  Since defining a compat symbol still requires
an internal name as a target of an alias, this patch still seems
reasonable as an intermediate step towards that goal: it wouldn't be
possible for the function simply to be static profil_counter on ARM
and SPARC with profil_counter also being the exported compat symbol
name, so profil.c / sprofil.c would still need to be prepared to call
the function under another name (here, __profil_counter).

Tested for x86_64 (testsuite, and that stripped installed shared
libraries are unchanged by the patch) and ARM (ABI and linknamespace
tests - this patch reduces the number of linknamespace failures I see
on ARM from 227 to 5, the residue being math.h failures for fe*
functions and for j0l/j1n/jnl/y0l/y1l/ynl aliases).

2014-12-17  Joseph Myers  <joseph@codesourcery.com>

	[BZ #17725]
	* sysdeps/generic/profil-counter.h (profil_counter): Rename to
	__profil_counter.
	* sysdeps/unix/sysv/linux/hppa/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/i386/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/profil-counter.h
	(profil_counter): Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/profil-counter.h
	(profil_counter): Likewise.
	* sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/profil-counter.h (profil_counter):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/profil-counter.h
	(profil_counter): Likewise.
	* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
	Likewise.
	[!__profil_counter] (profil_counter): Define as weak alias of
	__profil_counter.
	* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h
	(profil_counter): Rename to __profil_counter.
	[!__profil_counter] (profil_counter): Define as weak alias of
	__profil_counter.
	* sysdeps/unix/sysv/linux/sparc/sparc64/profil-counter.h
	(profil_counter): Rename to __profil_counter.
	[!__profil_counter] (profil_counter): Define as weak alias of
	__profil_counter.
	* sysdeps/posix/profil.c: Update comment referring to
	profil_counter.
	(__profil): Use __profil_counter instead of profil_counter.
	* sysdeps/posix/sprofil.c (profil_counter): Rename to
	__profil_counter.  Use __profil_counter_ushort and
	__profil_counter_uint in definitions.
	(__sprofil): Use __profil_counter_uint and __profil_counter_ushort
	instead of profil_counter_uint and profil_counter_ushort.
2014-12-17 18:10:37 +00:00
Joseph Myers 8ac5a76a99 Fix resolver inet_* namespace (bug 17722).
Parts of the resolver brought in by pthreads (at least) use inet_*
functions that aren't in the 1995/6 edition of POSIX that introduced
pthreads (or in one case, use __inet_aton which is then defined in the
same file as non-weak inet_addr).  This patch fixes this by making the
affected functions into weak alias for __inet_* and using those names
in the problematic resolver code.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17722]
	* inet/inet_mkadr.c (inet_makeaddr): Rename to __inet_makeaddr and
	define as weak alias of __inet_makeaddr.
	* resolv/inet_addr.c (inet_addr): Rename to __inet_addr and define
	as weak alias of __inet_addr.
	* resolv/inet_pton.c (inet_pton): Rename to __inet_pton and define
	as weak alias of __inet_pton.  Use libc_hidden_weak.
	* include/arpa/inet.h (__inet_pton): Declare.  Use
	libc_hidden_proto.
	(inet_makeaddr): Don't use libc_hidden_proto.
	(__inet_makeaddr): Declare.  Use libc_hidden_proto.
	* resolv/res_init.c (__res_vinit): Use __inet_pton instead of
	inet_pton.  Use __inet_makeaddr instead of inet_makeaddr.
	* conform/Makefile (test-xfail-POSIX/pthread.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX/sched.h/linknamespace): Likewise.
	(test-xfail-POSIX/time.h/linknamespace): Likewise.
2014-12-17 18:09:11 +00:00
Steve Ellcey 66ce3cb12f 2014-12-17 Steve Ellcey <sellcey@imgtec.com>
* inet/getnetgrent_r.c: Move while loop to be inside if statement.
2014-12-17 10:00:37 -08:00
Stefan Liebler d22ce01bec Get rid of format warning in bug-vfprintf-nargs.c. 2014-12-17 16:43:34 +01:00
Stefan Liebler eca2772b9a Get rid of format warning in tst-widetext.c. 2014-12-17 16:42:51 +01:00
Andreas Schwab bdf079da36 Fix printf format error 2014-12-17 15:23:48 +01:00
Roland McGrath 3eb5d2fc71 Use PTR_MANGLE on libgcc unwinder function pointers. 2014-12-16 15:47:53 -08:00
Roland McGrath f0481d971e Revert "Use pragmas rather than makefiles for necessary options for unwind code."
This reverts commit c324fcfe75.
2014-12-16 15:46:00 -08:00
Roland McGrath c324fcfe75 Use pragmas rather than makefiles for necessary options for unwind code. 2014-12-16 14:31:24 -08:00
Joseph Myers 380292ba8b Fix x86_64 memrchr namespace (bug 17719).
On x86_64, memrchr (not a standard function) is defined as a strong
symbol, instead of a weak alias of __memrchr as on other
architectures.  This results in linknamespace test failures from the
use of __memrchr from dirname.  (Not a conformance issue because of
the mem* reservation, but contrary to glibc conventions.)  This patch
makes x86_64 follow other architectures by defining memrchr as a weak
alias.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17719]
	* sysdeps/x86_64/memrchr.S (memrchr): Rename to __memrchr and
	define as weak alias of __memrchr.
	(__memrchr): Do not define as strong alias of memrchr.
	* conform/Makefile (test-xfail-XPG4/libgen.h/linknamespace):
	Remove variable.
	(test-xfail-UNIX98/libgen.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/libgen.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/libgen.h/linknamespace): Likewise.
2014-12-16 18:31:31 +00:00
Joseph Myers 9a44d530c4 Fix resolver if_* namespace (bug 17717).
Resolver code, brought in by pthreads (at least), uses if_* interfaces
that weren't in POSIX before 2001, resulting in linknamespace
failures.  This patch changes those interfaces to be weak aliases of
__if_* and makes the resolver use __if_* directly.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

	[BZ #17717]
	* inet/if_index.c (if_nametoindex): Rename to __if_nametoindex and
	define as weak alias of __if_nametoindex.  Use libc_hidden_weak.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.
	* sysdeps/mach/hurd/if_index.c (if_nametoindex): Rename to
	__if_nametoindex and define as weak alias of __if_nametoindex.
	Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/if_index.c (if_nametoindex): Rename to
	__if_nametoindex and define as weak alias of __if_nametoindex.
	Use libc_hidden_weak.
	(if_freenameindex): Rename to __if_freenameindex and define as
	weak alias of __if_freenameindex.  Use libc_hidden_weak.
	(if_nameindex_netlink): Use __if_freenameindex instead of
	if_freenameindex.
	(if_nameindex): Rename to __if_nameindex and define as weak alias
	of __if_nameindex.  Use libc_hidden_weak.
	(if_indextoname): Rename to __if_indextoname and define as weak
	alias of __if_indextoname.  Use libc_hidden_weak.
	* include/net/if.h [!_ISOMAC] (__if_nametoindex): Declare and use
	libc_hidden_proto.
	[!_ISOMAC] (__if_freenameindex): Likewise.
	* resolv/res_init.c (__res_vinit): Use __if_nametoindex instead of
	if_nametoindex.
	* conform/Makefile (test-xfail-XPG4/grp.h/linknamespace): Remove
	variable.
	(test-xfail-XPG4/pwd.h/linknamespace): Likewise.
	(test-xfail-UNIX98/aio.h/linknamespace): Likewise.
	(test-xfail-UNIX98/grp.h/linknamespace): Likewise.
	(test-xfail-UNIX98/pthread.h/linknamespace): Likewise.
	(test-xfail-UNIX98/pwd.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sched.h/linknamespace): Likewise.
	(test-xfail-UNIX98/time.h/linknamespace): Likewise.
2014-12-16 18:18:49 +00:00
Joseph Myers d003ada20e Remove some semaphore.h linknamespace XFAILs.
Roland's recent sem_* changes introduced some XPASSes for semaphore.h
linknamespace tests by removing a non-static variable "mountpoint".
This patch removes the XFAILs for the fixed bug.

Tested for x86_64.

	* conform/Makefile (test-xfail-UNIX98/semaphore.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/semaphore.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/semaphore.h/linknamespace): Likewise.
2014-12-16 16:25:08 +00:00
Siddhesh Poyarekar 0cd8552045 Fix the 'array subscript is above array bounds' warning correctly
Use DIAG_IGNORE_NEEDS_COMMENT instead since the compiler should have
seen that NS never goes beyond MAXNS.
2014-12-16 19:40:47 +05:30
Siddhesh Poyarekar a0d424ef9d Fix 'array subscript is above array bounds' warning in res_send.c
I see this warning in my build on F21 x86_64, which seems to be due to
a weak check for array bounds.  Fixed by making the bounds check
stronger.

This is not an actual bug since nscount is never set to anything
greater than MAXNS.  The compiler however does not know this, so we
need the stronger bounds check to quieten the compiler.
2014-12-16 16:55:23 +05:30
Arjun Shankar 8b460906cd Modify libio/tst-fopenloc.c to use test-skeleton.c
This test would earlier fail when run under test-skeleton.c due to
bug #17522 in 'fputws'. That bug is now fixed and so this test may
be modified.
2014-12-16 16:55:23 +05:30
Arjun Shankar fa13e15b9a Modify stdlib/tst-bsearch.c to use test-skeleton.c
This test used to define a 'struct entry' that conflicts with the
definition in search.h included in test-skeleton. The struct is
now renamed 'item'.
2014-12-16 16:55:23 +05:30
Arjun Shankar 0e426475a7 Modify stdio-common/tst-fseek.c to use test-skeleton.c
This test needs a TIMEOUT longer than the default 2 seconds since it
sleeps twice for a second each.
2014-12-16 16:55:22 +05:30
Torvald Riegel 4f646bce1c Ignore warning in string/tester.c. 2014-12-16 10:32:07 +01:00
Torvald Riegel a07c442711 Fix warning in misc/tst-mntent2.c. 2014-12-16 10:27:16 +01:00
Torvald Riegel 1469f46696 Fix warning in elf/tst-unique4lib.cc. 2014-12-16 10:26:48 +01:00
Florian Weimer 11e3417af6 Avoid infinite loop in nss_dns getnetbyname [BZ #17630] 2014-12-16 10:08:29 +01:00
Allan McRae ae61fc7b33 stdio-common/Makefile: readd bug26 testcase
This testcase was accidentally removed in commit a5357b7c.
2014-12-16 13:20:25 +10:00
Ondřej Bílka 363a989918 Return allocated array instead of unallocated.
In locale/programs/ld-ctype.c we returned array that was on stack.
Fixed by returning static array instead.
2014-12-16 00:09:50 +01:00
Torvald Riegel d52c62df3d Add comments for the generic lowlevellock implementation.
Patch by Bernard Ogden <bernie.ogden@linaro.org>.
2014-12-15 22:49:29 +01:00
Torvald Riegel 045a6bcdd2 Fix nptl/tst-sem4: always start with a fresh semaphore. 2014-12-15 22:14:33 +01:00
Torvald Riegel 7f786dc12b Fix nptl/tst-mutex5.c: Do not skip tests if elision is enabled. 2014-12-15 22:14:32 +01:00
Adhemerval Zanella e7e21cba12 stdio-common: Include <libc-internal.h> in some tests
This patch adds the missing libc-internal.h include on test-vprintf.c
tst-sprintf.c.
2014-12-15 11:29:09 -06:00
Torvald Riegel bc89c0fc70 Remove custom pthread_once implementation on s390. 2014-12-15 10:52:12 +01:00
Jeff Law a5357b7ce2 CVE-2012-3406: Stack overflow in vfprintf [BZ #16617]
A larger number of format specifiers coudld cause a stack overflow,
potentially allowing to bypass _FORTIFY_SOURCE format string
protection.
2014-12-15 10:09:33 +01:00
Will Newton 3a12c70f13 Bump required version of texinfo to 4.7
It seems we require texinfo 4.7 for the --plaintext option, so
document that and check for the correct version in configure.

ChangeLog:

2014-12-15  Will Newton  <will.newton@linaro.org>

	* manual/install.texi: Bump required version of texinfo
	to 4.7 from 4.5.
	* INSTALL: Regenerated.
	* configure.ac: Check for makeinfo version 4.7 and above.
	* configure: Regenerated.
2014-12-15 08:59:31 +00:00
Roland McGrath e4f639e4a1 NPTL: Refactor named semaphore code to use shm-directory.h 2014-12-12 15:01:30 -08:00
Roland McGrath c76d1ff514 NPTL: Add stubs for Linux-only extension functions. 2014-12-12 14:52:14 -08:00
Roland McGrath 439c43f6ea Fix NPTL build for !__ASSUME_SET_ROBUST_LIST case. 2014-12-12 14:00:37 -08:00
Stefan Liebler 48e435cd93 resolv: Suppress maybe uninitialized warning
In send_vc function at resolv/res_send.c, There is the
following warning on some architectures:

  'resplen' may be used uninitialized in this function
  [-Wmaybe-uninitialized]

And this is a false positive.  This patch suppress the
compiler warning.
2014-12-12 16:30:12 -05:00
Stefan Liebler 9d9c0019e7 Get rid of warning comparision will always evaluate as true 2014-12-12 11:14:00 +01:00
James Lemke 9173840b4d Fix for test "malloc_usable_size: expected 7 but got 11"
[BZ #17581] Revert this fix while investigating a problem.
2014-12-11 16:48:29 -08:00
Roland McGrath 78e21c5df6 Refactor shm_{open,unlink} code to separate Linux-specific directory choice from POSIX-generic code. 2014-12-11 16:19:11 -08:00
Kaz Kojima f82c43af8a * Fix SH specific compiler warnings which are for integer-pointer
type conversions without cast.
2014-12-12 08:07:35 +09:00
Joseph Myers fc00cf7bcd Move semaphore.h to sysdeps/pthread/.
Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch moves nptl/semaphore.h to sysdeps/pthread/semaphore.h so
that it can be found by builds from all glibc subdirectories; it's not
in any way NPTL-specific.  (I left the Makefile setting to install
this header in nptl/, but maybe it should move as well - it's just not
clear to me what ifeq ($(subdir),...) conditional should be used to
select the directory to associate the header with for installation
purposes.  The path in the toplevel Makefile used for begin-end-check
also remains hardcoded; it's a known todo issue to rework that test to
run in each subdirectory checking the headers installed from that
subdirectory, rather than a separate hardcoded list.)

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

	* nptl/semaphore.h: Move to ...
	* sysdeps/pthread/semaphore.h: ... here.
	* Makefile (installed-headers): Change nptl/semaphore.h to
	sysdeps/pthread/semaphore.h.
2014-12-11 22:58:48 +00:00
Roland McGrath 73b0c1a19c Suppress -Wformat-security in tst-error1.c. 2014-12-11 13:52:57 -08:00
Roland McGrath 1c4053db63 Eliminate -Wno-format from printf/scanf tests. 2014-12-11 13:47:44 -08:00
Joseph Myers a1edbf3cb8 Add more headers to include/ for conform tests.
Carlos reported failures in conform/ tests in environments where the
compiler used could only find headers in glibc's source and build
trees, not any previously installed headers
<https://sourceware.org/ml/libc-alpha/2014-09/msg00040.html>.

This patch adds wrappers for two of the affected headers to include/,
which is the normal way to make headers visible when building or
testing in directories other than the one containing the header (I
suppose these headers weren't needed in any such directories except
conform/, or other build or test failures would have resulted).  I
believe the same issue applies at least to regexp.h and re_comp.h - we
don't currently have conform/ expectations for those, but when such
expectations are added we'll also need to add header wrappers.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).  I did *not* test a
configuration such as that in which Carlos saw failure.

	* include/cpio.h: New file.
	* include/fmtmsg.h: Likewise.
2014-12-11 21:41:30 +00:00
Joseph Myers 47d51f4f07 Clean up localedata tests printf formats, don't use -Wno-format. 2014-12-11 13:15:08 -08:00
Roland McGrath e9813cfb3d Fix -Wformat-security warnings in posix/regexbug1.c 2014-12-11 13:08:26 -08:00
Chris Metcalf f627ca82fb tile: add inhibit_loop_to_libcall to string functions
Without this, on gcc 4.8.2 the built glibc crashes when memcpy
or memset are invoked, since they call themselves recursively.
See commit 85c2e6110c for the generic inhibit_loop_to_libcall.
2014-12-11 15:13:48 -05:00
Adhemerval Zanella 7f29694236 Fix __sendmmsg prototype guards
Add __USE_GNU guards on 'socket/sys/socket.h' __sendmmsg prototype.
2014-12-11 14:55:44 -05:00
Steve Ellcey d0276e18f3 * sysdeps/mips/dl-trampoline.c: Modify switch expression to have
integer value instead of boolean.
2014-12-11 10:23:01 -08:00
Steve Ellcey fc56e97093 2014-12-11 Steve Ellcey <sellcey@imgtec.com>
* malloc/malloc.c: Fix powerof2 check.
2014-12-11 08:14:17 -08:00
Stefan Liebler 40e53917ea Get rid of warning inlining failed in call to maybe_swap_uint32 2014-12-11 17:04:40 +01:00
Stefan Liebler 1ea166df67 S/390: Get rid of assembler warning value truncated. 2014-12-11 17:02:24 +01:00
Andreas Schwab acf869f4bc Constify string parameters 2014-12-11 16:43:28 +01:00
Adhemerval Zanella 9d96909913 powerpc: Fix lgammal_r overflow warnings
ldbl-128ibm uses ldbl-128 e_lgammal_r implementation as is, however some
constants definitions overflows for IBM long double range.  This patch
suppress the compiler warnings until the ldbl-128ibm implementation is
fixed.
2014-12-11 07:17:11 -05:00
Andreas Schwab b0a3c1640a Properly handle forced elision in pthread_mutex_trylock (bug 16657) 2014-12-11 12:44:27 +01:00
Andreas Schwab da5bcaa499 Remove duplication from gconv-modules 2014-12-11 12:35:58 +01:00
Will Newton 6d24885784 intl: Merge with gettext version 0.19.3
This patch merges the latest release of gettext into the intl
subdirectory. The initial motivation was to include the plural.y
changes which enable building with bison 3.0, but the majority
of the other changes are merely cosmetic so it seemed like merging
the whole directory was simpler than trying to take it piecemeal.

The merge was done by copying across the latext gettext code and
adding in a few small glibc changes that have been added over the
years that seemed beneficial, as well as a couple of small build
fixes that should be merged back to gettext. I also reverted the
gettext commit:

commit 279b57fc367251666f00e8e2b599b83703451afb
Author: Bruno Haible <bruno@clisp.org>
Date:   Fri Jun 14 12:03:49 2002 +0000

    Make absolute pathnames inside $LANGUAGE work.

As it caused localedata/tst-setlocale3 to fail and it wasn't clear
that glibc wanted that behaviour.

The merge has dropped many uses of __glibc_likely/unlikely. This is
intentional given that it eases merging. It seems to me that the cost
of continually rewriting these lines when merging and the risk of adding
bugs when doing so outweighs the benefits of using these macros when
code is shared with another project.

Tested with make check on x86_64.

ChangeLog:

2014-12-11  Will Newton  <will.newton@linaro.org>

	Merge gettext 0.19.3 into intl/.

	This involves a number of cosmetic changes to comments
	and ANSI function definitions and prototypes throughout
	all the files. The gettext copyright header is used but
	with the date ranges taken from the glibc copy.

	* NEWS: Add gettext merge to 2.21.
	* intl/bindtextdom.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	Use gl_* locking primitives rather than __libc_* ones.
	Use __builtin_expect rather than __glibc_likely/unlikely.
	* intl/dcgettext.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	* intl/dcigettext.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(INTDIV0_RAISES_SIGFPE): New define.
	Use gl_* locking primitives rather than __libc_* ones.
	Include eval-plural.h instead of plural-eval.c.
	Use __builtin_expect rather than __glibc_likely/unlikely.
	* intl/dcngettext.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	* intl/dgettext.c: Likewise.
	* intl/dngettext.c: Likewise.
	* intl/plural-eval.c: Renamed to...
	* intl/eval-plural.h: ...this.
	* intl/explodename.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(_nl_explode_name): Use strchr instead of __rawmemchr.
	* intl/finddomain.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	Use gl_* locking primitives rather than __libc_* ones.
	(_nl_find_domain): Use malloc rather than alloca for
	allocation of temporary locale name.
	* intl/gettext.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	* intl/gettextP.h: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	Use gl_* locking primitives rather than __libc_* ones.
	* intl/gmo.h: Switch to gettext copyright.
	(struct sysdep_string): Move struct segment_pair outside of
	struct definition.
	* intl/hash-string.c: Use ANSI definitions and prototypes.
	* intl/hash-string.h: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	* intl/l10nflist.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(_nl_normalize_codeset): Avoid integer overflow.
	* intl/loadinfo.h: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(LIBINTL_DLL_EXPORTED): New define.
	(PATH_SEPARATOR): New define.
	* intl/loadmsgcat.c: Switch to gettext copyright.
	* intl/localealias.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(_nl_expand_alias): Use PATH_SEPARATOR.
	* intl/ngettext.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	* intl/plural-exp.c: Likewise.
	* intl/plural-exp.h: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	(struct expression): Move definition of enum operator outside
	of struct definition.
	* intl/plural.c: Regenerate.
	* intl/plural.y: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	Port to bison 3.0.
	* intl/textdomain.c: Switch to gettext copyright.
	Use ANSI definitions and prototypes.
	Use gl_* locking primitives rather than __libc_* ones.
2014-12-11 09:54:49 +00:00
Steve Ellcey 48c43298bf 2014-12-10 Steve Ellcey <sellcey@imgtec.com>
* debug/warning-nop.c: Add used atrribute.
2014-12-10 13:46:28 -08:00
Joseph Myers c153ac9f1b Fix MIPS waitid build.
As previously discussed in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, MIPS (o32)
waitid has build warnings (now errors) because a function is declared
inline but functions with five-argument syscalls cannot be inlined for
MIPS o32.

This patch disables the -Winline warnings for waitid.c using a
MIPS-specific wrapper file.  As it's whole-file disabling, there's no
point in using push and pop, so just DIAG_IGNORE_NEEDS_COMMENT is
used.

	* sysdeps/unix/sysv/linux/mips/mips32/waitid.c: New file.
2014-12-10 18:50:07 +00:00
Joseph Myers 2b89bce91e Fix MIPS sigaction build.
Building MIPS sigaction (for ABIs other than o32) fails because of
"'restore_rt' used but never defined", arising from static functions
being defined in asms and referred to from C code.  There is no
corresponding -W option for that warning, so this patch uses
-Wno-error for building sigaction.c.

	* sysdeps/unix/sysv/linux/mips/mips64/Makefile
	[$(subdir) == signal] (CFLAGS-sigaction.c): New variable.
	[$(subdir) == nptl] (CFLAGS-sigaction.c): Likewise.
2014-12-10 18:45:03 +00:00
Ondřej Bílka 07008f7d6a Fix typo in changelog. 2014-12-10 19:20:57 +01:00
Joseph Myers 2cfbdb9a27 Fix strftime wcschr namespace (bug 17634).
Use of strftime, a C90 function, ends up bringing in wcschr, which is
not a C90 function.  Although not a conformance bug (C90 reserves
wcs*), this is still contrary to glibc practice of avoiding relying on
those reservations; this patch arranges for the internal uses to use
__wcschr instead, with wcschr being a weak alias.  This is more
complicated than some such patches because of the various IFUNC
definitions of wcschr (which include code redefining libc_hidden_def
in a way that involves creating __GI_wcschr manually and so also needs
to create __GI___wcschr after the change of internal uses to use
__wcschr).

Tested for x86_64 and 32-bit x86 (testsuite, and that disassembly of
installed shared libraries is unchanged by the patch).

2014-12-10  Joseph Myers  <joseph@codesourcery.com>
	    Adhemerval Zanella  <azanella@linux.vnet.ibm.com>

	[BZ #17634]
	* wcsmbs/wcschr.c [!WCSCHR] (wcschr): Define as __wcschr.
	Undefine after defining function.  Define as weak alias of
	__wcschr.  Use libc_hidden_weak.
	* include/wchar.h (__wcschr): Declare.  Use libc_hidden_proto.
	* sysdeps/i386/i686/multiarch/wcschr-c.c [IS_IN (libc) && SHARED]
	(libc_hidden_def): Also define __GI___wcschr alias.
	* sysdeps/i386/i686/multiarch/wcschr.S (wcschr): Rename to
	__wcschr and define as weak alias of __wcschr.
	* sysdeps/powerpc/power6/wcschr.c [!WCSCHR] (WCSCHR): Define as
	__wcschr.
	[!WCSCHR] (DEFAULT_WCSCHR): Define.
	[DEFAULT_WCSCHR] (__wcschr): Use libc_hidden_def.
	[DEFAULT_WCSCHR] (wcschr): Define as weak alias of __wcschr.  Use
	libc_hidden_weak.  Do not use libc_hidden_def.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
	[IS_IN (libc) && SHARED] (libc_hidden_def): Also define
	__GI___wcschr alias.
	* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
	[IS_IN (libc)] (wcschr): Define as macro expanding to
	__redirect_wcschr.
	[IS_IN (libc)] (__wcschr_ppc): Use __redirect_wcschr in typeof.
	[IS_IN (libc)] (__wcschr_power6): Likewise.
	[IS_IN (libc)] (__wcschr_power7): Likewise.
	[IS_IN (libc)] (__libc_wcschr): New.  Define with libc_ifunc
	instead of wcschr.
	[IS_IN (libc)] (wcschr): Undefine and define as weak alias of
	__libc_wcschr.
	[!IS_IN (libc)] (libc_hidden_def): Do not undefine and redefine.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c (wcschr): Rename to
	__wcschr and define as weak alias of __wcschr.  Use
	libc_hidden_builtin_def.
	* sysdeps/x86_64/wcschr.S (wcschr): Rename to __wcschr and define
	as weak alias of __wcschr.  Use libc_hidden_weak.
	* time/alt_digit.c (_nl_get_walt_digit): Use __wcschr instead of
	wcschr.
	* time/era.c (_nl_init_era_entries): Likewise.
	* conform/Makefile (test-xfail-ISO/time.h/linknamespace): Remove
	variable.
	(test-xfail-XPG3/time.h/linknamespace): Likewise.
	(test-xfail-XPG4/time.h/linknamespace): Likewise.
2014-12-10 16:59:02 +00:00
Joseph Myers 1b8bf35181 Fix tst-ftell-active-handler.c warning.
A recent change to libio/tst-ftell-active-handler.c (postdating my
last check for warnings on x86) introduced a format warning from a
long int variable used with a %zu format.  This patch fixes it by
using %ld for the format to match the variable.

Tested for x86.

	* libio/tst-ftell-active-handler.c (do_ftruncate_test): Use %ld
	format for long int variable.
2014-12-10 16:03:23 +00:00
Anders Kaseorg f5f46d51f7 manual: Remove incorrect claim that qsort() can be stabilized
Under certain conditions on the size of the array and its items,
qsort() may fall back to an in-place quicksort if it cannot allocate
memory for a temporary array with malloc().  This algorithm is not a
stable sort even if the comparison function is written in the
described manner.

Fixes #10672.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2014-12-10 16:24:44 +01:00
Andreas Schwab 217a74a85c Don't touch user-controlled stdio locks in forked child (bug 12847)
The stdio locks for streams with the _IO_USER_LOCK flag should not be
touched by internal code.
2014-12-10 15:58:22 +01:00
Richard Earnshaw aa76a5c701 [AArch64] Fix strchrnul clobbering v15 2014-12-10 09:54:09 +00:00
Joseph Myers a4ecc9eb9b Use -Werror by default, add --disable-werror.
As discussed starting at
<https://sourceware.org/ml/libc-alpha/2014-11/msg00323.html>, this
patch makes the glibc build use -Werror by default to avoid
accidentally adding new warnings to the build.  The configure option
--disable-werror can be used to disable this.

-Wno-error=undef is temporarily used because the build isn't clean
regarding -Wundef warnings.  The idea is that once the remaining
-Wundef warnings have been cleaned up (in at least one configuration),
-Wno-error=undef will be removed.

I get a clean build and test on x86_64 (GCC 4.9 branch) with this
patch.  The expectation is that this may well break the build for some
other configurations, and people seeing such breakage should make
appropriate fixes to fix or suppress the warnings for their
configurations.  In some cases that may involve using pragmas as the
right fix (I think that will be right for the -Wno-inline issue for
MIPS I referred to in
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, for
example), in some cases -Wno-error in sysdeps makefiles (__restore_rt
in MIPS sigaction, for example), in some cases substantive fixes for
the warnings.

Note that if, with a view to listing all the warnings then fixing them
all, you just look for "warning:" in output from building and testing
with --disable-werror, you'll see lots of warnings from the linker
about functions such as tmpnam.  Those warnings can be ignored - only
compiler warnings are relevant to -Werror, not linker warnings.

	* configure.ac (--disable-werror): New configure option.
	(enable_werror): New AC_SUBST.
	* configure: Regenerated.
	* config.make.in (enable-werror): New variable.
	* Makeconfig [$(enable-werror) = yes] (+gccwarn): Add -Werror
	-Wno-error=undef.
	(+gccwarn-c): Do not use -Werror=implicit-function-declaration.
	* manual/install.texi (Configuring and compiling): Document
	--disable-werror.
	* INSTALL: Regenerated.
	* debug/Makefile (CFLAGS-tst-chk1.c): Add -Wno-error.
	(CFLAGS-tst-chk2.c): Likewise.
	(CFLAGS-tst-chk3.c): Likewise.
	(CFLAGS-tst-chk4.cc): Likewise.
	(CFLAGS-tst-chk5.cc): Likewise.
	(CFLAGS-tst-chk6.cc): Likewise.
	(CFLAGS-tst-lfschk1.c): Likewise.
	(CFLAGS-tst-lfschk2.c): Likewise.
	(CFLAGS-tst-lfschk3.c): Likewise.
	(CFLAGS-tst-lfschk4.cc): Likewise.
	(CFLAGS-tst-lfschk5.cc): Likewise.
	(CFLAGS-tst-lfschk6.cc): Likewise.
2014-12-10 01:14:48 +00:00
Joseph Myers 0f88636c09 Disable -Wdeprecated-declarations for register_printf_function calls in tst-printfsz.c.
This patch uses diagnostic control pragmas to disable warnings in
stdio-common/tst-printfsz.c for use of the deprecated
register_printf_function.  Because this test is testing printf_size
and printf_size_info, and the latter has the interface expected for
register_printf_function instead of the newer
register_printf_specifier, it seems correct for this test to use the
deprecated interface (wrapping printf_size_info in some way to use
register_printf_specifier would seem an excessive change to what's
tested).

Tested for x86_64.

	* stdio-common/tst-printfsz.c: Include <libc-internal.h>.
	(main): Disable -Wdeprecated-declarations around calls to
	register_printf_function.
2014-12-10 00:44:54 +00:00
Joseph Myers c81e9deba2 Disable -Wdiv-by-zero for some tests in stdio-common/tst-unlockedio.c.
This patch uses diagnostic control pragmas to disable some
division-by-zero warnings in stdio-common/tst-unlockedio.c.  This is
another test where disabling warnings using diagnostic pragmas seems
appropriate (the warnings are not wildly inappropriate for what the
test deliberately does; the deliberate use of unusual arguments to the
macros being tested means that changing the arguments in a way that
avoids the warning would also unduly perturb what is being tested).

Tested for x86_64.

	* stdio-common/tst-unlockedio.c: Include <libc-internal.h>.
	(do_test): Disable -Wdiv-by-zero around some calls to
	fwrite_unlocked and fread_unlocked.
2014-12-10 00:43:36 +00:00
Joseph Myers 2084e7ca4d Add macros for diagnostic control, use for scanf %a tests.
In <https://sourceware.org/ml/libc-alpha/2014-11/msg00326.html>,
Roland requested internal macros for use of "#pragma GCC diagnostic".

This patch adds such macros and uses them to disable -Wformat warnings
for some code testing GNU scanf %as where GCC expects C99 scanf %a
(several other stdio tests currently use -Wno-format to disable
warnings).  Limitations in GCC's diagnostic pragmas require separate
macros before and after the code generating the warnings, rather than
a single macro taking that code as an argument.

The macros are named DIAG_*_NEEDS_COMMENT to emphasise to reviewers
the need for a comment accompanying any use of them (such comments may
however just appear once for several uses of the macros for the same
issue in the same file).  I put a GCC version in the arguments to
DIAG_IGNORE_NEEDS_COMMENT, as that seems something useful to grep for
when obsoleting support for an old GCC version and needing to decide
if warning-disabling code is still relevant.

These macros should be usable for replacing existing -Wno-* use in
makefiles (as also suggested by Roland), though I have no plans to
work on that (only on use of the macros in cases where warnings are
currently present that need disabling to use -Werror).

Tested for x86_64.

	* include/libc-internal.h (DIAG_PUSH_NEEDS_COMMENT): New macro.
	(DIAG_POP_NEEDS_COMMENT): Likewise.
	(_DIAG_STR1): Likewise.
	(_DIAG_STR): Likewise.
	(DIAG_IGNORE_NEEDS_COMMENT): Likewise.
	* stdio-common/bug21.c: Include <libc-internal.h>.
	(do_test): Disable -Wformat around call to sscanf.
	* stdio-common/scanf14.c: Include <libc-internal.h>.
	(main): Disable -Wformat around some calls to scanf functions.
2014-12-10 00:41:19 +00:00
Torvald Riegel df7ecc6bd2 Remove custom pthread_once implementation on sh. 2014-12-09 14:32:29 +01:00
Adhemerval Zanella 2aa3862e86 libio: Fix variable aligment in tst-ftell-active-handler
This patch fixes a stack allocated variable to force it to have wchar_t
alignment.
2014-12-08 07:20:07 -05:00
Joseph Myers c5c2b7c3fd Fix pthreads getrlimit, gettimeofday namespace (bug 17682).
Some pthreads functions use getrlimit and gettimeofday, but these
functions are XSI, not base POSIX; this is a namespace issue for
dynamic linking as well as static linking.  This patch makes them use
__getrlimit and __gettimeofday instead - the former needed to be newly
exported from libc.so at GLIBC_PRIVATE (and so now needs
libc_hidden_proto / libc_hidden_def), the latter was already exported.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).

	[BZ #17682]
	* resource/Versions (libc): Add __getrlimit at GLIBC_PRIVATE.
	* resource/getrlimit.c (__getrlimit): Use libc_hidden_def.
	* sysdeps/mach/hurd/getrlimit.c (__getrlimit): Likewise.
	* include/sys/resource.h (__getrlimit): Use libc_hidden_proto.
	* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Use
	__getrlimit instead of getrlimit.
	* nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait): Use
	__gettimeofday instead of gettimeofday.
	* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
	Likewise.
	* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
	Likewise.
	* sysdeps/pthread/aio_misc.c (handle_fildes_io): Likewise.
	* conform/Makefile (test-xfail-POSIX2008/aio.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/pthread.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/time.h/linknamespace): Likewise.
2014-12-06 23:40:48 +00:00
Adhemerval Zanella 9752c3cdbc libio: Fix buffer overrun in tst-ftell-active-handler
On 'do_ftell_test' the code:

365           if (test_modes[i].fd_mode != O_WRONLY)
366             {
367               char tmpbuf[data_len];
368
369               rewind (fp);
370
371               while (fgets_func (tmpbuf, sizeof (tmpbuf), fp) && !feof (fp));

The 'data_len' is calculated with wsclen and allocated as 'char'.  The
subsequent fgetws will then try to write at most 'data_len' wchar_t
in a buffer with just data_len 'char'.  This patch fixes it by
allocating the tmpbuf using 'wchar_t' * data_len bytes.
2014-12-05 07:41:22 -05:00
Roland McGrath 4bee4cd959 De-warning a few stubs. 2014-12-04 12:31:38 -08:00
Joseph Myers 84dbedb608 Fix linknamespace h_errno handling.
Some linknamespace tests were failing because of references to
h_errno.  References to this symbol should be allowed for XPG4, UNIX98
and XOPEN2K; this patch adds it to the list of allowed data symbols
for those standards.  (h_errno was removed in the 2008 edition of
POSIX, so POSIX2008 and XOPEN2K8 references to it are genuine bugs;
fortunately it's not a public data symbol - __h_errno_location is
public, TLS h_errno is GLIBC_PRIVATE - so the symbol can simply be
renamed to __h_errno to fix those bugs without the ABI complications
normally associated with namespace issues for data symbols.)

Tested for x86_64.

	* conform/list-header-symbols.pl (%extra_syms): Add h_errno for
	XPG4, UNIX98 and XOPEN2K.
	* conform/Makefile (test-xfail-XOPEN2K/grp.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/pwd.h/linknamespace): Likewise.
2014-12-04 17:12:46 +00:00
Siddhesh Poyarekar af50dfc10a Fix another typo in the ChangeLog 2014-12-04 16:15:46 +05:30
Siddhesh Poyarekar b7a3e1c4dc Fix date in ChangeLog 2014-12-04 08:59:27 +05:30
Siddhesh Poyarekar 24b9788285 Fix up function definition style
Don't use K&R style for function definitions.
2014-12-04 08:45:55 +05:30
Siddhesh Poyarekar fe8b4d98e9 Reset cached offset when reading to end of stream (BZ #17653)
POSIX allows applications to switch file handles when a read results
in an end of file.  Unset the cached offset at this point so that it
is queried again.
2014-12-04 08:13:28 +05:30
Siddhesh Poyarekar 61b4f792e0 tst-ftell-active-handler: Open file with O_TRUNC for w modes
The test case fails to truncate the file when a file is intended to be
opened in w or w+ mode.  Add O_TRUNC to fix this.  The test still
succeeds with this change.
2014-12-04 08:11:07 +05:30
Siddhesh Poyarekar be349d7042 ftell: seek to end only when there are unflushed bytes (BZ #17647)
Currently we seek to end of file if there are unflushed writes or the
stream is in write mode, to get the current offset for writing in
append mode, which is the end of file.  The latter case (i.e. stream
is in write mode, but no unflushed writes) is unnecessary since it
will only happen when the stream has just been flushed, in which case
the recorded offset ought to be reliable.

Removing that case lets ftell give the correct offset when it follows
an ftruncate.  The latter truncates the file, but does not change the
file position, due to which it is permissible to call ftell without an
intervening fseek call.

Tested on x86_64 to verify that the added test case fails without the
patch and succeeds with it, and that there are no additional
regressions due to it.

	[BZ #17647]
	* libio/fileops.c (do_ftell): Seek only when there are
	unflushed writes.
	* libio/wfileops.c (do_ftell_wide): Likewise.
	* libio/tst-ftell-active-handler.c (do_ftruncate_test): New
	test case.
	(do_one_test): Call it.
2014-12-04 08:08:37 +05:30
Joseph Myers e3d6dba5df Fix linknamespace getdate_err handling.
Some linknamespace tests were failing because of references to
getdate_err.  References to this symbol should be allowed for XPG4 and
later XSI standards; it was missing from the whitelist of data
symbols.  This patch adds it to that list.

Tested for x86_64.

	* conform/list-header-symbols.pl (%extra_syms): Add getdate_err
	for XPG4, UNIX98, XOPEN2K and XOPEN2K8.
	* conform/Makefile (test-xfail-XOPEN2K/pthread.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K/time.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/pthread.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/time.h/linknamespace): Likewise.
2014-12-03 15:21:28 +00:00
Joseph Myers 28a91e8f65 Remove some linknamespace test XFAILs.
It seems two of the XFAILed linknamespace tests were completely fixed
by some of my recent namespace fixes in combination (although not by
any individual one of those fixes relative to the sources used for
testing each patch, or that individual fix would also have removed the
XFAIL in question).  This patch removes those XFAILs that are no
longer needed.

Tested for x86_64.

	* conform/Makefile (test-xfail-XOPEN2K/aio.h/linknamespace):
	Remove variable.
	(test-xfail-XOPEN2K8/aio.h/linknamespace): Likewise.
2014-12-02 23:38:47 +00:00
Joseph Myers 7f994279e9 Fix getifaddrs, freeifaddrs namespace (bug 17668).
Various objects in glibc bring in ifaddrs.o (via references to
__netlink_*) and thereby getifaddrs and freeifaddrs, which are not
part of any standard supported by glibc.  These should be weak aliases
of __getifaddrs and __freeifaddrs; this patch makes them so.

(The path by which these functions are brought in is Linux-specific,
but it seems less confusing to make all versions of these functions
weak aliases rather than only the Linux-specific versions that
definitely need it.)

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

	[BZ #17668]
	* inet/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define
	as weak alias of __getifaddrs.  Use libc_hidden_weak.
	(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
	__freeifaddrs.  Use libc_hidden_weak.
	* sysdeps/gnu/ifaddrs.c (getifaddrs): Rename to __getifaddrs and
	define as weak alias of __getifaddrs.  Use libc_hidden_weak.
	(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
	__freeifaddrs.  Use libc_hidden_weak.
	* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Rename to
	__getifaddrs and define as weak alias of __getifaddrs.  Use
	libc_hidden_weak.
	(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
	__freeifaddrs.  Use libc_hidden_weak.
	* conform/Makefile (test-xfail-XOPEN2K/net/if.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX2008/net/if.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/net/if.h/linknamespace): Likewise.
2014-12-02 23:11:09 +00:00
Petar Jovanovic bbe4c142b0 mips: Do not use jal to reach __libc_start_main
Since __libc_start_main may not be in the same 256MB-aligned region as
the function __start, replace use of jal instruction with la/jalr.

This fixes linker issue reported in:
https://sourceware.org/bugzilla/show_bug.cgi?id=17601

	[BZ #17601]
	* sysdeps/mips/start.S (__start): Use indirect jump to call
	__libc_start_main.
2014-12-02 23:04:43 +00:00
Joseph Myers 909e16d960 Fix warning in nptl/tst-stack4.c.
This patch fixes a warning in a test that was added since my recent
warning cleanup:

tst-stack4.c: In function 'dso_process':
tst-stack4.c:64:7: warning: format '%i' expects argument of type 'int', but argument 3 has type 'uintptr_t' [-Wformat=]

The original variable has type int then is cast to uintptr_t, and from
there to void *, to pass it to a thread, so reversing the process by
casting to uintptr_t and then to int is natural; this patch does so.

Tested for x86_64.

	* nptl/tst-stack4.c (dso_process): Use int not uintptr_t for t.
2014-12-02 22:48:59 +00:00
Joseph Myers 4e0b901601 Fix -Waddress warnings in nptl/tst-mutex1.c.
This patch fixes -Waddress warnings in nptl/tst-mutex1.c from
comparing the address of an object with NULL (ATTR may either be NULL,
or the address of an object when included from other tests, and the
warning arises in the latter case).  A macro ATTR_NULL is defined
alongside ATTR and used for the tests.

Tested for x86_64.

	* nptl/tst-mutex1.c: Include <stdbool.h>.
	[!ATTR] (ATTR_NULL): New macro.
	(do_test): Test !ATTR_NULL instead of ATTR != NULL.
	* nptl/tst-mutexpi1.c (ATTR_NULL): New macro.
	* nptl/tst-mutexpp1.c (ATTR_NULL): New macro.
2014-12-02 22:33:57 +00:00
Joseph Myers b1aff6a411 Fix warning in posix/tst-getopt_long1.c.
This patch fixes a "discards qualifiers" warning in
posix/tst-getopt_long1.c.  glibc is built with -Wwrite-strings,
meaning a char * cannot be initialized directly with a string
constant; the patch casts the string constants to char *.

Tested for x86_64.

	* posix/tst-getopt_long1.c (do_test): Cast elements of argv array
	to char *.
2014-12-02 22:03:59 +00:00
Joseph Myers 266865c0e7 Remove excess declarations from unistd.h for XPG3/XPG4 (bug 17665).
For XPG3/XPG4 (defined __USE_XOPEN && !defined __USE_UNIX98), unistd.h
declares many functions that should only be declared for __USE_MISC
(none of them are in XPG3/XPG4): sethostname sethostid getdomainname
setdomainname vhangup revoke profil acct getusershell endusershell
setusershell daemon.  The whole block with the [__USE_MISC ||
(__USE_XOPEN && !__USE_UNIX98)] conditional contains only functions
that are not in XPG3/XPG4, so this patch simply changes the
conditional.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by this patch).

	[BZ #17665]
	* posix/unistd.h [__USE_MISC || (__USE_XOPEN && !__USE_UNIX98)]:
	Change conditional to [__USE_MISC].
2014-12-02 21:32:48 +00:00
Joseph Myers 84e5e75640 Fix fgets_unlocked namespace issues (bug 17664).
Various POSIX functions bring in res_init.o, res_hconf.o or
mntent_r.o, which use fgets_unlocked, which is not a POSIX function.
This patch arranges for them to use __fgets_unlocked instead.  (The
IS_IN (libc) conditional in rec_hconf.c is needed because that file is
also used in nscd.)

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch except for an assertion line
number).  Note that most of the linknamespace tests that failed
because of fgets_unlocked from the resolver also fail because of other
symbols brought in by the resolver, so the number of XFAILs this
removes is limited.  Also note that fgets_unlocked failures for
unistd.h for XPG3/XPG4 showed up that actually unistd.h is declaring
too much for XPG3/XPG4 (bug 17665) - there is no actual need to make
getusershell.c use __fgets_unlocked (at least as regards formal
standards are concerned; maybe it should still change for
namespace-cleanness of _DEFAULT_SOURCE) because the functions there
aren't actually in any of the supported standards; the correct fix for
those failures will be to stop the *usershell* functions appearing in
unistd.h for XPG3/XPG4.

	[BZ #17664]
	* misc/mntent_r.c (__getmntent_r): Use __fgets_unlocked instead of
	fgets_unlocked.
	* resolv/res_hconf.c [IS_IN (libc)] (fgets_unlocked): Define to
	__fgets_unlocked.
	* resolv/res_init.c (__res_vinit): Use __fgets_unlocked instead of
	fgets_unlocked.
	* conform/Makefile (test-xfail-XPG4/sys/statvfs.h/linknamespace):
	Remove variable.
	(test-xfail-POSIX/sys/mman.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sys/mman.h/linknamespace): Likewise.
	(test-xfail-UNIX98/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/sys/mman.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/sys/mman.h/linknamespace): Likewise.
	(test-xfail-POSIX2008/sys/statvfs.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/sys/mman.h/linknamespace): Likewise.
	(test-xfail-XOPEN2K8/sys/statvfs.h/linknamespace): Likewise.
2014-12-02 21:31:24 +00:00
Joseph Myers 66cadc058d Fix elf/tst-unique4lib.cc warning.
This patch fixes a warning "tst-unique4lib.cc:17:12: warning: 'b'
defined but not used [-Wunused-variable]".  I'm not sure exactly what
aspects of the test are or are not significant for the issue it is
testing for; the patch makes the minimal change of marking the
variable with __attribute__ ((used)).

Tested for x86_64.

	* elf/tst-unique4lib.cc (b): Mark with __attribute__ ((used)).
2014-12-02 21:29:54 +00:00
Adhemerval Zanella 0f0a1c82f5 powerpc: Add powerpc64 strpbrk optimization
This patch makes the POWER7 optimized strpbrk generic by using
default doubleword stores to zero the hash, instead of VSX
instructions.  Performance on POWER7/POWER8 does not change.
2014-12-02 13:34:02 -05:00
Adhemerval Zanella bb2542e0ae powerpc: Add powerpc64 strcspn optimization
This patch makes the POWER7 optimized strcspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions.  Performance on POWER7/POWER8 does not change.
2014-12-02 07:16:24 -05:00
Adhemerval Zanella 2e8a2de2da powerpc: Add powerpc64 strspn optimization
This patch makes the POWER7 optimized strspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions. Performance on POWER7/POWER8 machines does not changed.
2014-12-02 07:15:58 -05:00
James Lemke 08f1e1d2bc Fix for test "malloc_usable_size: expected 7 but got 11"
[BZ #17581] The checking chain of unused chunks was terminated by a hash of
the block pointer, which was sometimes confused with the chunk length byte.
The chain is now terminated by a NULL byte.
2014-12-01 13:05:18 -08:00
Rajalakshmi Srinivasaraghavan a8a7d7d212 powerpc: strtok{_r} optimization for powerpc64
This patch optimizes strtok and strtok_r for POWERPC64.
A table of 256 characters is created and marked based on
the 'accept' argument and used to check for any occurance on
the input string.Loop unrolling is also used to gain improvements.
2014-12-01 09:03:58 -05:00
Carlos O'Donell c8dc172767 Fix indenting in bits/ioctl-types.h.
Indent the preprocessor directives correctly according
to the normal glibc style.
2014-11-29 01:30:51 -05:00
Carlos O'Donell 6d03458e40 Use ALIGN_UP in nptl/nptl-init.c
Replace bespoke code to align a value with
the ALIGN_UP macro to make it easier to read.
2014-11-29 01:21:58 -05:00
Carlos O'Donell 97114a383f Expand comments in elf/ldconfig.c (search_dir)
Developers creating development packages must take care
to have their static linker DSO link point to the actual
SONAME file. This allows ldconfig to correctly create
the required links for the SONAME. The behaviour is now
more clearly documented in a code comment added by this
patch.
2014-11-29 01:04:57 -05:00
Joseph Myers 0e7e69baa8 Make linknamespace tests check only relevant libraries.
This patch addresses one known caveat in the linknamespace tests: with
this patch they will now only look for definitions of symbols in
relevant libraries, meaning that librt and libpthread are not checked
for ISO C standards, XPG3 and XPG4.

In particular, this means that if __pthread_initialize_minimal is
somehow brought in for one of those standards, the definition from
libc-tls.o will be considered instead of that from libpthread, so
avoiding bringing in lots of other libpthread symbols.  This should
address some of the failures reported by Carlos in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00882.html>, where
__pointer_chk_guard_local brought in __pthread_initialize_minimal.

Tested for x86_64.  The removal of one XFAIL for XPG4 actually shows
up a header bug (shm_open should not be declared for XPG4 - the
namespace issue was for symbols brought in by shm_open, which is no
longer found at all now librt isn't searched; I've filed bug 17663 for
the header bug, though it would show up eventually anyway in the
course of review of conform/ data against XPG4).

Committed.

	* conform/Makefile (linknamespace-symlist-stdlibs-base): New
	variable.
	(linknamespace-symlist-stdlibs-tests): Likewise.
	(tests-special): Append $(linknamespace-symlist-stdlibs-tests)
	instead of $(objpfx)symlist-stdlibs.
	(linknamespace-libs-isoc): New variable.
	(linknamespace-libs): Use $(linknamespace-libs-isoc).
	(linknamespace-libs-ISO): New variable.
	(linknamespace-libs-ISO99): Likewise.
	(linknamespace-libs-ISO11): Likewise.
	(linknamespace-libs-XPG3): Likewise.
	(linknamespace-libs-XPG4): Likewise.
	(linknamespace-libs-POSIX): Likewise.
	(linknamespace-libs-UNIX98): Likewise.
	(linknamespace-libs-XOPEN2K): Likewise.
	(linknamespace-libs-POSIX2008): Likewise.
	(linknamespace-libs-XOPEN2K8): Likewise.
	($(objpfx)symlist-stdlibs): Replace by
	$(linknamespace-symlist-stdlibs-tests).  Use
	$(linknamespace-libs-$*) as set of libraries.
	($(linknamespace-header-tests)): Update dependencies.  Use
	$(objpfx)symlist-stdlibs-$$std for --libsyms argument.
	(test-xfail-XPG4/sys/mman.h/linknamespace): Remove.
	* conform/linknamespace.pl: Remove comment about considering
	definitions of symbols from irrelevant libraries.
2014-11-29 01:46:56 +00:00
H.J. Lu d8dd00805b Resize DTV if the current DTV isn't big enough
This patch changes _dl_allocate_tls_init to resize DTV if the current DTV
isn't big enough.  Tested on X86-64, x32 and ia32.

	[BZ #13862]
	* elf/dl-tls.c: Include <atomic.h>.
	(oom): Remove #ifdef SHARED/#endif.
	(_dl_static_dtv, _dl_initial_dtv): Moved before ...
	(_dl_resize_dtv): This.  Extracted from _dl_update_slotinfo.
	(_dl_allocate_tls_init): Resize DTV if the current DTV isn't
	big enough.
	(_dl_update_slotinfo): Call _dl_resize_dtv to resize DTV.
	* nptl/Makefile (tests): Add tst-stack4.
	(modules-names): Add tst-stack4mod.
	($(objpfx)tst-stack4): New.
	(tst-stack4mod.sos): Likewise.
	($(objpfx)tst-stack4.out): Likewise.
	($(tst-stack4mod.sos)): Likewise.
	(clean): Likewise.
	* nptl/tst-stack4.c: New file.
	* nptl/tst-stack4mod.c: Likewise.
2014-11-28 07:57:40 -08:00
J. Brown 167da422b3 Recognize recent x86 CPUs in string.h 2014-11-27 17:21:12 +01:00
Joseph Myers 6b5189eb20 Avoid deprecated sigblock in misc/tst-pselect.c.
misc/tst-pselect.c uses the deprecated sigblock interface, resulting
in "tst-pselect.c:42:3: warning: 'sigblock' is deprecated (declared at
../signal/signal.h:189) [-Wdeprecated-declarations]".  The choice of
sigblock rather than sigprocmask has nothing to do with what this test
is testing, so this patch changes it to use sigprocmask to avoid the
warning.

Tested for x86_64.

	* misc/tst-pselect.c (do_test): Use sigprocmask instead of
	sigblock.
2014-11-27 16:02:26 +00:00
Joseph Myers 49051f8ea4 Fix libio/bug-ungetwc1.c warning.
This patch fixes a warning "variable 'wc' set but not used" in
libio/bug-ungetwc1.c.

The test didn't verify much about the results of the functions it
called.  This patch makes it check the result of getwc (thereby fixing
the warning), check end of file does not arrive too late in the getwc
loop, and check EOF is no longer set after ungetwc.

Tested for x86_64.

	* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
	feof.
2014-11-27 16:01:04 +00:00
Joseph Myers 9114625bad Fix dlfcn/failtestmod.c warning.
This patch fixes a "set but not used" warning from
dlfcn/failtestmod.c.  A variable is used only to store the return
value from dlsym.  As I understand this test, the point is simply to
do a sequence of load / unload operations in a loop, and all that
matters here is that dlsym gets called and returns without crashing,
not what its return value is.  So this patch removes the assignment to
a variable.

Tested for x86_64.

	* dlfcn/failtestmod.c (constr): Do not store result of dlsym in a
	variable.
2014-11-27 16:00:08 +00:00
Stefan Liebler e7300fef49 Add missing include of libc-internal.h. 2014-11-27 11:07:16 +01:00
Siddhesh Poyarekar 1721f0a406 Don't use __warn_memset_zero_len for gcc-5.0 or newer
gcc now warns when the arguments to memset may have been accidentally
transposed (i.e. length set to zero instead of the byte), so we don't
need that bit of the code in glibc headers anymore.

Tested on x86_64.  Coe generated by gcc 4.8 is identical with or
without the patch.  I also tested gcc master, which does not result in
any new failures.  It does fail quite a few FORTIFY_SOURCE tests, but
those failures are not due to this patch.
2014-11-27 11:15:45 +05:30
Joseph Myers d88548f497 Fix stdio-common/tst-fmemopen.c format warnings.
Testing for 32-bit x86 shows up warnings in
stdio-common/tst-fmemopen.c where off_t values are passed to %zu
printf formats.  Since the values are in messages relating to function
calls where the relevant argument is of type size_t, it seems most
appropriate to cast explicitly to size_t when passing to printf, which
this patch does.

Tested for 32-bit x86.

	* stdio-common/tst-fmemopen.c (do_test): Cast st_size values to
	size_t for %zu format.
2014-11-27 03:25:15 +00:00
Joseph Myers be97091638 Fix nss/tst-nss-test1.c format warning.
Testing for 32-bit x86 shows up a warning "tst-nss-test1.c:25:3:
warning: format '%ju' expects argument of type 'uintmax_t', but
argument 2 has type 'int' [-Wformat=]".  The argument is a difference
of two pointers, a signed quantity of type ptrdiff_t for which the
right format is %td; this patch makes this test use that format.

Tested for 32-bit x86.

	* nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
	difference, not %ju.
2014-11-27 03:24:18 +00:00
Joseph Myers 8915eacef8 Avoid warnings for unused results in nscd/connections.c.
This patch avoids warnings for unused results of setuid and setgid in
nscd/connections.c using an ignore_value macro along the lines
suggested by Paul in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>.

Tested for x86_64.

	* include/libc-internal.h (ignore_value): New macro.
	* nscd/connections.c (restart): Wrap calls to setuid and setgid
	with ignore_value.
2014-11-26 20:54:16 +00:00
Joseph Myers f1a5a0e3c3 Fix sysdeps/mips/__longjmp.c warning.
This patch fixes

../sysdeps/mips/__longjmp.c:27:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]

which arose I think from the MIPS16 changes (renaming the function to
____longjmp with an alias __longjmp, so a prior header prototype for
__longjmp no longer sufficed to prevent a warning).  I've made the
function use a prototype definition, which is what we want for all
function definitions in glibc anyway.

Tested for MIPS.

	* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
	definition.
2014-11-26 16:34:06 +00:00