platform/upstream/glibc.git
9 years agoRework some nscd code not to use variable-length struct types.
Roland McGrath [Wed, 22 Oct 2014 20:17:20 +0000 (13:17 -0700)]
Rework some nscd code not to use variable-length struct types.

9 years agoARM: Use movw/movt more when available
Roland McGrath [Wed, 22 Oct 2014 21:20:35 +0000 (14:20 -0700)]
ARM: Use movw/movt more when available

9 years agoMIPS: Avoid a dangling `vfork@GLIBC_2.0' reference
Maciej W. Rozycki [Wed, 22 Oct 2014 14:20:37 +0000 (15:20 +0100)]
MIPS: Avoid a dangling `vfork@GLIBC_2.0' reference

This satisfies a symbol reference created with:

.symver __libc_vfork, vfork@GLIBC_2.0

where `__libc_vfork' has not been defined or referenced.  In this case
the `vfork@GLIBC_2.0' reference is supposed to be discarded, however a
bug present in GAS since forever causes an undefined symbol table entry
to be created.  This in turn triggers a problem in the linker that can
manifest itself by link errors such as:

ld: libpthread.so: invalid string offset 2765592330 >= 5154 for section `.dynstr'

The GAS and linker bugs need to be resolved, but we can avoid them too
by providing a `__libc_vfork' definition just like our other platforms.

