aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-03-16Remove C++ namespace handling from glibc headers.Joseph Myers
glibc headers include some code (not particularly consistent or systematic) to put various declarations in C++ namespaces std and __c99, if _GLIBCPP_USE_NAMESPACES is defined. As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>, this macro was removed from libstdc++ in 2000. I don't expect compilation with such old versions of libstdc++ to work with current glibc headers anyway (whereas old *binaries* are expected to stay working with current glibc); this patch (which should be a no-op with any libstdc++ version postdating that removal) removes all this code from the glibc headers. The begin-end-check.pl test, whose comments say it is about checking these namespace macro calls, is also removed. The code in that test would have covered __BEGIN_DECLS / __END_DECLS as well, but if those weren't properly matched it would show up with the check-installed-headers-cxx tests, so I don't think there is an actual use for keeping begin-end-check.pl with the namespace code removed. Tested for x86_64 and x86 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro. (__END_NAMESPACE_STD): Likewise. (__USING_NAMESPACE_STD): Likewise. (__BEGIN_NAMESPACE_C99): Likewise. (__END_NAMESPACE_C99): Likewise. (__USING_NAMESPACE_C99): Likewise. * math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and undefine macro. (_Mdouble_END_NAMESPACE): Likewise. * ctype/ctype.h: Do not handle C++ namespaces. * libio/bits/stdio-ldbl.h: Likewise. * libio/stdio.h: Likewise. * locale/locale.h: Likewise. * math/bits/mathcalls.h: Likewise. * setjmp/setjmp.h: Likewise. * signal/signal.h: Likewise. * stdlib/bits/stdlib-float.h: Likewise. * stdlib/bits/stdlib-ldbl.h: Likewise. * stdlib/stdlib.h: Likewise. * string/string.h: Likewise. * sysdeps/x86/fpu/bits/mathinline.h: Likewise. * time/bits/types/clock_t.h: Likewise. * time/bits/types/struct_tm.h: Likewise. * time/bits/types/time_t.h: Likewise. * time/time.h: Likewise. * wcsmbs/bits/wchar-ldbl.h: Likewise. * wcsmbs/uchar.h: Likewise. * wcsmbs/wchar.h: Likewise. [_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition. * wctype/wctype.h: Do not handle C++ namespaces. * scripts/begin-end-check.pl: Remove. * Makefile (installed-headers): Likewise. (tests-special): Do not add $(objpfx)begin-end-check.out. ($(objpfx)begin-end-check.out): Remove.
2017-03-15Add ChangeLog entry for aarch64 ifunc support patch.Steve Ellcey
Forgot to add ChangeLog entry.
2017-03-15Add ifunc support for aarch64.Steve Ellcey
* sysdeps/aarch64/dl-machine.h: Include cpu-features.c. (DL_PLATFORM_INIT): New define. (dl_platform_init): New function. * sysdeps/aarch64/ldsodefs.h: Include cpu-features.h. * sysdeps/unix/sysv/linux/aarch64/cpu-features.c: New file. * sysdeps/unix/sysv/linux/aarch64/cpu-features.h: Likewise. * sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/libc-start.c: Likewise.
2017-03-15x86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIEMike Frysinger
When glibc is compiled with gcc 6.2 that has been configured with to default to PIC/PIE, the static version of __mempcpy_chk is not built, as the test is done on PIC instead of SHARED. Fix the test to check for SHARED, like it is done for similar functions like __memcpy_chk. 2017-03-12 Mike Frysinger <vapier@gentoo.org> * sysdeps/x86_64/mempcpy_chk.S (__mempcpy_chk): Check for SHARED instead of PIC.
2017-03-15Improve float range reduction accuracy near pi/2 (bug 21094).Joseph Myers
Bug 21094 reports 3ulp errors of cosf and tanf for certain arguments near pi/2 arising from the use of an insufficiently accurate range reduction. (To be clear, this is a quality-of-implementation issue relating to the apparent intent of those particular cosf and tanf implementations; 3ulp is within the general glibc accuracy goals, so not inherently a bug.) This patch fixes that error by making a wider range of cases use the existing more accurate range reduction for arguments close to pi/2. The wider range of values is still narrow enough for the "z -= pio2_2;" in the more accurate case to be exact, as the code expects. Tested for x86_64, x86 and mips64; no ulps updates needed (but at least on mips64, the larger ulps were seen if the tests were added without the substantive fix). [BZ #21094] * sysdeps/ieee754/flt-32/e_rem_pio2f.c (__ieee754_rem_pio2f): Use 24+24+24-bit pi for wider range of values around pi/2. * math/auto-libm-test-in: Add more tests of cos and tan. * math/auto-libm-test-out-cos: Regenerated. * math/auto-libm-test-out-tan: Likewise.
2017-03-15hppa: Fix setting of __libc_stack_endJohn David Anglin
The binutils package was recently changed to fix -z relro support on hppa. See ld/21000 for details: https://sourceware.org/bugzilla/show_bug.cgi?id=21000 This exposed a problem with the _dl_start_user function in the RTLD_START define. We need to set __libc_stack_end before it is made read only. For this, we need to define DL_STACK_END. The offset of 0x160 gives the same stack end as the code in _dl_start_user. A build log with the attached patch is here: https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=hppa&ver=2.24-9&stamp=1487639205&raw=0
2017-03-15Fix build with --enable-static-nss [BZ #21088]Alexey Neyman
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-03-15Fix combreloc test with BSD grepAlexey Neyman
The test for "-z combreloc" fails when cross-compiling on a machine that uses BSD grep (e.g. on macos). grep complains about empty subexpression and exits with non-zero status, which is interpreted by configure as "not found". As a result, support for "-z combreloc" (HAVE_Z_COMBRELOC) is not detected, leading to link failure on SPARC. While there, replace fgrep with 'grep -F', as fgrep is non-POSIX. * configure.ac: Avoid empty subexpression in grep. Signed-off-by: Alexey Neyman <stilor@att.net>
2017-03-15Fix test-errno issuesAdhemerval Zanella
This patch fixes multiple issues of test-errno.c (9a56f8718341): - Rename Linux test-errno.c to test-errno-linux.c to avoid build the same source for both tests. - Add a mlock check for 32 bits build running on 64 bits kernels. Althuough man pages states that mlock fails with EINVAL if final address overflows, kernels does not return it for aforementioned condition (it returns ENOMEM instead). Although it seems to be a kernel issue for compat syscall handling, I think it is worth to still check syscall return and document the behavior. - Initialize option lenght for setsockopt check. - Change open test from EINVAL to EISDIR. Checked on x86_64-linux-gnu and i686-linux-gnu (running on 64 bits kernel). * posix/test-errno.c (do_test): Initialize setsockopt optlen. * sysdeps/unix/sysv/linux/test-errno.c: Move to ... * sysdeps/unix/sysv/linux/test-errno-linux.c: ... here. (test_wrp_rv): Fix format. (test_wrp_rv2): New macro. (do_test): Handle mlock return on 64 bits kernels with 32 bits binaries.
2017-03-15Fix test-math-vector-sincos.h aliasing.Joseph Myers
x86_64 libmvec tests have been failing to build lately with GCC mainline with -Wuninitialized errors, and Markus Trippelsdorf traced this to an aliasing issue <https://sourceware.org/ml/libc-alpha/2017-03/msg00169.html>. This patch fixes the aliasing issue, so that the vectors-of-pointers are initialized using a union instead of pointer casts. This also fixes the testsuite build failures with GCC mainline. Tested for x86_64 (full testsuite with GCC 6; testsuite build with GCC mainline with build-many-glibcs.py). * sysdeps/x86/fpu/test-math-vector-sincos.h (INIT_VEC_PTRS_LOOP): Use a union when storing pointers. (VECTOR_WRAPPER_fFF_2): Do not take address of integer vector and cast result when passing to INIT_VEC_PTRS_LOOP. (VECTOR_WRAPPER_fFF_3): Likewise. (VECTOR_WRAPPER_fFF_4): Likewise.
2017-03-15Split helper classification macros from mathcalls.hGabriel F. T. Gomes
The classification macros: finite, fpclassify, iseqsig, isinf, isnan, issignaling, and signbit are defined by ISO C11 and declared in mathcalls.h for each of the floating-point types: float, double, and long double. TS 18661-3 does not mention these macros for float128, however support for them must be present when _Float128 is present. This is true, even when the feature test macro __STDC_WANT_IEC_60559_TYPES_EXT__ is false. Other function declarations in mathcalls.h, on the other hand, depend on __STDC_WANT_IEC_60559_TYPES_EXT__. This patch splits the helper functions (__finite, __fpclassify, __iseqsig, __isinf, __isnan, __issignaling, and __signbit) from mathcalls.h, so that these helper functions can be declared for _Float128, even when __STDC_WANT_IEC_60559_TYPES_EXT__ is false. Tested for powerpc64le, s390x, and x86_64. * include/bits/mathcalls-helper-functions.h: New file. * math/Makefile (headers): Add bits/mathcalls-helper-functions.h. * math/bits/mathcalls.h (__finite, __fpclassify, __iseqsig) (__isinf, __isnan, __issignaling, __signbit): Move declarations to math/bits/mathcalls-helper-functions.h. * math/bits/mathcalls-helper-functions.h: New file. * math/math.h: Include bits/mathcalls-helper-functions.h for float, double, and long double.
2017-03-15Use internal __feraiseexcept in __iseqsigGabriel F. T. Gomes
Replace the use of feraiseexcept with __feraiseexcept in the helper function __iseqsig (math/s_iseqsig_template.c). Tested for powerpc64le, s390x, and x86_64. * math/s_iseqsig_template.c (__iseqsig): Use __feraiseexcept instead of feraiseexcept.
2017-03-15support: Explain ignored failures of temporary file removal [BZ #21243]Florian Weimer
2017-03-15support: Add error checking to close system calls [BZ #21244]Florian Weimer
2017-03-15support_format_dns_packet: Fix CNAME and multiple RR handlingFlorian Weimer
Before this change, the loop iterating over RRs in the answer section stopped at the first CNAME record, never printing them. The CNAME and PTR record contents was extracted from the wrong buffer (whole packet instead RDATA). This desynced the parsing after the first CNAME or PTR record. Also fix the AAAA record parsing by checking their sizes.
2017-03-14Fix missing posix_fadvise64 mips64 static build (BZ #21232)Adhemerval Zanella
This patch fixes the missing posix_fadvise64 symbol for static build required for _FILE_OFFSET_BITS=64 on mips64 build. Checked on a mips64-linux-gnu build with run-built-tests=no. [BZ #21232] * sysdeps/unix/sysv/linux/mips/mips64/n64/posix_fadvise64.c: Add posix_fadvise64 weak_alias for static build.
2017-03-14Remove _dl_platform_stringAndreas Schwab
There are no non-trivial uses of _dl_platform_string.
2017-03-13hurd: Make send/recv more posixishSamuel Thibault
Thanks David Michael for the suggestion. * sysdeps/mach/hurd/send.c (__send): Convert hurdish error code into posix error code. * sysdeps/mach/hurd/recv.c (__recv): Likewise.
2017-03-13build-many-glibcs: Remove no_isolate from SH configAdhemerval Zanella
Now with d40dbe7 SH build does not require more the no_isolate gcc options to correct build glibc (since SH build now does not generate a trap anymore). This patch removes the unrequired options from SH config. Checked with a build for sh3-linux-gnu, sh3eb-linux-gnu, sh4-linux-gnu, and sh4eb-linux-gnu. * scripts/build-many-glibcs.py (Context.add_all_configs): Remove no_isolate usage for SH.
2017-03-13 Remove the str(n)dup inlines from string/bits/string2.h. Although inliningWilco Dijkstra
calls with constant strings shows a small (~10%) performance gain, strdup is typically used in error reporting code, so not performance critical. Remove the now unused __need_malloc_and_calloc related defines from stdlib.h. Rename existing uses of str(n)dup to __str(n)dup so it no longer needs to be redirected to a builtin. Also building GLIBC with -Os now no longer shows localplt or linkname space failures (partial fix for BZ #15105 and BZ #19463). [BZ #15105] [BZ #19463] * elf/dl-cache.c (_dl_load_cache_lookup): Use __strdup. * inet/rcmd.c (rcmd_af): Likewise. * inet/rexec.c (rexec_af): Likewise. * intl/dcigettext.c (_LIBC): Likewise. * intl/finddomain.c (_nl_find_domain): Use strdup expansion. * locale/loadarchive.c (_nl_load_locale_from_archive): Use __strdup. * locale/setlocale.c (setlocale): Likewise. * posix/spawn_faction_addopen.c (posix_spawn_file_actions_addopen): Likewise. * stdlib/putenv.c (putenv): Use __strndup. * sunrpc/svc_simple.c (__registerrpc): Use __strdup. * sysdeps/posix/getaddrinfo.c (gaih_inet): Use __strdup/__strndup. * include/stdlib.h (__need_malloc_and_calloc): Remove uses. (__Need_M_And_C) Remove define/undef. * stdlib/stdlib.h (__need_malloc_and_calloc): Remove uses. (__malloc_and_calloc_defined): Remove define. * string/bits/string2.h (__strdup): Remove define. (strdup): Likewise. (__strndup): Likewise. (strndup): Likewise.
2017-03-13Add more IPV6_* macros to sysdeps/unix/sysv/linux/bits/in.h.Joseph Myers
Linux 4.10 adds IPV6_RECVFRAGSIZE to include/uapi/linux/in6.h, which shows that several such IPV6_* macros are missing from glibc's sysdeps/unix/sysv/linux/bits/in.h (while older ones are present). I don't know whether any of these might be deliberately omitted, but this patch adds what appear to be the missing more recent macros to glibc. Tested for x86_64. * sysdeps/unix/sysv/linux/bits/in.h (IPV6_AUTOFLOWLABEL): New macro. (IPV6_ADDR_PREFERENCES): Likewise. (IPV6_MINHOPCOUNT): Likewise. (IPV6_ORIGDSTADDR): Likewise. (IPV6_RECVORIGDSTADDR): Likewise. (IPV6_TRANSPARENT): Likewise. (IPV6_UNICAST_IF): Likewise. (IPV6_RECVFRAGSIZE): Likewise.
2017-03-13Add missing ChangeLog entries.Thorsten Kukuk
2017-03-13The rpcgen tests should not run if we don't build rpcgen.Thorsten Kukuk
* sunrpc/Makefile: only run rpcgen tests if we build rpcgen.
2017-03-12sh: Fix building with gcc5/6Alexey Neyman
Build glibc for sh4-unknown-linux-gnu currently fails if one's using GCC5/6: in dl-conflict.c, the elf_machine_rela() function is called with NULL as its 3rd argument, sym. The implementation of that function in sysdeps/sh/dl-machine.h dereferences that pointer: const Elf32_Sym *const refsym = sym; ... if (map == &GL(dl_rtld_map)) value -= map->l_addr + refsym->st_value + reloc->r_addend; GCC discovers a null pointer dereference, and in accordance with -fdelete-null-pointer-checks (which is enabled in -O2) replaces this code with a trap - which, as SH does not implement a trap pattern in GCC, evaluates to an abort() call. This abort() call pulls many more objects from libc_nonshared.a, eventually resulting in link failure due to multiple definitions for a number of symbols. As far as I see, the conditional before this code is always false in rtld: _dl_resolve_conflicts() is called with main_map as the first argument, not GL(_dl_rtld_map), but since that call is in yet another compilation unit, GCC does not know about it. Patch that wraps this conditional into !defined RESOLVE_CONFLICT_FIND_MAP attached. * sysdeps/sh/dl-machine.h (elf_machine_rela): The condition in R_SH_DIR32 case is always false when inlined from dl-conflict.c. Ifdef out to prevent GCC from insertin an abort() call.
2017-03-12Fix send consolidation typoMarko Myllynen
Fix 60f9423b type for alpha kernel-features.h definition. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_RECV_SYSCALL): Replace duplicate by __ASSUME_SEND_SYSCALL.
2017-03-11If sunrpc code is disabled, rpcsvc header files, rpcgen andThorsten Kukuk
librpcsvc.a should not be installed, too. * sunrpc/Makefile: don't build and install rpcsvc header files, rpcgen and librpcsvc.a by default. Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
2017-03-10Update auto-libm-test-out for catan / catanh.Stefan Liebler
I've used gmp 6.1.2, mpfr 3.1.5 and upstream mpc with fix in mpc_atan (https://scm.gforge.inria.fr/anonscm/gitweb?p=mpc/mpc.git;a=commit;h=958aac9b15a659d6fb5edcb11778123f8a35b14f) to build gen-auto-libm-tests and regenerated catan / catanh out files. Regenerated ULPs for s390 from scratch. Now the catan / catanh tests are passing. ChangeLog: * math/auto-libm-test-out-catan: Regenerated. * math/auto-libm-test-out-catanh: Likewise. * sysdeps/s390/fpu/libm-test-ulps: Likewise.
2017-03-09Regenerate MIPS catan, catanh long double ulps.Joseph Myers
This patch regenerates MIPS catan and catanh ulps for long double with fixed expected results for the tests of those functions. ulps for other types (which may see variation depending on whether glibc is built for a processor with fused multiply-add support) are deliberately not reduced. ulps are not regenerated for powerpc-nofpu as such regeneration does not result in any changes for long double. * sysdeps/mips/mips64/libm-test-ulps: Update catan and catanh ulps for long double with corrected test expectations.
2017-03-09Consolidate Linux send implementationAdhemerval Zanella
This patch consolidates the send Linux syscall implementation on sysdeps/unix/sysv/linux/send{to}.c. The changes are: 1. Remove send from auto-generation syscalls.list on the architecture that uses __NR_send. 2. Define __NR_send for architectures that supports it. It was done instead of defining in default kernel-features.h because current Linux practice for new ports are to implement only __NR_sendto [1] and it will require adding new kernel-features for ports that do not require it (aarch64 for instance). 3. Remove __ASSUME_SENDTO_FOR_SEND_SYSCALL and decide to use __NR_sendto for send generation based on __ASSUME_SENDTO_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL): Define. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL): Undefine. * sysdeps/unix/sysv/linux/nios2/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL): Likewise. * sysdeps/unix/sysv/linux/tile/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL): Likewise. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_RECV_SYSCALL): Define. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/hppa/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove send from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewike. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/send.c: Simplify includes. (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Replace by __ASSUME_SENDTO_SYSCALL. * sysdeps/unix/sysv/linux/x86_64/send.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/send.c: Likewise. * sysdeps/unix/sysv/linux/generic/send.c: Likewise.
2017-03-09Consolidate Linux sendto implementationAdhemerval Zanella
This patch consolidates the sendto Linux syscall implementation on sysdeps/unix/sysv/linux/sendto.c. The changes are: 1. Define __ASSUME_SENDTO_SYSCALL by default. 2. Undef it for architectures that do not support __NR_sendto. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove sendto from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Define by default. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Undef it is kernel does not support __NR_sendto. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h: (__ASSUME_SENDTO_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sendto.c: Simplify includes.
2017-03-09Consolidate Linux recv implementationAdhemerval Zanella
This patch consolidates the recv Linux syscall implementation on sysdeps/unix/sysv/linux/recv.c. The changes are: 1. Remove recv from auto-generation syscalls.list on the architecture that uses __NR_recv. 2. Define __NR_recv for architectures that supports it. It was done instead of defining in default kernel-features.h because current Linux practice for new ports is to implement only __NR_recvfrom [1] and it will require adding new kernel-features for ports that do not require it (aarch64 for instance). 3. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use __NR_recvfrom for recv generation based on __ASSUME_RECVFROM_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recv from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/alpha/kernel-features.h (__ASSUME_RECV_SYSCALL): New define. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/hppa/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/generic/recv.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise. * sysdeps/unix/sysv/linux/recv.c: Simplify includes. (__libc_recv): Use __ASSUME_RECVFROM_SYSCALL instead of __ASSUME_RECVFROM_FOR_RECV_SYSCALL to issue recvfrom syscall. [1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
2017-03-09Consolidate Linux recvfrom implementationAdhemerval Zanella
This patch consolidates the recvfrom Linux syscall implementation on sysdeps/unix/sysv/linux/recvfrom.c. The changes are: 1. Define __ASSUME_RECVFROM_SYSCALL by default 2. Undef it for architectures that do not support __NR_recvfrom. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Define by default. (__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support __NR_recvfrom. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Remove definition. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_RECVFROM_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
2017-03-09Consolidate Linux connect implementationAdhemerval Zanella
This patch consolidates the connect Linux syscall implementation on sysdeps/unix/sysv/linux/accept.c. The changes are: 1. Remove connect from auto-generation syscalls.list on the architecture that uses __NR_connect. 2. Define __NR_connect as default (__ASSUME_CONNECT_SYSCALL) and undef for architectures that do not support it. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove connect from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/connect.c: Simplify include list. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_CONNECT_SYSCALL): Define. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_CONNECT_SYSCALL): Undef if kernel does not support it. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_CONNECT_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_CONNECT_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_CONNECT_SYSCALL): Likewise.
2017-03-09Consolidate Linux accept implementationAdhemerval Zanella
This patch consolidates the accept Linux syscall implementation on sysdeps/unix/sysv/linux/accept.c. The changes are: 1. Remove accept from auto-generation syscalls.list on the architecture that uses __NR_accept. 2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for architectures that do not support it. 3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): New define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Define. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.
2017-03-08Test for correct setting of errno.Yury Norov
This patch adds tests for POSIX and Linux specific syscalls that implemented with syscall templates machinery. The reason of tests is to receive the expected error code and test if it's handled properly by glibc. 2017-03-08 Yury Norov <ynorov@caviumnetworks.com> Zack Weinberg <zackw@panix.com> * posix/test-errno.c: New file. * posix/Makefile (tests): Add test-errno. * sysdeps/unix/sysv/linux/test-errno.c: New file. * sysdeps/unix/sysv/linux/Makefile (tests): Add test-errno.
2017-03-08S390: Regenerate ULPsStefan Liebler
Updated ulps file. There are still fails for long double catan / catanh due to MPC bug. See post from Joseph Myers: https://www.sourceware.org/ml/libc-alpha/2017-03/msg00099.html ChangeLog: * sysdeps/s390/fpu/libm-test-ulps: Regenerated.
2017-03-07Fix auto-merge issue in ChangeLogFlorian Weimer
2017-03-07tzset: Clean up preprocessor macros min, max, signFlorian Weimer
2017-03-07timezone: Remove TZNAME_MAX limit from sysconf [BZ #15576]Florian Weimer
glibc does not impose a limit, and POSIX does not allow a sysconf limit which changes during the lifetime of a process.
2017-03-07Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209)Siddhesh Poyarekar
The LD_HWCAP_MASK environment variable may alter the selection of function variants for some architectures. For AT_SECURE process it means that if an outdated routine has a bug that would otherwise not affect newer platforms by default, LD_HWCAP_MASK will allow that bug to be exploited. To be on the safe side, ignore and disable LD_HWCAP_MASK for setuid binaries. [BZ #21209] * elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for AT_SECURE processes. * sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK. * elf/tst-env-setuid.c (test_parent): Test LD_HWCAP_MASK. (test_child): Likewise. * elf/Makefile (tst-env-setuid-ENV): Add LD_HWCAP_MASK.
2017-03-07hppa: set __IPC_64 as zero for SysV IPC callsAdhemerval Zanella
In 1e5834c38a22 ("Refactor Linux ipc_priv header") a different approach to passing __IPC_64 as zero was created. Hppa kernel ABI requires to oass __IPC_64 as zero since it does not set CONFIG_ARCH_WANT_IPC_PARSE_VERSION in the kernel. Checked on hppa-linux-gnu with some adjustments to avoid BZ#21016 (basically by removing hppa compat implementations and adjusting required headers). * sysdeps/unix/sysv/linux/hppa/ipc_priv.h: New file.
2017-03-06S390: Optimize atomic macros.Stefan Liebler
This patch activates C11 atomic builtins by defining USE_ATOMIC_COMPILER_BUILTINS to 1. Note: E.g. in nptl/pthread_key_delete.c if compiled with GCCs 6 and before, an extra stack-frame is generated and the old value is stored on stack before cs instruction but it never loads this value from stack. An unreleased GCC 7 omit those stack operations. E.g. in nptl/pthread_once.c the condition code of cs instruction is evaluated by a sequence of ipm, sra, compare and jump instructions instead of one conditional jump instruction. This also occurs with an unreleased GCC 7. These shortcomings does not really hurt. Nevertheless, the gcc guys are investigating those ones and plan to fix them before GCC 7 release. The atomic_fetch_abc_def C11 builtins are now using load-and-abc instructions on z196 zarch and higher cpus instead of a loop with compare-and-swap instruction. Some of the non-C11 atomic macros from include/atomic.h are now implemented with help of the C11 atomic builtins. The other non-C11 atomic macros are using the macros defined here. ChangeLog: * sysdeps/s390/atomic-machine.h (USE_ATOMIC_COMPILER_BUILTINS): Define to 1. (__arch_compare_and_exchange_val_8_acq, __arch_compare_and_exchange_val_16_acq, __arch_compare_and_exchange_val_32_acq, __arch_compare_and_exchange_val_64_acq): Delete macro. (atomic_compare_and_exchange_val_acq, atomic_compare_and_exchange_val_rel, atomic_compare_and_exchange_bool_acq, catomic_compare_and_exchange_bool_acq, atomic_exchange_acq, atomic_exchange_rel, atomic_exchange_and_add_acq, atomic_exchange_and_add_rel, catomic_exchange_and_add, atomic_or_val, atomic_or, catomic_or, atomic_bit_test_set, atomic_and_val, atomic_and, catomic_and): Define macros with help of C11 atomic builtins.
2017-03-04hurd: Provide truncate64 and ftruncate64.Justus Winter
* sysdeps/mach/hurd/ftruncate64.c: New file. * sysdeps/mach/hurd/truncate64.c: Likewise.
2017-03-03tzset: Remove unused NOID macroFlorian Weimer
2017-03-03tzset: Remove __attribute_noinline__ from compute_offsetFlorian Weimer
After commit 42261ad731991df345880b0b509d83b0b9a9b9d8, compute_offset is only called once, so not inlining it increases executable size.
2017-03-02Remove header file inclusion guard from elf/get-dynamic-info.hFlorian Weimer
This file is included multiple times, so the guard is harmful. Fixes commit 9090848d0607e93fb08a1d68d9f263846ee33f02.
2017-03-02Document and fix --enable-bind-now [BZ #21015]Florian Weimer
2017-03-01Narrowing the visibility of libc-internal.h even further.Zack Weinberg
posix/wordexp-test.c used libc-internal.h for PTR_ALIGN_DOWN; similar to what was done with libc-diag.h, I have split the definitions of cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN to a new header, libc-pointer-arith.h. It then occurred to me that the remaining declarations in libc-internal.h are mostly to do with early initialization, and probably most of the files including it, even in the core code, don't need it anymore. Indeed, only 19 files actually need what remains of libc-internal.h. 23 others need libc-diag.h instead, and 12 need libc-pointer-arith.h instead. No file needs more than one of them, and 16 don't need any of them! So, with this patch, libc-internal.h stops including libc-diag.h as well as losing the pointer arithmetic macros, and all including files are adjusted. * include/libc-pointer-arith.h: New file. Define cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN here. * include/libc-internal.h: Definitions of above macros moved from here. Don't include libc-diag.h anymore either. * posix/wordexp-test.c: Include stdint.h and libc-pointer-arith.h. Don't include libc-internal.h. * debug/pcprofile.c, elf/dl-tunables.c, elf/soinit.c, io/openat.c * io/openat64.c, misc/ptrace.c, nptl/pthread_clock_gettime.c * nptl/pthread_clock_settime.c, nptl/pthread_cond_common.c * string/strcoll_l.c, sysdeps/nacl/brk.c * sysdeps/unix/clock_settime.c * sysdeps/unix/sysv/linux/i386/get_clockfreq.c * sysdeps/unix/sysv/linux/ia64/get_clockfreq.c * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Don't include libc-internal.h. * elf/get-dynamic-info.h, iconv/loop.c * iconvdata/iso-2022-cn-ext.c, locale/weight.h, locale/weightwc.h * misc/reboot.c, nis/nis_table.c, nptl_db/thread_dbP.h * nscd/connections.c, resolv/res_send.c, soft-fp/fmadf4.c * soft-fp/fmasf4.c, soft-fp/fmatf4.c, stdio-common/vfscanf.c * sysdeps/ieee754/dbl-64/e_lgamma_r.c * sysdeps/ieee754/dbl-64/k_rem_pio2.c * sysdeps/ieee754/flt-32/e_lgammaf_r.c * sysdeps/ieee754/flt-32/k_rem_pio2f.c * sysdeps/ieee754/ldbl-128/k_tanl.c * sysdeps/ieee754/ldbl-128ibm/k_tanl.c * sysdeps/ieee754/ldbl-96/e_lgammal_r.c * sysdeps/ieee754/ldbl-96/k_tanl.c, sysdeps/nptl/futex-internal.h: Include libc-diag.h instead of libc-internal.h. * elf/dl-load.c, elf/dl-reloc.c, locale/programs/locarchive.c * nptl/nptl-init.c, string/strcspn.c, string/strspn.c * malloc/malloc.c, sysdeps/i386/nptl/tls.h * sysdeps/nacl/dl-map-segments.h, sysdeps/x86_64/atomic-machine.h * sysdeps/unix/sysv/linux/spawni.c * sysdeps/x86_64/nptl/tls.h: Include libc-pointer-arith.h instead of libc-internal.h. * elf/get-dynamic-info.h, sysdeps/nacl/dl-map-segments.h * sysdeps/x86_64/atomic-machine.h: Add multiple include guard.
2017-03-01Miscellaneous low-risk changes preparing for _ISOMAC testsuite.Zack Weinberg
These are a grab bag of changes where the testsuite was using internal symbols of some variety, but this was straightforward to fix, and the fixed code should work with or without the change to compile the testsuite under _ISOMAC. Four of these are just more #include adjustments, but I want to highlight sysdeps/powerpc/fpu/tst-setcontext-fpscr.c, which appears to have been written before the advent of sys/auxv.h. I think a big chunk of this file could be replaced by a simple call to getauxval, but I'll let someone who actually has a powerpc machine to test on do that. dlfcn/tst-dladdr.c was including ldsodefs.h just so it could use DL_LOOKUP_ADDRESS to print an additional diagnostic; as requested by Carlos, I have removed this. math/test-misc.c was using #ifndef NO_LONG_DOUBLE, which is an internal configuration macro, to decide whether to do certain tests involving 'long double'. I changed the test to #if LDBL_MANT_DIG > DBL_MANT_DIG instead, which uses only public float.h macros and is equivalent on all supported platforms. (Note that NO_LONG_DOUBLE doesn't mean 'the compiler doesn't support long double', it means 'long double is the same as double'.) tst-writev.c has a configuration macro 'ARTIFICIAL_LIMIT' that the Makefiles are expected to define, and sysdeps/unix/sysv/linux/Makefile was using the internal __getpagesize in the definition; changed to sysconf(_SC_PAGESIZE) which is the POSIX equivalent. ia64-linux doesn't supply 'clone', only '__clone2', which is not defined in the public headers(!) All the other clone tests have local extern declarations of __clone2, but tst-clone.c doesn't; it was getting away with this because include/sched.h does declare __clone2. * nss/tst-cancel-getpwuid_r.c: Include nss.h. * string/strcasestr.c: No need to include config.h. * sysdeps/powerpc/fpu/tst-setcontext-fpscr.c: Include sys/auxv.h. Don't include sysdep.h. * sysdeps/powerpc/tst-set_ppr.c: Don't include dl-procinfo.h. * dlfcn/tst-dladdr.c: Don't include ldsodefs.h. Don't use DL_LOOKUP_ADDRESS. * math/test-misc.c: Instead of testing NO_LONG_DOUBLE, test whether LDBL_MANT_DIG is greater than DBL_MANT_DIG. * sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c): Use sysconf (_SC_PAGESIZE) instead of __getpagesize in definition of ARTIFICIAL_LIMIT. * sysdeps/unix/sysv/linux/tst-clone.c [__ia64__]: Add extern declaration of __clone2.
2017-02-28Add scripts/backport-support.shFlorian Weimer
This script is intended for maintaining the stable branches and distribution backports.