[BZ #17485]
* sysdeps/unix/sysv/linux/mips/vfork.S (__libc_vfork): Define.

9 years agoDon't use INTDEF with __ldexpf (bug 14132).
Joseph Myers [Tue, 21 Oct 2014 23:11:49 +0000 (23:11 +0000)]
Don't use INTDEF with __ldexpf (bug 14132).

Continuing the removal of the obsolete INTDEF / INTUSE mechanism, this
patch removes the use of INTDEF for __ldexpf.  As far as I can tell,
the resulting alias is completely unused.

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

[BZ #14132]
* math/s_ldexpf.c (__ldexpf): Do not use INTDEF.

9 years agoAvoid local PLT reference in __nptl_main.
Roland McGrath [Tue, 21 Oct 2014 17:18:17 +0000 (10:18 -0700)]
Avoid local PLT reference in __nptl_main.

9 years agoTiny refactoring in fts to eliminate a warning.
Roland McGrath [Mon, 20 Oct 2014 22:32:26 +0000 (15:32 -0700)]
Tiny refactoring in fts to eliminate a warning.

9 years agoNPTL: Clean up gratuitous Linuxism in libpthread.so entry point.
Roland McGrath [Mon, 20 Oct 2014 21:54:12 +0000 (14:54 -0700)]
NPTL: Clean up gratuitous Linuxism in libpthread.so entry point.

9 years agoNPTL: Add some missing #include's
Roland McGrath [Mon, 20 Oct 2014 21:46:00 +0000 (14:46 -0700)]
NPTL: Add some missing #include's

9 years agoMake internal lock-init macros return void.
Roland McGrath [Mon, 20 Oct 2014 21:13:14 +0000 (14:13 -0700)]
Make internal lock-init macros return void.

9 years agopthread_once: Add fast path and remove x86 variants.
Torvald Riegel [Sun, 19 Oct 2014 19:59:26 +0000 (21:59 +0200)]
pthread_once: Add fast path and remove x86 variants.

9 years agopthread_once: Clean up constants.
Torvald Riegel [Fri, 11 Oct 2013 15:58:04 +0000 (18:58 +0300)]
pthread_once: Clean up constants.

[BZ #15215] This just gives a name to the integer constants being used.

9 years agoMove readv and writev definitions to syscalls.list (bug 14138).
Joseph Myers [Mon, 20 Oct 2014 15:49:08 +0000 (15:49 +0000)]
Move readv and writev definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves definitions of readv and writev.

The relevant syscalls.list entries were already in
sysdeps/unix/syscalls.list, but to match the C files they needed to
have the names __libc_readv and __libc_writev added.  In fact, I don't
see anything making use of those names - as far as I can tell, these
functions could just be defined as __readv and __writev with aliases
readv and writev.  But cleaning up unnecessary aliases for functions
should be a separate matter from cleaning up unnecessary C syscall
wrappers.

Tested for x86_64.

[BZ #14138]
* sysdeps/unix/syscalls.list (readv): Use __libc_readv as strong
name.
(writev): Use __libc_writev as strong name.
* sysdeps/unix/sysv/linux/readv.c: Remove file.
* sysdeps/unix/sysv/linux/writev.c: Likewise.

9 years agoRemove obsolete TLS_DEFINE_INIT_TP fallback.
Roland McGrath [Fri, 17 Oct 2014 22:40:36 +0000 (15:40 -0700)]
Remove obsolete TLS_DEFINE_INIT_TP fallback.

9 years agoNPTL: Clean up THREAD_SYSINFO macros.
Roland McGrath [Fri, 17 Oct 2014 22:03:00 +0000 (15:03 -0700)]
NPTL: Clean up THREAD_SYSINFO macros.

9 years agoNPTL: Conditionalize direct futex syscall uses.
Roland McGrath [Fri, 17 Oct 2014 21:30:16 +0000 (14:30 -0700)]
NPTL: Conditionalize direct futex syscall uses.

9 years agoNPTL: Conditionalize more uses of SIGCANCEL and SIGSETXID.
Roland McGrath [Fri, 17 Oct 2014 20:40:46 +0000 (13:40 -0700)]
NPTL: Conditionalize more uses of SIGCANCEL and SIGSETXID.

9 years agoFix NPTL build error when missing __NR_set_robust_list.
Roland McGrath [Fri, 17 Oct 2014 18:30:15 +0000 (11:30 -0700)]
Fix NPTL build error when missing __NR_set_robust_list.

9 years agoFix up incorrect formatting in last commit
Siddhesh Poyarekar [Fri, 17 Oct 2014 10:22:46 +0000 (15:52 +0530)]
Fix up incorrect formatting in last commit

9 years agostrcoll: improve performance by removing the cache (#15884)
Leonhard Holz [Fri, 17 Oct 2014 10:17:23 +0000 (15:47 +0530)]
strcoll: improve performance by removing the cache (#15884)

this is a path that should solve bug 15884. It complains about the performance
of strcoll(). It was found out that the runtime of strcoll() is actually bound
to strlen which is needed for calculating the size of a cache that was
installed to improve the comparison performance.

The idea for this patch was that the cache is only useful in rare cases
(strings of same length and same first-level-chars) and that it would be
better to avoid memory allocation at all. To prove this I wrote a performance
test bench-strcoll.c with test data in benchtests-strcoll.tar.gz. Also
modifications in benchtests/Makefile and localedata/Makefile are necessary to
make it work.

After removing the cache the strcoll method showed the predicted behavior
(getting slightly faster) in all but the test case for hindi word sorting.
This was due the hindi text having much more equal words than the other ones.
For equal strings the performance was worse since all comparison levels were
run through and from the second level on the cache improved the comparison
performance of the original version.

Therefore I added a bytewise test via strcmp iff the first level comparison
found that both strings did match because in this case it is very likely that
equal strings are compared. This solved the problem with the hindi test case
and improved the performance of the others.

Performance comparison:

glibc files     -33.77%
vi_VN.UTF-8     -34.12%
en_US.UTF-8     -42.42%
ar_SA.UTF-8     -27.49%
zh_CN.UTF-8     +07.90%
cs_CZ.UTF-8     -29.67%
en_GB.UTF-8     -28.50%
da_DK.UTF-8     -36.57%
pl_PL.UTF-8     -39.31%
fr_FR.UTF-8     -28.57%
pt_PT.UTF-8     -22.82%
el_GR.UTF-8     -26.77%
ru_RU.UTF-8     -35.81%
iw_IL.UTF-8     -35.34%
es_ES.UTF-8     -34.46%
hi_IN.UTF-8     -00.38%
sv_SE.UTF-8     -36.99%
hu_HU.UTF-8     -16.35%
tr_TR.UTF-8     -27.80%
is_IS.UTF-8     -33.24%
it_IT.UTF-8     -24.39%
sr_RS.UTF-8     -37.55%
ja_JP.UTF-8     +02.84%

9 years agoRemove sysdeps/arm/soft-fp directory.
Roland McGrath [Thu, 16 Oct 2014 16:54:45 +0000 (09:54 -0700)]
Remove sysdeps/arm/soft-fp directory.

9 years agoconformtest: clean up POSIX expections for sys/utsname.h, sys/wait.h.
Joseph Myers [Tue, 14 Oct 2014 17:00:11 +0000 (17:00 +0000)]
conformtest: clean up POSIX expections for sys/utsname.h, sys/wait.h.

Continuing the series of patches to clean up conformtest expectations
for "POSIX" (1995/6) based on review of the expectations against the
standard, this patch cleans up expectations for sys/utsname.h and
sys/wait.h.  Tested x86_64; a new XFAIL for sys/wait.h is added.

* conform/data/sys/utsname.h-data (*_t): Allow.
* conform/data/sys/wait.h-data [POSIX] (uid_t): Do not define.
[POSIX] (WEXITED): Do not expect constant.
[POSIX] (WSTOPPED): Likewise.
[POSIX] (WNOHANG): Likewise.
[POSIX] (WNOWAIT): Likewise.
[POSIX] (siginfo_t): Do not expect type or elements.
[POSIX] (pid_t): Do not expect type.
[POSIX] (signal.h): Do not allow header.
[POSIX] (sys/resource.h): Likewise.
[POSIX] (si_*): Do not allow pattern.
[POSIX] (W*): Likewise.
[POSIX] (P_*): Likewise.
[POSIX] (BUS_*): Likewise.
[POSIX] (CLD_*): Likewise.
[POSIX] (FPE_*): Likewise.
[POSIX] (ILL_*): Likewise.
[POSIX] (POLL_*): Likewise.
[POSIX] (SEGV_*): Likewise.
[POSIX] (SI_*): Likewise.
[POSIX] (TRAP_*): Likewise.
* conform/Makefile (test-xfail-POSIX/sys/wait.h/conform): New
variable.

9 years agoFix infinite loop in check_pf (BZ #12926)
Siddhesh Poyarekar [Tue, 14 Oct 2014 15:35:33 +0000 (21:05 +0530)]
Fix infinite loop in check_pf (BZ #12926)

The recvmsg could return 0 under some conditions and cause the
make_request function to be stuck in an infinite loop.

Thank you Jim King <jim.king@simplivity.com> for posting Paul's patch
on the list.

9 years agoRemove CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE.
Joseph Myers [Fri, 10 Oct 2014 17:05:58 +0000 (17:05 +0000)]
Remove CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE.

As far as I can tell, CANCEL-FCT-WAIVE and CANCEL-FILE-WAIVE are old
notes from the addition of cancellation support to glibc and are not
currently used by any glibc testcases or otherwise in the build
process, and it does not seem useful to me to keep them around.  This
patch removes them.

Tested for x86_64.

* CANCEL-FCT-WAIVE: Remove file.
* CANCEL-FILE-WAIVE: Likewise.

9 years agoDon't use INTVARDEF/INTUSE with __libc_enable_secure (bug 14132).
Joseph Myers [Fri, 10 Oct 2014 11:13:11 +0000 (11:13 +0000)]
Don't use INTVARDEF/INTUSE with __libc_enable_secure (bug 14132).

Continuing the removal of the obsolete INTDEF / INTVARDEF / INTUSE
mechanism, this patch replaces its use for __libc_enable_secure with
the use of rtld_hidden_data_def and rtld_hidden_proto.

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

[BZ #14132]
* elf/dl-sysdep.c (__libc_enable_secure): Use rtld_hidden_data_def
instead of INTVARDEF.
(_dl_sysdep_start): Do not use INTUSE with __libc_enable_secure.
* sysdeps/mach/hurd/dl-sysdep.c (__libc_enable_secure): Use
rtld_hidden_data_def instead of INTVARDEF.
(_dl_sysdep_start): Do not use INTUSE with __libc_enable_secure.
* elf/dl-deps.c (expand_dst): Likewise.
* elf/dl-load.c (_dl_dst_count): Likewise.
(_dl_dst_substitute): Likewise.
(decompose_rpath): Likewise.
(_dl_init_paths): Likewise.
(open_path): Likewise.
(_dl_map_object): Likewise.
* elf/rtld.c (dl_main): Likewise.
(process_dl_audit): Likewise.
(process_envvars): Likewise.
* include/unistd.h [IS_IN_rtld] (__libc_enable_secure_internal):
Remove declaration.
(__libc_enable_secure): Use rtld_hidden_proto.

9 years agoremove nested functions from elf/dl-load.c
Kostya Serebryany [Thu, 9 Oct 2014 18:15:24 +0000 (11:15 -0700)]
remove nested functions from elf/dl-load.c

9 years agosoft-fp: Use parentheses around macro arguments.
Joseph Myers [Thu, 9 Oct 2014 17:05:26 +0000 (17:05 +0000)]
soft-fp: Use parentheses around macro arguments.

This patch cleans up the soft-fp code to use parentheses around macro
arguments (where possible; many macro arguments are identifiers used
with ## rather than arbitrary expressions, so cannot be put in
parentheses).  (I'm not aware of any bugs caused by the lack of
parentheses, but this is generally good practice.  The patch is not
exhaustive regarding internal macros where the arguments always come
directly from the mantissa of a floating-point number, although
probably those should be cleaned up in this regard as well.)

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

* soft-fp/double.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_D): Use
parentheses around macro arguments.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_DP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_D): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_D): Likewise.
* soft-fp/extended.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_E):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_EP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_E): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_E): Likewise.
* soft-fp/op-1.h (_FP_FRAC_SRST_1): Likewise.
(_FP_FRAC_SRS_1): Likewise.
(_FP_FRAC_CLZ_1): Likewise.
(_FP_MUL_MEAT_1_imm): Likewise.
(_FP_MUL_MEAT_1_wide): Likewise.
(_FP_MUL_MEAT_1_hard): Likewise.
(_FP_SQRT_MEAT_1): Likewise.
(_FP_FRAC_ASSEMBLE_1): Likewise.
(_FP_FRAC_DISASSEMBLE_1): Likewise.
* soft-fp/op-2.h (_FP_FRAC_CLZ_2): Likewise.
(__FP_CLZ_2): Likewise.
(_FP_MUL_MEAT_2_wide): Likewise.
(_FP_MUL_MEAT_2_wide_3mul): Likewise.
(_FP_MUL_MEAT_2_gmp): Likewise.
(_FP_MUL_MEAT_2_120_240_double): Likewise.
(_FP_SQRT_MEAT_2): Likewise.
(_FP_FRAC_ASSEMBLE_2): Likewise.
(_FP_FRAC_DISASSEMBLE_2): Likewise.
* soft-fp/op-4.h (_FP_FRAC_SRS_4): Likewise.
(_FP_FRAC_CLZ_4): Likewise.
(_FP_MUL_MEAT_4_wide): Likewise.
(_FP_MUL_MEAT_4_gmp): Likewise.
(_FP_SQRT_MEAT_4): Likewise.
(_FP_FRAC_ASSEMBLE_4): Likewise.
(_FP_FRAC_DISASSEMBLE_4): Likewise.
* soft-fp/op-common.h (_FP_CMP): Likewise.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Likewise.
(_FP_TO_INT): Likewise.
(_FP_FROM_INT): Likewise.
[!__FP_CLZ] (__FP_CLZ): Likewise.
(_FP_DIV_HELP_imm): Likewise.
* soft-fp/quad.h [_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_Q):
Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE < 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE < 64] (FP_FROM_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_RAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_UNPACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_PACK_SEMIRAW_QP): Likewise.
[_FP_W_TYPE_SIZE >= 64] (_FP_SQRT_MEAT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_EQ_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_CMP_UNORD_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_TO_INT_Q): Likewise.
[_FP_W_TYPE_SIZE >= 64] (FP_FROM_INT_Q): Likewise.
* soft-fp/single.h (FP_UNPACK_RAW_S): Likewise.
(FP_UNPACK_RAW_SP): Likewise.
(FP_PACK_RAW_S): Likewise.
(FP_PACK_RAW_SP): Likewise.
(FP_UNPACK_S): Likewise.
(FP_UNPACK_SP): Likewise.
(FP_UNPACK_SEMIRAW_S): Likewise.
(FP_UNPACK_SEMIRAW_SP): Likewise.
(FP_PACK_S): Likewise.
(FP_PACK_SP): Likewise.
(FP_PACK_SEMIRAW_S): Likewise.
(FP_PACK_SEMIRAW_SP): Likewise.
(_FP_SQRT_MEAT_S): Likewise.
(FP_CMP_S): Likewise.
(FP_CMP_EQ_S): Likewise.
(FP_CMP_UNORD_S): Likewise.
(FP_TO_INT_S): Likewise.
(FP_FROM_INT_S): Likewise.

9 years agosoft-fp: Support rsigned == 2 in _FP_TO_INT.
Joseph Myers [Thu, 9 Oct 2014 15:00:37 +0000 (15:00 +0000)]
soft-fp: Support rsigned == 2 in _FP_TO_INT.

Continuing the addition of soft-fp features in the Linux kernel
version, this patch adds _FP_TO_INT support for rsigned == 2 (reduce
overflowing results modulo 2^rsize to fit in the destination, used for
alpha emulation).

The kernel version is buggy; it can left shift by a negative amount
when right shifting is required in an overflow case (the kernel
version also has other bugs fixed long ago in glibc; at least,
spurious exceptions converting to the most negative integer).  This
version avoids that by handling overflow (other than to 0) for rsigned
== 2 along with the normal non-overflow case, which already properly
determines the direction in which to shift.

Tested for powerpc-nofpu.  Some functions get slightly bigger and some
get slightly smaller, no doubt as a result of the change to where in
the macro "inexact" is raised, but I don't think those changes are
significant.  Also tested for powerpc-nofpu with the relevant __fix*
functions changed to use rsigned == 2 (which is after all just as
valid as rsigned == 1 in IEEE terms), including verifying the results
and exceptions for various cases of conversions.

With these seven patches, the one remaining feature to add for the
soft-fp code to have all the features of the kernel version is
_FP_TO_INT_ROUND.

* soft-fp/op-common.h (_FP_TO_INT): Handle rsigned == 2.

9 years agosoft-fp: Support more precise "invalid" exceptions.
Joseph Myers [Thu, 9 Oct 2014 14:59:23 +0000 (14:59 +0000)]
soft-fp: Support more precise "invalid" exceptions.

As previously discussed
<https://sourceware.org/ml/libc-alpha/2013-10/msg00345.html>, it would
be desirable to be able to use the same version of the soft-fp code in
the Linux kernel as well as in glibc and libgcc (instead of an old
version in the kernel that's missing ten years of bug fixes,
performance improvements and new features), and to that end it is
useful to add to glibc's copy features in the kernel's copy, even when
they are not directly useful in glibc.

To that end, this patch adds one of those features: support for more
precise "invalid" exceptions describing the particular kind of invalid
operation.  These are relevant for powerpc emulation, and are also as
described in IEEE 754-2008 as sub-exceptions.

The set of sub-exceptions here is the union of those supported on
powerpc and those from IEEE 754-2008 (the former adds a distinction
between 0/0 and Inf/Inf; the latter adds a distinction between Inf*0
from multiplication and the same from fma).  This includes
sub-exceptions for sqrt, conversions to integer and comparisons that
are not supported in the kernel; I see no obvious reason for these
being missing from the kernel support, given that they are supported
on powerpc so accurate powerpc emulation should generate them.

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/soft-fp.h (FP_EX_INVALID_SNAN): New macro.
(FP_EX_INVALID_IMZ): Likewise.
(FP_EX_INVALID_IMZ_FMA): Likewise.
(FP_EX_INVALID_ISI): Likewise.
(FP_EX_INVALID_ZDZ): Likewise.
(FP_EX_INVALID_IDI): Likewise.
(FP_EX_INVALID_SQRT): Likewise.
(FP_EX_INVALID_CVI): Likewise.
(FP_EX_INVALID_VC): Likewise.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Specify more precise
"invalid" exceptions.
(_FP_CHECK_SIGNAN_SEMIRAW): Likewise.
(_FP_ADD_INTERNAL): Likewise.
(_FP_MUL): Likewise.
(_FP_FMA): Likewise.
(_FP_DIV): Likewise.
(_FP_CMP_CHECK_NAN): Likewise.
(_FP_SQRT): Likewise.
(_FP_TO_INT): Likewise.
(FP_EXTEND): Likewise.

9 years agoUpdate French translation
Allan McRae [Thu, 9 Oct 2014 12:11:30 +0000 (22:11 +1000)]
Update French translation

9 years agoDon't use INTDEF/INTUSE with __cxa_atexit (bug 14132).
Joseph Myers [Thu, 9 Oct 2014 11:22:33 +0000 (11:22 +0000)]
Don't use INTDEF/INTUSE with __cxa_atexit (bug 14132).

This patch removes use of the obsolete INTDEF/INTUSE mechanism for
__cxa_atexit, replacing it with libc_hidden_def/libc_hidden_proto.

Tested for x86_64 that installed stripped shared libraries are
unchanged by the patch.

[BZ #14132]
* stdlib/cxa_atexit.c (__cxa_atexit): Use libc_hidden_def instead
of INTDEF.
* include/stdlib.h (__cxa_atexit_internal): Remove declaration.
(__cxa_atexit): Use libc_hidden_proto.
[!NOT_IN_libc] (__cxa_atexit): Remove macro definition.

9 years agoRemove stray *_internal aliases (bug 14132).
Joseph Myers [Thu, 9 Oct 2014 01:11:14 +0000 (01:11 +0000)]
Remove stray *_internal aliases (bug 14132).

This patch removes some stray (unused) *_internal aliases, and
function prototypes with no corresponding definitions at all, at least
some of which were missed in previous INTDEF / INTUSE removal.

Not removed in this patch: __canonicalize_directory_name_internal,
noticed in the course of preparing this patch, isn't an alias, but an
actual function in sysdeps/mach/hurd/getcwd.c - apparently unused,
however.

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

[BZ #14132]
* include/wctype.h [!_ISOMAC] (__iswalpha_l_internal): Remove
declaration.
[!_ISOMAC] (__iswdigit_l_internal): Likewise.
[!_ISOMAC] (__iswspace_l_internal): Likewise.
[!_ISOMAC] (__iswxdigit_l_internal): Likewise.
[!_ISOMAC] (__iswctype_internal): Likewise.
* stdio-common/siglist.c (_sys_siglist_internal): Remove alias.
* sysdeps/unix/syscalls.list (chown): Remove __chown_internal
alias.
(fcntl): Remove __fcntl_internal alias.
* sysdeps/unix/sysv/linux/hppa/syscalls.list (connect): Remove
__connect_internal alias.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list (connect):
Likewise.

9 years agosoft-fp: Add FP_DENORM_ZERO.
Joseph Myers [Thu, 9 Oct 2014 01:09:22 +0000 (01:09 +0000)]
soft-fp: Add FP_DENORM_ZERO.

Continuing the addition of soft-fp features used in the Linux kernel,
this patch adds soft-fp support for FP_DENORM_ZERO (flushing input
subnormal operands to zero of the same sign).

There are some differences from the kernel version.  In the kernel,
the "inexact" exception is set when flushing to zero.  This does not
appear to match the documented semantics for either of the
architectures (alpha and sh) for which the kernel uses FP_DENORM_ZERO,
so this patch does not set "inexact" in this case.  More operations
now use raw or semi-raw unpacking for optimization than did in the
ten-year-old soft-fp version in the kernel, so checks of
FP_DENORM_ZERO are inserted in those operations.  They are also
inserted for comparisons (which already used raw unpacking in the old
version) as I believe that's the correct thing to do when input
subnormals are flushed to zero.  They are *not* inserted for _FP_NEG.
(If any processors do flush input subnormals to zero for negation, or
otherwise vary from the rules implemented when FP_DENORM_ZERO is set,
further macros for sfp-machine.h to control this may need to be
added.)

Although the addition for comparisons will cause FP_EX_DENORM to be
set in this case, it still won't be set for comparisons involving
subnormals when not flushed to zero.  It's quite possible that
accurate emulation of processors that have such an exception for
subnormal operands will require further changes relating to when
FP_EX_DENORM is set (in general, the support for things defined by
IEEE should be considered more reliable and mature than the support
for things outside the scope of IEEE floating point).

Although some processors also have a mode for abrupt underflow -
producing zeroes instead of output subnormals - there is no such mode
in the kernel's soft-fp, so no such mode is added to glibc's soft-fp
(although it could be if someone wanted to emulate such processor
support).

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/soft-fp.h (FP_DENORM_ZERO): New macro.
* soft-fp/op-common.h (_FP_UNPACK_CANONICAL): Check
FP_DENORM_ZERO.
(_FP_CHECK_FLUSH_ZERO): New macro.
(_FP_ADD_INTERNAL): Call _FP_CHECK_FLUSH_ZERO.
(_FP_CMP): Likewise.
(_FP_CMP_EQ): Likewise.
(_FP_TO_INT): Do not set inexact for subnormal arguments if
FP_DENORM_ZERO.
(FP_EXTEND): Call _FP_CHECK_FLUSH_ZERO.
(FP_TRUNC): Likewise.

9 years agosoft-fp: Fix _FP_TO_INT latent bug in overflow handling.
Joseph Myers [Thu, 9 Oct 2014 01:07:10 +0000 (01:07 +0000)]
soft-fp: Fix _FP_TO_INT latent bug in overflow handling.

This patch fixes a latent bug in _FP_TO_INT regarding handling of
arguments with maximum exponent (infinities and NaNs).  If the maximum
exponent is below that calculated as an overflow threshold, such
values would incorrectly be treated as normal values for the purposes
of the conversion.  This could not occur for any of the conversions
actually occurring in glibc, libgcc or the Linux kernel (the maximum
exponent for float is, just, big enough to ensure overflow for
unsigned __int128), but would apply if soft-fp were used for IEEE
binary16.  Appropriate checks are inserted to ensure that the maximum
exponent is always treated as an overflowing exponent, and never as a
normal one.

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/op-common.h (_FP_TO_INT): Ensure maximum exponent is
treated as invalid conversion, not as normal exponent.

9 years agosoft-fp: Refactor exception handling for comparisons.
Joseph Myers [Thu, 9 Oct 2014 01:03:56 +0000 (01:03 +0000)]
soft-fp: Refactor exception handling for comparisons.

This patch refactors how soft-fp comparisons handle setting exceptions
for NaN operands, so that exceptions are set through the FP_CMP macros
rather than directly in the C files calling them.

The _FP_CMP* and FP_CMP* macros gain an extra argument to specify when
exceptions should be set, 0 for no exception setting (I'm not sure
this is actually needed - at least it's not needed for IEEE operations
in glibc / libgcc, but might be relevant in some cases for kernel
use), 1 for exceptions only for signaling NaNs and 2 for exceptions
for all NaNs.  This argument is handled through _FP_CMP_CHECK_NAN,
newly called by the _FP_CMP* macros when a NaN is encountered.  Calls
to these macros are updated, which eliminates all the existing
checking and exception setting in soft-fp *.c files in glibc.

Tested for powerpc-nofpu.  (The __unord* functions have no code
changes; the __eq* / __ge* / __le* functions get slightly larger, but
I don't think that's significant.)

* soft-fp/op-common.h (_FP_CMP_CHECK_NAN): New macro.
(_FP_CMP): Add extra argument EX.  Call _FP_CMP_CHECK_NAN.
(_FP_CMP_EQ): Likewise.
(_FP_CMP_UNORD): Likewise.
* soft-fp/double.h (FP_CMP_D): Add extra argument EX.
(FP_CMP_EQ_D): Likewise.
(FP_CMP_UNORD_D): Likewise.
* soft-fp/extended.h (FP_CMP_E): Likewise.
(FP_CMP_EQ_E): Likewise.
(FP_CMP_UNORD_E): Likewise.
* soft-fp/quad.h (FP_CMP_Q): Likewise.
(FP_CMP_EQ_Q): Likewise.
(FP_CMP_UNORD_Q): Likewise.
* soft-fp/single.h (FP_CMP_S): Likewise.
(FP_CMP_EQ_S): Likewise.
(FP_CMP_UNORD_S): Likewise.
* soft-fp/eqdf2.c (__eqdf2): Update call to FP_CMP_EQ_D.
* soft-fp/eqsf2.c (__eqsf2): Update call to FP_CMP_EQ_S.
* soft-fp/eqtf2.c (__eqtf2): Update call to FP_CMP_EQ_Q.
* soft-fp/gedf2.c (__gedf2): Update call to FP_CMP_D.
* soft-fp/gesf2.c (__gesf2): Update call to FP_CMP_S.
* soft-fp/getf2.c (__getf2): Update call to FP_CMP_Q.
* soft-fp/ledf2.c (__ledf2): Update call to FP_CMP_D.
* soft-fp/lesf2.c (__lesf2): Update call to FP_CMP_S.
* soft-fp/letf2.c (__letf2): Update call to FP_CMP_Q.
* soft-fp/unorddf2.c (__unorddf2): Update call to FP_CMP_UNORD_D.
* soft-fp/unordsf2.c (__unordsf2): Update call to FP_CMP_UNORD_S.
* soft-fp/unordtf2.c (__unordtf2): Update call to FP_CMP_UNORD_Q.
* sysdeps/alpha/soft-fp/ots_cmpe.c (internal_compare): Update call
to FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_cmp.c (_Q_cmp): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_cmpe.c (_Q_cmpe): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_feq.c (_Q_feq): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc32/soft-fp/q_fge.c (_Q_fge): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc32/soft-fp/q_fgt.c (_Q_fgt): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_fle.c (_Q_fle): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_flt.c (_Q_flt): Likewise.
* sysdeps/sparc/sparc32/soft-fp/q_fne.c (_Q_fne): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_cmp.c (_Qp_cmp): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c (_Qp_cmpe): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_feq.c (_Qp_feq): Update call to
FP_CMP_EQ_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_fge.c (_Qp_fge): Update call to
FP_CMP_Q.
* sysdeps/sparc/sparc64/soft-fp/qp_fgt.c (_Qp_fgt): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_fle.c (_Qp_fle): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_flt.c (_Qp_flt): Likewise.
* sysdeps/sparc/sparc64/soft-fp/qp_fne.c (_Qp_fne): Update call to
FP_CMP_EQ_Q.

9 years agosoft-fp: Make extensions of subnormals from XFmode to TFmode signal underflow if...
Joseph Myers [Thu, 9 Oct 2014 01:00:41 +0000 (01:00 +0000)]
soft-fp: Make extensions of subnormals from XFmode to TFmode signal underflow if traps enabled.

This patch fixes a soft-fp corner case I previously noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00349.html>: when
trapping on underflow is enabled, extensions of subnormals from XFmode
to TFmode need to signal underflow because the result is tiny (but
exact, so the underflow flag is not raised unless trapping is
enabled).

To avoid any excess initialization or tests for other cases of
floating-point extensions, a new FP_INIT_TRAPPING_EXCEPTIONS is added
that does the initialization required for this particular case (more
than FP_INIT_EXCEPTIONS, less than FP_INIT_ROUNDMODE, in general), and
FP_NO_EXACT_UNDERFLOW is added to stub out FP_TRAPPING_EXCEPTIONS
tests for those cases of extensions where the test would be dead code,
to avoid any uninitialized variable warnings.

As the relevant case only applies in libgcc, not to any use of soft-fp
in glibc, there is no bug report in Bugzilla and no non-default
definitions of FP_INIT_TRAPPING_EXCEPTIONS are added by the patch.  A
testcase will be added to GCC as part of an update of soft-fp in
libgcc once this patch is in libc.

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.  Bootstrapped GCC with updated
soft-fp with no regressions on x86_64-unknown-linux-gnu and verified
that a test of the relevant case passes where it failed before.

* soft-fp/op-common.h (FP_EXTEND): When a subnormal input produces
a subnormal result, set the underflow exception if trapping on
underflow is enabled.
* soft-fp/soft-fp.h (FP_INIT_TRAPPING_EXCEPTIONS): New macro.
(FP_INIT_EXCEPTIONS): Default to FP_INIT_TRAPPING_EXCEPTIONS.
[FP_NO_EXACT_UNDERFLOW] (FP_TRAPPING_EXCEPTIONS): Undefine and
redefine to 0.
* soft-fp/extenddftf2.c (FP_NO_EXACT_UNDERFLOW): Define.
* soft-fp/extendsfdf2.c (FP_NO_EXACT_UNDERFLOW): Likewise.
* soft-fp/extendsftf2.c (FP_NO_EXACT_UNDERFLOW): Likewise.
* soft-fp/extendxftf2.c (__extendxftf2): Use
FP_INIT_TRAPPING_EXCEPTIONS instead of FP_INIT_ROUNDMODE.

9 years agosoft-fp: Remove FP_CLEAR_EXCEPTIONS.
Joseph Myers [Thu, 9 Oct 2014 00:58:42 +0000 (00:58 +0000)]
soft-fp: Remove FP_CLEAR_EXCEPTIONS.

As noted in
<https://sourceware.org/ml/libc-alpha/2013-10/msg00516.html>, the
soft-fp macro FP_CLEAR_EXCEPTIONS should not be necessary, as soft-fp
code should never set an exception and later clear it.

In fact, all four uses in glibc (for SPARC) are indeed unnecessary:
they appear in files that convert 32-bit or 64-bit integers to IEEE
binary128, an operation that can never raise any exceptions.  If this
was intended to enable the compiler to optimize away any FP_FROM_INT
code testing for exceptional cases, we now have a better way of doing
this: defining FP_NO_EXCEPTIONS before including soft-fp.h causes all
code handling exceptions to be stubbed out, and the rounding mode to
be hardwired for round-to-zero, to allow such optimizations for source
files where (a) the operation in question, for the particular types in
question, can never raise exceptions, but (b) some instances of the
operation for other types can, so the macros used in the file do
contain references to rounding or exceptions, albeit dead in that
particular file.

The uses in the Linux kernel are also unnecessary (clearing exceptions
at a point where they are already cleared).

This patch duly removes FP_CLEAR_EXCEPTIONS, making the SPARC code in
question use FP_NO_EXCEPTIONS and stop using exception-related macros.

* soft-fp/soft-fp.h (FP_CLEAR_EXCEPTIONS): Remove macro.
* sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Define FP_NO_EXCEPTIONS.
(_Q_itoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Define FP_NO_EXCEPTIONS.
(_Q_lltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Define FP_NO_EXCEPTIONS.
(_Q_ulltoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.
* sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Define FP_NO_EXCEPTIONS.
(_Q_utoq): Do not use FP_DECL_EX, FP_CLEAR_EXCEPTIONS or
FP_HANDLE_EXCEPTIONS.

9 years agoDon't use INTUSE with __adjtimex (bug 14132).
Joseph Myers [Wed, 8 Oct 2014 23:19:32 +0000 (23:19 +0000)]
Don't use INTUSE with __adjtimex (bug 14132).

Bug 14132 is removal of the old INTDEF/INTUSE system of *_internal
aliases as obsoleted by the hidden_proto / hidden_def system.  Various
cases were cleaned up in 2012, but some remain.  This patch removes
the use of this mechanism for __adjtimex.

Tested for x86_64 that stripped installed shared libraries are
unchanged by the patch.

[BZ #14132]
* sysdeps/unix/sysv/linux/include/sys/timex.h: New file.
* sysdeps/unix/sysv/linux/adjtime.c [!ADJTIMEX] (ADJTIMEX): Do not
use INTUSE.
[!ADJTIMEX] (INTUSE(__adjtimex)): Remove declaration.
* sysdeps/unix/sysv/linux/alpha/adjtime.c (__adjtimex_internal):
Remove alias.
(__adjtimex): Define using libc_hidden_ver.
* sysdeps/unix/sysv/linux/ntp_gettime.c (INTUSE(__adjtimex)):
Remove declaration.
(ntp_gettime): Call __adjtimex directly.
* sysdeps/unix/sysv/linux/ntp_gettimex.c (INTUSE(__adjtimex)):
Remove declaration.
(ntp_gettimex): Call __adjtimex directly.
* sysdeps/unix/sysv/linux/syscalls.list (adjtimex): Remove
__adjtimex_internal alias.

9 years agoBZ#17460: Fix buffer overrun in nscd --help.
Roland McGrath [Wed, 8 Oct 2014 22:36:12 +0000 (15:36 -0700)]
BZ#17460: Fix buffer overrun in nscd --help.

9 years agoRemove unnecessarily nested function in do_lookup_unique.
Roland McGrath [Wed, 8 Oct 2014 22:18:02 +0000 (15:18 -0700)]
Remove unnecessarily nested function in do_lookup_unique.

9 years agoSupport and use mixed compat/non-compat aliases in syscalls.list.
Joseph Myers [Mon, 6 Oct 2014 22:58:59 +0000 (22:58 +0000)]
Support and use mixed compat/non-compat aliases in syscalls.list.

This patch enables syscalls.list entries to specify both compat and
non-compat symbol versions for the same syscall definition, making use
of this for setrlimit / chown / lchown where the inability to specify
such aliases showed up in the course of work on bug 14138.

The change to make-syscalls.sh is minimal: adding a SHARED conditional
on the compat_symbol calls.  It remains the case that if a compat
symbol version is specified, the syscall is only built for the shared
library at all if an explicit symbol version is given for a non-compat
symbol (so it's necessary to specify "lchown@@GLIBC_2.0
chown@GLIBC_2.0" rather than just "lchown chown@GLIBC_2.0").  It also
remains the case, as already commented in make-syscalls.sh, that no
SHLIB_COMPAT conditionals are generated, so there would be problems if
the same syscalls.list file, with compat symbols, were used for both
configurations that should have those symbols and configurations for
which they should be conditioned out with SHLIB_COMPAT.

Tested for x86.

* sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Condition
compat_symbol calls on [SHARED].
* sysdeps/unix/sysv/linux/powerpc/lchown.S: Remove file.
* sysdeps/unix/sysv/linux/i386/syscalls.list (oldsetrlimit):
Remove.
(setrlimit): Add setrlimit@GLIBC_2.0 alias.
* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list
(oldsetrlimit): Remove.
(setrlimit): Add setrlimit@GLIBC_2.0 alias.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
(lchown): New syscall entry.
(oldsetrlimit): Remove.
(setrlimit): Add setrlimit@GLIBC_2.0 alias.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
(oldsetrlimit): Remove.
(setrlimit): Add setrlimit@GLIBC_2.0 alias.

9 years agoMove some chown / lchown / fchown definitions to syscalls.list (bug 14138).
Joseph Myers [Mon, 6 Oct 2014 22:30:54 +0000 (22:30 +0000)]
Move some chown / lchown / fchown definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves various definitions of chown, lchown and fchown.

In most cases the need for special syscalls.list entries (rather than
existing generic ones) is because these architectures use chown32,
lchown32 and fchown32 as syscall names.  Some architectures also have
symbol versioning compatibility for older versions of chown having
been equivalent to lchown.

In the case of powerpc, chown.c (providing the chown@@GLIBC_2.1
default version) is replaced by a syscalls.list entry (for powerpc32;
powerpc64 has no need for this because of its more recent minimum
symbol version, so can just use the entry in
sysdeps/unix/syscalls.list), but lchown.S is left as-is because it
provides the compat version of chown as an actual alias for __lchown,
which is not yet supported by syscalls.list.  This file can be removed
once such aliases are supported in syscalls.list.

[BZ #14138]
* sysdeps/unix/sysv/linux/arm/fchown.c: Remove file.
* sysdeps/unix/sysv/linux/arm/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/fchown.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/lchown.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/chown.c: Likewise.
* sysdeps/unix/sysv/linux/arm/syscalls.list (lchown): Add syscall.
(fchown): Likewise.
* sysdeps/unix/sysv/linux/m68k/syscalls.list (lchown): Likewise.
(fchown): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list (chown):
Likewise.

9 years agopowerpc: remove linux lowlevellock.h
Adhemerval Zanella [Mon, 6 Oct 2014 21:08:32 +0000 (16:08 -0500)]
powerpc: remove linux lowlevellock.h

This patch remove the powerpc specific lowlevellock.h and adjust some
implementation that rely on __lll_[rel/acq]_instr defines.

9 years agotile: fix copyright header blocks in just-committed files
Chris Metcalf [Mon, 6 Oct 2014 17:47:02 +0000 (13:47 -0400)]
tile: fix copyright header blocks in just-committed files

I accidentally committed versions not following the conventions.

9 years agotile: add clock_gettime support via vDSO
Chris Metcalf [Wed, 1 Oct 2014 19:10:04 +0000 (15:10 -0400)]
tile: add clock_gettime support via vDSO

9 years agotile: make the prolog of clone() more conformant
Chris Metcalf [Thu, 25 Sep 2014 20:53:03 +0000 (16:53 -0400)]
tile: make the prolog of clone() more conformant

With this change we properly set up the frame first, and tear
it down last, doing argument checking only when the frame is set up.

9 years agotile: optimize memcmp
Chris Metcalf [Thu, 25 Sep 2014 20:49:38 +0000 (16:49 -0400)]
tile: optimize memcmp

Customize memcmp.c for tile, using similar tricks from memcpy:

- replace MERGE macro with dblalign.
- replace memcmp_bytes function with revbytes.
- use __glibc_likely.
- use post-increment addressing.

The schedule is still not perfect: the compiler is not hoisting
code above the comparison branch, which could save a bundle or two.
memcmp speeds up by 30-40% on shorter aligned tests in benchtest,
with some tests with unaligned lengths taking a small performance hit.

9 years agotile: add support for _SC_LEVEL*CACHE* sysconf() queries
Chris Metcalf [Thu, 25 Sep 2014 20:41:55 +0000 (16:41 -0400)]
tile: add support for _SC_LEVEL*CACHE* sysconf() queries

9 years agotilegx: provide optimized strnlen, strstr, and strcasestr
Chris Metcalf [Tue, 16 Sep 2014 00:10:18 +0000 (20:10 -0400)]
tilegx: provide optimized strnlen, strstr, and strcasestr

strnlen() is based on the existing tile strlen() with length
checking added.  It speeds up by up to 5x, but on average across
the benchtest corpus by around 35%.  No regressions are seen.

strstr() does 8-byte aligned loads and compares using a 2-byte
filter on the first two bytes of the needle and then testing
the remaining bytes in needle using memcmp().  It speeds up
about 5x in the best case (for "found" needles), about 2x looking
at benchtest as a whole, with some slowdowns as much as 45%.
on a few cases (including the "fail" case for 128KB search).

strcasestr() is based on strstr() but uses a SIMD tolower
routine to convert 8-bytes to lower case in 5 instructions.
It also uses a 2-byte filter and then strncasecmp() for the
remaining bytes.  strncasecmp() is not optimized for SIMD, so
there is futher room for improvement.  However, it is still up
to 16x faster for "found" needles, averaging 2x faster on the
whole corpus of benchtests.  It does slow down by up to 35%
on a few cases, similarly to strstr().

9 years agotilegx: optimize string copy_byte() internal function
Chris Metcalf [Tue, 16 Sep 2014 00:02:50 +0000 (20:02 -0400)]
tilegx: optimize string copy_byte() internal function

We can use one "shufflebytes" instruction instead of 3 "bfins"
instructions to optimize the string functions.

9 years agoWrite errors to stdout and not stderr in nptl/tst-setuid3.c
Arjun Shankar [Mon, 6 Oct 2014 04:53:17 +0000 (10:23 +0530)]
Write errors to stdout and not stderr in nptl/tst-setuid3.c

nptl/tst-setuid3.c was using the `err' and `errx' functions to write
error messages. This wrote to stderr instead of the preferred stdout.

9 years agoremove nested functions from elf/dl-deps.c
Kostya Serebryany [Wed, 1 Oct 2014 21:34:45 +0000 (14:34 -0700)]
remove nested functions from elf/dl-deps.c

9 years agoMove execve to syscalls.list (bug 14138).
Joseph Myers [Wed, 1 Oct 2014 20:58:20 +0000 (20:58 +0000)]
Move execve to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where
previous cleanups have made this possible, this patch moves the
definition of execve.  (In this case, it was the removal of bounded
pointers support, rather than old kernel support, which made the move
possible.)

Tested for x86_64.

[BZ #14138]
* sysdeps/unix/sysv/linux/execve.c: Remove file.
* sysdeps/unix/sysv/linux/syscalls.list (execve): Add syscall.

9 years agoRemove extra whitespace from end of line.
Steve Ellcey [Wed, 1 Oct 2014 20:46:51 +0000 (13:46 -0700)]
Remove extra whitespace from end of line.

9 years ago * sysdeps/mips/strcmp.S: New.
Steve Ellcey [Wed, 1 Oct 2014 20:45:50 +0000 (13:45 -0700)]
* sysdeps/mips/strcmp.S: New.

9 years agoMove some *at definitions to syscalls.list (bug 14138).
Joseph Myers [Tue, 30 Sep 2014 14:32:08 +0000 (14:32 +0000)]
Move some *at definitions to syscalls.list (bug 14138).

Continuing the move of syscall definitions to syscalls.list, where the
removal of support for old kernel versions has made this possible,
this patch moves definitions of various *at functions in
sysdeps/unix/sysv/linux/.

These particular moves are straightforward: there are no #includes of
these source files, no special architecture-specific versions, no
special symbol version handling and no aliases.  Each source file can
be replaced by a single line in sysdeps/unix/sysv/linux/syscalls.list.

Tested for x86_64.

[BZ #14138]
* sysdeps/unix/sysv/linux/syscalls.list (fchownat): New syscall.
(linkat): Likewise.
(mkdirat): Likewise.
(readlinkat): Likewise.
(renameat): Likewise.
(symlinkat): Likewise.
(unlinkat): Likewise.
* sysdeps/unix/sysv/linux/fchownat.c: Remove file.
* sysdeps/unix/sysv/linux/linkat.c: Likewise.
* sysdeps/unix/sysv/linux/mkdirat.c: Likewise.
* sysdeps/unix/sysv/linux/readlinkat.c: Likewise.
* sysdeps/unix/sysv/linux/renameat.c: Likewise.
* sysdeps/unix/sysv/linux/symlinkat.c: Likewise.
* sysdeps/unix/sysv/linux/unlinkat.c: Likewise.

9 years agostdlib/tst-strtod-round.c: Fix build on ARM
Will Newton [Tue, 16 Sep 2014 19:37:04 +0000 (12:37 -0700)]
stdlib/tst-strtod-round.c: Fix build on ARM

Building this test on ARM fails because the prototypes for the long
double variants of the math functions are unavailable.

Add an additional include guard to math.h that enables long double math
function declarations if _LIBC_TEST is defined and define _LIBC_TEST in
stdlib/tst-strtod-round.c.

ChangeLog:

2014-09-30  Will Newton  <will.newton@linaro.org>

* math/math.h: Define long double math functions if
_LIBC_TEST is defined.
* stdlib/tst-strtod-round.c: Define _LIBC_TEST.

9 years agoAllow cross-building of tests
Will Newton [Tue, 16 Sep 2014 19:32:55 +0000 (12:32 -0700)]
Allow cross-building of tests

Allow building tests in a cross configuration without a test wrapper
defined. This is helpful for doing simple build testing of tests.

ChangeLog:

2014-09-30  Will Newton  <will.newton@linaro.org>

* localedata/Makefile: Move assignment to tests-special
into an ifdef testing run-built-tests.
* timezone/Makefile: Likewise.

9 years agoRun tst-ld-sse-use.sh with bash.
Joseph Myers [Mon, 29 Sep 2014 23:24:37 +0000 (23:24 +0000)]
Run tst-ld-sse-use.sh with bash.

tst-ld-sse-use.sh is a bash script, not a POSIX shell script, and so
needs to be run with $(BASH) not $(SHELL) to avoid errors of the form:

../sysdeps/x86/tst-ld-sse-use.sh: 41: ../sysdeps/x86/tst-ld-sse-use.sh: declare: not found

(when /bin/sh is dash).  This patch makes that change.

Tested for x86_64.

* sysdeps/x86/Makefile ($(objpfx)tst-ld-sse-use.out): Run script
with $(BASH) not $(SHELL).

9 years agoCorrectly size profiling reloc table (bug 17411)
Carlos O'Donell [Mon, 29 Sep 2014 17:14:21 +0000 (13:14 -0400)]
Correctly size profiling reloc table (bug 17411)

During auditing or profiling modes the dynamic loader
builds a cache of the relocated PLT entries in order
to reuse them when called again through the same PLT
entry. This way the PLT entry is never completed and
the call into the resolver always results in profiling
or auditing code running.

The problem is that the PLT relocation cache size
is not computed correctly. The size of the cache
should be "Size of a relocation result structure"
x "Number of PLT-related relocations". Instead the
code erroneously computes "Size of a relocation
result" x "Number of bytes worth of PLT-related
relocations". I can only assume this was a mistake
in the understanding of the value of DT_PLTRELSZ
which is the number of bytes of PLT-related relocs.
We do have a DT_RELACOUNT entry, which is a count
for dynamic relative relocs, but we have no
DT_PLTRELCOUNT and thus we need to compute it.

This patch corrects the computation of the size of the
relocation table used by the glibc profiling code.

For more details see:
https://sourceware.org/ml/libc-alpha/2014-09/msg00513.html

[BZ #17411]
* elf/dl-reloc.c (_dl_relocate_object): Allocate correct amount for
l_reloc_result.

9 years agoremove nested function hack_digit
Kostya Serebryany [Mon, 29 Sep 2014 17:46:05 +0000 (10:46 -0700)]
remove nested function hack_digit

9 years agoRequire autoconf 2.69
H.J. Lu [Mon, 29 Sep 2014 14:45:59 +0000 (07:45 -0700)]
Require autoconf 2.69

* aclocal.m4: Require autoconf 2.69.
* configure: Regenerated.
* sysdeps/aarch64/configure: Likewise.
* sysdeps/alpha/configure: Likewise.
* sysdeps/arm/armv7/configure: Likewise.
* sysdeps/arm/configure: Likewise.
* sysdeps/ia64/configure: Likewise.
* sysdeps/mach/configure: Likewise.
* sysdeps/mips/configure: Likewise.
* sysdeps/s390/configure: Likewise.
* sysdeps/unix/sysv/linux/mips/configure: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure: Likewise.

* sysdeps/alpha/configure.ac: Avoid empty lines at the end of
file.
* sysdeps/ia64/configure.ac: Likewise.

9 years agoRemove shlib-versions entries redundant with DEFAULT entries.
Joseph Myers [Fri, 26 Sep 2014 17:34:22 +0000 (17:34 +0000)]
Remove shlib-versions entries redundant with DEFAULT entries.

When a shlib-versions file has a DEFAULT line, it's not necessary to
specify the same default minimum symbol version on the lines for
individual libraries.  If those lines otherwise duplicate the default
SONAME for the library in question, they can be removed completely.

This patch makes such cleanups: version entries for ld.so are removed
(leaving just the definition of the architecture-specific dynamic
linker name) and entries for libpthread are removed completely (since
the default is libpthread.so.0).

Tested for x86_64 that the installed shared libraries are unchanged by
this patch.

There are various architectures (hppa, ia64, mips, sh, sparc64) that
define minimum symbol versions (or in the case of mips, omission of
symbol versions) only for particular libraries without a DEFAULT line.
None of these are equivalent to something simpler with a DEFAULT line
because all have some other libraries, not explicitly mentioned, with
symbol versions that would be omitted were such a line used.  In the
mips case I'm pretty sure it was a mistake not to omit the 2.1 symbols
for libthread_db; for the others I don't know if it was a mistake or
deliberate that some symbols in various libraries have 2.0 or 2.1
versions despite other libraries having a 2.2 minimum.

This concludes the shlib-versions cleanups I'm aware of.

* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions: Do not
specify symbol version for ld.so.  Do not include entry for
libpthread.
* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise.

9 years agoClean up gnu/lib-names.h generation (bug 14171).
Joseph Myers [Fri, 26 Sep 2014 17:33:04 +0000 (17:33 +0000)]
Clean up gnu/lib-names.h generation (bug 14171).

This patch eliminates the mixture of SONAME information in
shlib-versions files and SONAME information used to generate
gnu/lib-names.h in makefiles, with the information in the makefiles
being removed so all this information comes from the shlib-versions
files.

So that gnu/lib-names.h supports multiple ABIs, it is changed to be
generated on the same basis as gnu/stubs.h: when there are multiple
ABIs, gnu/lib-names.h is a wrapper header (the same header installed
whatever ABI is being built) and separate headers such as
gnu/lib-names-64.h contain the substantive contents (only one such
header being installed by any glibc build).

The rules for building gnu/lib-names.h were moved from Makeconfig to
Makerules because they need to come after sysdeps makefiles are
included (now that "ifndef abi-variants" is a toplevel conditional on
the rules rather than $(abi-variants) being evaluated later inside the
commands for a rule).

Tested for x86_64 and x86 that the installed shared libraries are
unchanged by this patch, and examined the installed gnu/lib-names*.h
headers by hand.  Also tested the case of a single ABI (where there is
just a single header installed, again like stubs.h) by hacking
abi-variants to empty for x86_64.

[BZ #14171]
* Makeconfig [$(build-shared) = yes]
($(common-objpfx)soversions.mk): Don't handle SONAMEs specified in
makefiles.
[$(build-shared) = yes && $(soversions.mk-done) = t]
($(common-objpfx)gnu/lib-names.h): Remove rule.
[$(build-shared) = yes && $(soversions.mk-done) = t]
($(common-objpfx)gnu/lib-names.stmp): Likewise.  Split and moved
to Makerules.
[$(build-shared) = yes && $(soversions.mk-done) = t]
(before-compile): Don't append $(common-objpfx)gnu/lib-names.h
here.
[$(build-shared) = yes && $(soversions.mk-done) = t]
(common-generated): Don't append gnu/lib-names.h and
gnu/lib-names.stmp here.
* Makerules [$(build-shared) = yes && $(soversions.mk-done) = t]
(lib-names-h-abi): New variable.
[$(build-shared) = yes && $(soversions.mk-done) = t]
(lib-names-stmp-abi): Likewise.
[$(build-shared) = yes && $(soversions.mk-done) = t &&
abi-variants] (before-compile): Append
$(common-objpfx)$(lib-names-h-abi).
[$(build-shared) = yes && $(soversions.mk-done) = t &&
abi-variants] (common-generated): Append gnu/lib-names.h.
[$(build-shared) = yes && $(soversions.mk-done) = t &&
abi-variants] (install-others-nosubdir): Depend on
$(inst_includedir)/$(lib-names-h-abi).
[$(build-shared) = yes && $(soversions.mk-done) = t &&
abi-variants] ($(common-objpfx)gnu/lib-names.h): New rule.
[$(build-shared) = yes && $(soversions.mk-done) = t]
($(common-objpfx)$(lib-names-h-abi)): New rule.
[$(build-shared) = yes && $(soversions.mk-done) = t]
($(common-objpfx)$(lib-names-stmp-abi)): Likewise.
[$(build-shared) = yes && $(soversions.mk-done) = t]
(common-generated): Append $(lib-names-h-abi) and
$(lib-names-stmp-abi).
* scripts/lib-names.awk: Do not handle multi being set.
* sysdeps/unix/sysv/linux/aarch64/Makefile (abi-lp64-ld-soname):
Remove variable.
(abi-lp64_be-ld-soname): Likewise.
* sysdeps/unix/sysv/linux/arm/Makefile (abi-soft-ld-soname):
Likewise.
(abi-hard-ld-soname): Likewise.
* sysdeps/unix/sysv/linux/i386/shlib-versions: New file.
* sysdeps/unix/sysv/linux/mips/Makefile (abi-o32_soft-ld-soname):
Remove variable.
(abi-o32_hard-ld-soname): Likewise.
(abi-o32_soft_2008-ld-soname): Likewise.
(abi-o32_hard_2008-ld-soname): Likewise.
(abi-n32_soft-ld-soname): Likewise.
(abi-n32_hard-ld-soname): Likewise.
(abi-n32_soft_2008-ld-soname): Likewise.
(abi-n32_hard_2008-ld-soname): Likewise.
(abi-n64_soft-ld-soname): Likewise.
(abi-n64_hard-ld-soname): Likewise.
(abi-n64_soft_2008-ld-soname): Likewise.
(abi-n64_hard_2008-ld-soname): Likewise.
* sysdeps/unix/sysv/linux/powerpc/Makefile (abi-64-v1-ld-soname):
Likewise.
(abi-64-v2-ld-soname): Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions: Add
ld.so entries.
* sysdeps/unix/sysv/linux/s390/Makefile (abi-64-ld-soname): Remove
variable.
* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Add ld.so
entry.
* sysdeps/unix/sysv/linux/x86/Makefile (abi-32-ld-soname): Remove
variable.
(abi-64-ld-soname): Likewise.
(abi-x32-ld-soname): Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Add ld.so
entry.
* sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise.

9 years agoMove some setrlimit definitions to syscalls.list (bug 14138).
Joseph Myers [Tue, 23 Sep 2014 14:12:50 +0000 (14:12 +0000)]
Move some setrlimit definitions to syscalls.list (bug 14138).

Bug 14138 is followup cleanup after removal of support for old Linux
kernel versions: moving syscalls to syscalls.list where the only
reason for using C definitions was kernel version conditionals that
are no longer present.

This patch deals with the case of setrlimit
(sysdeps/unix/sysv/linux/i386/setrlimit.c, included by various other
architectures).  Where needed (where there is also a compat symbol for
setrlimit@GLIBC_2.0), new syscalls.list entries are added.  Where not
needed (where there is no such compat symbol and the minimum symbol
version for libc is 2.2 or later), no such entries are added as that
in sysdeps/unix/syscalls.list will suffice.  Thus arm and sh need no
such entries, while m68k and powerpc need entries only in a
subdirectory syscalls.list file rather than for all configurations
that previously used setrlimit.c.

(setrlimit@@GLIBC_2.2 and setrlimit@GLIBC_2.0 are now semantically
identical - the new symbol version was about a change of types from
signed to unsigned and the former compatibility code for dealing with
large unsigned arguments on old kernels is no longer needed or
present, having been removed with support for pre-2.4 kernels.
However, making the two versions into aliases doesn't work at present:
the case of having both default and non-default symbol versions on the
same syscalls.list line results in a compat_symbol call in code built
for static libc, which doesn't compile.  I don't suppose it would be
hard to generate SHARED conditionals from make-syscalls.sh to fix
this, but in any case this patch doesn't make things any worse, as the
functions weren't aliases before the patch either.)

Tested for x86, and ran ABI tests for ARM as an example of an
architecture where the setrlimit.c file was just removed without
adding syscalls.list entries.

[BZ #14138]
* sysdeps/unix/sysv/linux/arm/setrlimit.c: Remove file.
* sysdeps/unix/sysv/linux/i386/setrlimit.c: Likewise.
* sysdeps/unix/sysv/linux/m68k/setrlimit.c: Likewise.
* sysdeps/unix/sysv/linux/powerpc/setrlimit.c: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/setrlimit.c: Likewise.
* sysdeps/unix/sysv/linux/sh/setrlimit.c: Likewise.
* sysdeps/unix/sysv/linux/i386/syscalls.list (setrlimit): Add
syscall entry for GLIBC_2.2 symbol version.
* sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list (setrlimit):
Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list
(setrlimit): Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list (setrlimit):
Likewise.

9 years agoARM: Don't define _SYS_AUXV_H in sysdep.h
Will Newton [Thu, 11 Sep 2014 16:47:53 +0000 (17:47 +0100)]
ARM: Don't define _SYS_AUXV_H in sysdep.h

sysdep.h was defining _SYS_AUXV_H in order to avoid an include guard check
in hwcap.h. Unfortunately it didn't undefine it so it could leak out into
code and caused a build failure with -Wimplicit-function-declaration
building tst-auxv on ARM.

ChangeLog:

2014-09-23  Will Newton  <will.newton@linaro.org>

* sysdeps/unix/sysv/linux/arm/bits/hwcap.h: Check for
_LINUX_ARM_SYSDEP_H include guard too.
* sysdeps/unix/sysv/linux/arm/sysdep.h (_SYS_AUXV_H): Remove
define.

9 years agoFix prototype of eventfd.
Rasmus Villemoes [Sat, 20 Sep 2014 12:04:52 +0000 (14:04 +0200)]
Fix prototype of eventfd.

9 years agoSync recvmmsg prototype with kernel usage.
Ondřej Bílka [Sat, 20 Sep 2014 11:52:57 +0000 (13:52 +0200)]
Sync recvmmsg prototype with kernel usage.

9 years agostdlib/longlong.h: Add __udiv_w_sdiv prototype.
Andreas Krebbel [Fri, 19 Sep 2014 09:26:31 +0000 (11:26 +0200)]
stdlib/longlong.h: Add __udiv_w_sdiv prototype.

9 years agoNew test for ftime
Arjun Shankar [Wed, 17 Sep 2014 17:21:12 +0000 (22:51 +0530)]
New test for ftime

This test verifies the sanity of ftime and exposes bugs such as BZ

2014-09-17  Arjun Shankar  <arjun.is@lostca.se>

* time/tst-ftime.c: New test.
* time/Makefile (tests): Add tst-ftime.

9 years agosoft-fp: Fix comment formatting.
Joseph Myers [Wed, 17 Sep 2014 22:20:45 +0000 (22:20 +0000)]
soft-fp: Fix comment formatting.

This patch fixes formatting of comments in soft-fp (in particular, the
normal style in glibc does not have a leading '*' on each line, and
comments should start with capital letters and end with ".  */").

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/extended.h: Fix comment formatting.
* soft-fp/op-1.h: Likewise.
* soft-fp/op-2.h: Likewise.
* soft-fp/op-4.h: Likewise.
* soft-fp/op-8.h: Likewise.
* soft-fp/op-common.h: Likewise.
* soft-fp/soft-fp.h: Likewise.

9 years agosoft-fp: Correct _FP_TO_INT formatting.
Joseph Myers [Wed, 17 Sep 2014 21:37:14 +0000 (21:37 +0000)]
soft-fp: Correct _FP_TO_INT formatting.

This patch corrects some soft-fp formatting that failed to follow the
GNU Coding Standards.

Tested for powerpc-nofpu that the disassembly of installed shared
libraries is unchanged by this patch.

* soft-fp/op-common.h (_FP_TO_INT): Correct formatting.

9 years agoRemove bitrotten --enable-oldest-abi (bug 6652).
Joseph Myers [Tue, 16 Sep 2014 17:45:03 +0000 (17:45 +0000)]
Remove bitrotten --enable-oldest-abi (bug 6652).

This patch removes the --enable-oldest-abi configure option, which has
long been bitrotten (as reported in bug 6652).  The principle of
removing this option was agreed in the thread starting at
<https://sourceware.org/ml/libc-alpha/2013-07/msg00174.html>.

Tested for x86_64 and x86 that the installed shared libraries other
than libc.so are unchanged by this patch and that libc.so disassembly
and symbol versions are unchanged (debug info changes because of
changed line numbers in csu/version.c).

[BZ #6652]
* Makeconfig (soversions-default-setname): Remove variable.
($(common-objpfx)soversions.i): Don't pass default_setname to
soversions.awk.
* Makerules ($(common-objpfx)abi-versions.h): Don't pass
oldest_abi to abi-versions.awk.
* config.h.in (GLIBC_OLDEST_ABI): Remove macro undefine.
* config.make.in (oldest-abi): Remove variable.
* configure.ac (--enable-oldest-abi): Remove configure option.
* configure: Regenerated.
* csu/version.c (banner) [GLIBC_OLDEST_ABI]: Remove conditional
text.
* scripts/abi-versions.awk: Do not handle oldest_abi variable.
* scripts/soversions.awk: Do not handle default_setname variable.
* sysdeps/mach/hurd/configure.ac: Do not handle oldest_abi
variable.
* sysdeps/mach/hurd/configure: Regenerated.
* sysdeps/unix/sysv/linux/configure.ac: Do not handle oldest_abi
variable.
* sysdeps/unix/sysv/linux/configure: Regenerated.

9 years agoRemove CFLAGS for interp.c
Siddhesh Poyarekar [Tue, 16 Sep 2014 16:50:45 +0000 (22:20 +0530)]
Remove CFLAGS for interp.c

Replace it with including an auto-generated linker-runtime.h.
Build-tested on x86_64 and found that there was no change in the
generated code.

* elf/Makefile (CFLAGS-interp.c): Remove.
($(elf-objpfx)runtime-linker.h): Generate header with linker
path string.
* elf/interp.c: Include generated runtime-linker.h

9 years agoInclude .interp section only for libc.so
Siddhesh Poyarekar [Tue, 16 Sep 2014 16:49:22 +0000 (22:19 +0530)]
Include .interp section only for libc.so

Barring libc.so and libdl.so, none of the libraries have any entry
points, so it is pointless to add a .interp section for them.  The
libdl.so entry point (in dlfcn/eval.c) is also defunct, so remove that
file as well.

Build tested for x86_64, ppc64 and s390x.  I have not moved
CFLAGS-interp.c to CPPFLAGS-interp.c isnce I'll be removing it
completely in a follow-up patch.

Siddhesh

* Makerules (lib%.so): Don't include $(+interp) in
prerequisites.
* elf/Makefile (CFLAGS-interp.c): Don't define NOT_IN_libc.
* dlfcn/eval.c: Remove file.

9 years agoAssume that all _[PS]C_* and _CS_* macros are always defined
Siddhesh Poyarekar [Tue, 16 Sep 2014 16:48:20 +0000 (22:18 +0530)]
Assume that all _[PS]C_* and _CS_* macros are always defined

The macros in question are always defined in confname.h for all
variants and there seems to be no reason to allow such variants to
exist anyway.

9 years agoMake __extern_always_inline usable on clang++ again
Siddhesh Poyarekar [Tue, 16 Sep 2014 16:46:01 +0000 (22:16 +0530)]
Make __extern_always_inline usable on clang++ again

The fix for BZ #17266 (884ddc5081278f488ef8cd49951f41cfdbb480ce)
removed changes that had gone into cdefs.h to make
__extern_always_inline usable with clang++.  This patch adds back
support for clang to detect if GNU inlining semantics are available,
this time without breaking the gcc use case.  The check put here is
based on the earlier patch and assertion[1] that checking if
__GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__ is defined is sufficient
to determine that clang++ suports GNU inlining semantics.

Tested with a simple program that builds with __extern_always_inline
with the patch and fails compilation without it.

 #include <stdio.h>
 #include <sys/cdefs.h>

extern void foo_alias (void) __asm ("foo");

__extern_always_inline void
foo (void)
{
  puts ("hi oh world!");
  return foo_alias ();
}

void
foo_alias (void)
{
  puts ("hell oh world");
}

int
main ()
{
  foo ();
}

[1] https://sourceware.org/ml/libc-alpha/2012-12/msg00306.html

[BZ #17266]
* misc/sys/cdefs.h: Define __extern_always_inline for clang
4.2 and newer.

9 years agoFix memory leak in error path of do_ftell_wide (BZ #17370)
Siddhesh Poyarekar [Tue, 16 Sep 2014 08:50:45 +0000 (14:20 +0530)]
Fix memory leak in error path of do_ftell_wide (BZ #17370)

9 years agoAdd NEWS entry for previous commit
Siddhesh Poyarekar [Tue, 16 Sep 2014 08:42:40 +0000 (14:12 +0530)]
Add NEWS entry for previous commit

9 years agoRevert to defining __extern_inline only for gcc-4.3+ (BZ #17266)
Siddhesh Poyarekar [Tue, 16 Sep 2014 08:38:48 +0000 (14:08 +0530)]
Revert to defining __extern_inline only for gcc-4.3+ (BZ #17266)

The check for only __GNUC_STDC_INLINE__ and __GNUC_GNU_INLINE__ may
not be sufficient since those flags were added during initial support
for C99 inlining semantics.  There is also a problem with always
defining __extern_inline and __extern_always_inline, since it enables
inline wrapper functions even when GNU inlining semantics are not
guaranteed.  This, along with the possibility of such wrappers using
redirection (btowc for example) could result in compiler generating an
infinitely recusrive call to the function.

In fact it was such a recursion that led to this code being written
the way it was; see:

https://bugzilla.redhat.com/show_bug.cgi?id=186410

The initial change was to fix bugs 14530 and 13741, but they can be
resolved by checking if __fortify_function and/or
__extern_always_inline are defined, as it has been done in this patch.
In addition, I have audited uses of __extern_always_inline to make
sure that none of the uses result in compilation errors.

There is however a regression in this patch for llvm, since it reverts
the llvm expectation that __GNUC_STDC_INLINE__ or __GNUC_GNU_INLINE__
definition imply proper extern inline semantics.

2014-09-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
    Jakub Jelinek  <jakub@redhat.com>

[BZ #17266]
* libio/stdio.h: Check definition of __fortify_function
instead of __extern_always_inline to include bits/stdio2.h.
* math/bits/math-finite.h [__USE_XOPEN || __USE_ISOC99]: Also
check if __extern_always_inline is defined.
[__USE_MISC || __USE_XOPEN]: Likewise.
[__USE_ISOC99] Likewise.
* misc/sys/cdefs.h (__fortify_function): Define only if
__extern_always_inline is defined.
[!__cplusplus || __GNUC_PREREQ (4,3)]: Revert to defining
__extern_always_inline and __extern_inline only for g++-4.3
and newer or a compatible gcc.

9 years agoHandle zero prefix length in getifaddrs (BZ #17371)
Andreas Schwab [Sat, 13 Sep 2014 08:10:29 +0000 (10:10 +0200)]
Handle zero prefix length in getifaddrs (BZ #17371)

9 years agoRemove _POSIX_REGEX_VERSION
Siddhesh Poyarekar [Mon, 15 Sep 2014 04:46:14 +0000 (10:16 +0530)]
Remove _POSIX_REGEX_VERSION

There is no _POSIX_REGEX_VERSION, so don't check for it.
_REGEX_VERSION has been removed as well[1], so only keep the -1 return
for backward compatibility.  I found this when trying to make the
getconf environment variables typo-proof.

* sysdeps/posix/sysconf.c (__sysconf): Return -1 for
_SC_REGEX_VERSION.

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/sysconf.html

9 years agoAdd correct variable names for _POSIX_IPV6 and _POSIX_RAW_SOCKETS
Siddhesh Poyarekar [Mon, 15 Sep 2014 04:38:38 +0000 (10:08 +0530)]
Add correct variable names for _POSIX_IPV6 and _POSIX_RAW_SOCKETS

getconf only recognizes IPV6 and RAW_SOCKETS, when the standard
requires it to recognize the actual configuration variable name[1].  I
have not removed the earlier names for compatibility.

* posix/getconf.c (vars): Add _POSIX_IPV6 and
_POSIX_RAW_SOCKETS.

[1] http://pubs.opengroup.org/onlinepubs/007904875/functions/sysconf.html

9 years agoUpdate Russian translation
Allan McRae [Sat, 13 Sep 2014 05:41:54 +0000 (15:41 +1000)]
Update Russian translation

9 years agoMinor cleanup in locale.c
Roland McGrath [Fri, 12 Sep 2014 23:07:23 +0000 (16:07 -0700)]
Minor cleanup in locale.c

9 years agoMinor cleanup in ld-ctype.c
Roland McGrath [Fri, 12 Sep 2014 22:59:10 +0000 (15:59 -0700)]
Minor cleanup in ld-ctype.c

9 years agoDon't use a nested function in rpmatch.
Roland McGrath [Fri, 12 Sep 2014 21:58:55 +0000 (14:58 -0700)]
Don't use a nested function in rpmatch.

9 years agoRemove configuration name patterns from shlib-versions.
Joseph Myers [Fri, 12 Sep 2014 12:28:47 +0000 (12:28 +0000)]
Remove configuration name patterns from shlib-versions.

This patch removes the first column (patterns matching configuration
names) from shlib-versions, leaving shlib-versions entry selection
based purely on sysdeps directories.

An implication of this removal is that the default for any non-Linux
ports using NPTL will be the same SONAMEs for NPTL libraries as for
Linux (as those defaults, previously limited to .*-.*-linux.*, are
left in nptl/shlib-versions and nptl_db/shlib-versions).

Special host_os handling in configure.ac that was purely for
shlib-versions is removed.  (The host_os setting is still used for
libc-abis - see
<https://sourceware.org/ml/libc-alpha/2014-01/msg00375.html> regarding
that - but no entries there are affected by this change.)

Tested on x86_64 and x86 that the installed shared libraries are
unchanged by this patch.

* scripts/soversions.awk: Do not handle configuration names.
* Makeconfig ($(common-objpfx)soversions.i): Do not pass cpu,
vendor and os variables to soversions.awk.
* configure.ac: Do not modify gnu-* host_os.
* configure: Regenerated
* shlib-versions: Remove first column with configuration names.
* nptl/shlib-versions: Likewise.
* nptl_db/shlib-versions: Likewise.
* sysdeps/hppa/shlib-versions: Likewise.
* sysdeps/m68k/shlib-versions: Likewise.
* sysdeps/mach/hurd/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/aarch64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/alpha/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/arm/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/hppa/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/ia64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/m68k/coldfire/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/microblaze/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/mips/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions:
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sh/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/tile/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/shlib-versions: Likewise.

libidn/ChangeLog:
* shlib-versions: Remove first column with configuration names.

9 years agoUse %ifdef in sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions.
Joseph Myers [Fri, 12 Sep 2014 12:25:36 +0000 (12:25 +0000)]
Use %ifdef in sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions.

This patch makes
sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions use %ifdef
conditionals around the different symbol version definitions for big
and little endian.  (It doesn't actually change the host patterns used
for those definitions; the point is to make it possible to remove the
first column from shlib-versions by eliminating the last case where it
would be harmful for it to be treated as .*-.*-.*.)  The conditional
is based on the ELFv1/ELFv2 distinction rather than BE/LE, since
that's what's already tested in configure and used for the ld.so
soname in the Makefiles.  (Of course if BE ELFv2 were supported in
future, it would get new symbol versions and so need new
conditionals.)

* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure.ac
(HAVE_ELFV2_ABI): AC_DEFINE in ELFv2 case.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/configure:
Regenerated.
* config.h.in (HAVE_ELFV2_ABI): New macro undefine.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions:
Condition symbol version definitions on [HAVE_ELFV2_ABI].

9 years agoMove OS-specific shlib-versions entries to sysdeps files.
Joseph Myers [Fri, 12 Sep 2014 12:24:00 +0000 (12:24 +0000)]
Move OS-specific shlib-versions entries to sysdeps files.

This patch moves OS-specific entries in the top-level shlib-versions
file to appropriate sysdeps directories.  I left the entries in
nptl/shlib-versions and nptl_db/shlib-versions unchanged; I think it
can be for those doing non-Linux NPTL-using ports to figure out
whether those entries should actually be OS-independent or should move
to sysdeps.

Given these two patches, I think the only further change needed before
the first column of shlib-versions can be eliminated will be changing
sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions to use %ifdef
to distinguish BE and LE configurations, instead of relying on the
powerpc64-.*-linux.* and powerpc.*le-.*-linux.* patterns.

Tested on x86_64 that the installed shared libraries are unchanged by
this patch.

* shlib-versions: Remove OS-specific entries.  Moved to files in
sysdeps.
* sysdeps/mach/hurd/shlib-versions: New file.
* sysdeps/unix/sysv/linux/shlib-versions: Likewise.

9 years agoMove architecture-specific shlib-versions entries to sysdeps files.
Joseph Myers [Fri, 12 Sep 2014 12:22:27 +0000 (12:22 +0000)]
Move architecture-specific shlib-versions entries to sysdeps files.

This patch eliminates another way in which ex-ports and non-ex-ports
architectures differ, by moving architecture-specific entries from the
top-level shlib-versions file and that in nptl/ to appropriate sysdeps
directories.  As with my previous patch
<https://sourceware.org/ml/libc-alpha/2014-06/msg00949.html>, I do not
change the regular expressions used; even where the present
expressions seem more general, I believe they are in fact specific to
the chosen sysdeps directory, because any port that matches the
expression but not the sysdeps directory does not currently exist, and
so would use different symbol versions if added in future (and an
intended goal of these changes is to eliminate the first column in
shlib-versions completely rather than having two different mechanisms
in use for system-specific configuration).

Tested on x86_64 that this does not change the installed shared
libraries.  (x86_64 of course does not provide much test coverage for
this patch - what should be architecture-specific contents in
shlib-versions for x86_64 is currently abi-*-ld-soname Makefile
settings, until gnu/lib-names.h is generated more like gnu/stubs.h so
those can move back to shlib-versions.)

* nptl/shlib-versions: Remove architecture-specific entries.
Moved to files in sysdeps.
* shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/shlib-versions: New
file.
* sysdeps/unix/sysv/linux/s390/s390-64/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sh/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/shlib-versions: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/shlib-versions: Likewise.

9 years agoAdd new Linux 3.16 constants to netinet/udp.h.
Joseph Myers [Fri, 12 Sep 2014 12:13:08 +0000 (12:13 +0000)]
Add new Linux 3.16 constants to netinet/udp.h.

This patch adds the new constants UDP_NO_CHECK6_TX and
UDP_NO_CHECK6_RX from Linux 3.16 to sysdeps/gnu/netinet/udp.h.  (I
believe the existing constants there are already Linux-specific,
possibly with the intention that other OSes should adopt the same
values if possible if adopting the features in question.)

Tested on x86_64.

* sysdeps/gnu/netinet/udp.h (UDP_NO_CHECK6_TX): New macro.
(UDP_NO_CHECK6_RX): Likewise.

9 years agoFix typo in macro names in sysconf.c
Siddhesh Poyarekar [Fri, 12 Sep 2014 11:07:31 +0000 (16:37 +0530)]
Fix typo in macro names in sysconf.c

Spell _POSIX_DEVICE_SPECIFIC and _POSIX_DEVICE_SPECIFIC_R correctly.
Found when trying to make the getconf environment variables
typo-proof.

* sysdeps/posix/sysconf.c (__sysconf): Spell
_POSIX_DEVICE_SPECIFIC and _POSIX_DEVICE_SPECIFIC_R correctly.

9 years agoComplete the removal of __gconv_translit_find
Florian Weimer [Fri, 12 Sep 2014 07:17:32 +0000 (09:17 +0200)]
Complete the removal of __gconv_translit_find

Prior to the 2.20 release, the function was just changed to fail
unconditionally, in commit a1a6a401ab0a3c9f15fb7eaebbdcee24192254e8.
This commit removes the function completely, including gconv bits
which depend on it.

This changes the gconv ABI, which is not a public interface.

9 years agoEnhance tst-xmmymm.sh to detect zmm register usage in ld.so (BZ #16194)
Siddhesh Poyarekar [Fri, 12 Sep 2014 07:01:05 +0000 (12:31 +0530)]
Enhance tst-xmmymm.sh to detect zmm register usage in ld.so (BZ #16194)

2d63a517e4084ec80403cd9f278690fa8b676cc4 added support to save and
restore zmm register in the dynamic linker, but did not enhance
test-xmmymm.sh to detect accidental usage of these registers.  The
patch below adds that check.

The script has also been renamed to tst-ld-sse-use.sh.  To see the
minimal changes, run `git show -M`.

[BZ #16194]
* sysdeps/x86/tst-xmmymm.sh: Rename file to...
* sysdeps/x86/tst-ld-sse-use.sh: ... this.  Check for zmm
register usage.
* sysdeps/x86/Makefile: Adjust.

9 years agoMove findidx nested functions to top-level.
Roland McGrath [Thu, 11 Sep 2014 23:02:17 +0000 (16:02 -0700)]
Move findidx nested functions to top-level.

9 years agomalloc: additional unlink hardening for non-small bins [BZ #17344]
Florian Weimer [Wed, 10 Sep 2014 18:29:15 +0000 (20:29 +0200)]
malloc: additional unlink hardening for non-small bins [BZ #17344]

Turn two asserts into a conditional call to malloc_printerr.  The
memory locations are accessed later anyway, so the performance
impact is minor.

9 years agoFix memory leak in libio/wfileops.c do_ftell_wide [BZ #17370]
Tim Lammens [Thu, 11 Sep 2014 05:05:54 +0000 (10:35 +0530)]
Fix memory leak in libio/wfileops.c do_ftell_wide [BZ #17370]

9 years agotile: remove linux lowlevellock.h
Chris Metcalf [Wed, 10 Sep 2014 20:57:29 +0000 (16:57 -0400)]
tile: remove linux lowlevellock.h

9 years agoReturn failure in getnetgrent only when all netgroups have been searched (#17363)
Siddhesh Poyarekar [Wed, 10 Sep 2014 16:21:50 +0000 (21:51 +0530)]
Return failure in getnetgrent only when all netgroups have been searched (#17363)

The netgroups lookup code fails when one of the groups in the search
tree is empty.  In such a case it only returns the leaves of the tree
after the blank netgroup.  This is because the line parser returns a
NOTFOUND status when the netgroup exists but is empty.  The
__getnetgrent_internal implementation needs to be fixed to try
remaining groups if the current group is entry.  This patch implements
this fix.  Tested on x86_64.

[BZ #17363]
* inet/getnetgrent_r.c (__internal_getnetgrent_r): Try next
group if the current group is empty.

9 years agoPowerPC: memset optimization for POWER8/PPC64
Adhemerval Zanella [Tue, 15 Jul 2014 16:19:09 +0000 (12:19 -0400)]
PowerPC: memset optimization for POWER8/PPC64

This patch adds an optimized memset implementation for POWER8.  For
sizes from 0 to 255 bytes, a word/doubleword algorithm similar to
POWER7 optimized one is used.

For size higher than 255 two strategies are used:

1. If the constant is different than 0, the memory is written with
   altivec vector instruction;

2. If constant is 0, dbcz instructions are used.  The loop is unrolled
   to clear 512 byte at time.

Using vector instructions increases throughput considerable, with a
double performance for sizes larger than 1024.  The dcbz loops unrolls
also shows performance improvement, by doubling throughput for sizes
larger than 8192 bytes.