aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-11-19Add setpayload, setpayloadf, setpayloadl.Joseph Myers
TS 18661-1 defines functions for manipulating the payloads of NaNs. This patch implements the setpayload functions for glibc; these set a number (pointed to by a function argument) to a quiet NaN with the given payload, or to +0 if the given payload is not valid. The implementations are structured to allow the substance of the implementation to be shared with the setpayloadsig functions when those are added. The semantics in the TS are not entirely clear in the case where the payload passed to the function is zero (see discussion on the WG14 reflector last month). This patch implements what seems the most sensible interpretation, that -0 is never valid to give as the payload, but +0 is valid in the case where the kind of NaN being generated has its high mantissa bit set so payload 0 is actually possible in such a NaN. Tested for x86_64, x86, mips64 and powerpc. * math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (setpayload): New declaration. * math/Versions (setpayload): New libm symbol at version GLIBC_2.25. (setpayloadf): Likewise. (setpayloadl): Likewise. * math/Makefile (libm-calls): Add s_setpayloadF. * math/libm-test.inc (struct test_Ffp_b1_data): Rename to struct test_Ff_b1_data. (RUN_TEST_Ff_b1): New macro. (RUN_TEST_LOOP_Ff_b1): Likewise. (canonicalize_test_data): Update type. (setpayload_test_data): New array. (setpayload_test): New function. (main): Call setpayload_test. * manual/arith.texi (FP Bit Twiddling): Document setpayload, setpayloadf and setpayloadl. * manual/libm-err-tab.pl: Update comment on interfaces without ulps tabulated. * sysdeps/ieee754/dbl-64/s_setpayload.c: New file. * sysdeps/ieee754/dbl-64/s_setpayload_main.c: Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_setpayload_main.c: Likewise. * sysdeps/ieee754/flt-32/s_setpayloadf.c: Likewise. * sysdeps/ieee754/flt-32/s_setpayloadf_main.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_setpayloadl_main.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-setpayload.c: Likewise. * sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add setpayload. (CFLAGS-nldbl-setpayload.c): New variable. * sysdeps/nacl/libm.abilist: Update. * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
2016-11-18Fix hurd __access_noerrno implementation.Adhemerval Zanella
This patch fixes some hurd bits from commit afcf3cd8eb that added the __access_noerrno internal symbol. It basically removes the nonrequired __hurd_fail_noerrno (since the 'err' argument is ignored) and fixes a typo for EACCES. However, as stated on maillist [1] this __access_noerrno may still be unsafe to run during initialization of tunables on the Hurd. The access_common calls __hurd_file_name_lookup, which calls __hurd_file_name_lookup_retry, which can set errno. [1] https://sourceware.org/ml/libc-alpha/2016-11/msg00646.html
2016-11-18tile: create new math-tests.h headerChris Metcalf
The header makes tile use the new mechanisms for suppressing exception and rounding support (the ROUNDING_TESTS_xxx() and EXCEPTION_TESTS_xxx macros). More importantly, it also now sets SNAN_TESTS_PRESERVE_PAYLOAD to 0, since the tilegx fp hardware does not preserve NaN payloads.
2016-11-18Make tile's set_dataplane API compatibility-onlyChris Metcalf
The set_dataplane() API in <sys/dataplane.h> originally supported the Tilera version of Linux as shipped to our customers. Once we started upstreaming the dataplane support in the kernel, the API changed to use fcntl() as part of the current task-isolation patch series. It doesn't seem like continuing to support the old API is useful for newly-compiled code, and even supporting the old glibc binary API on an upstream kernel that supports the new task isolation mode isn't straightforward, since the semantics have changed in ways that make it hard to map the old semantics precisely to the new ones, so just return ENOSYS.
2016-11-18Quote shell commands in logs from build-many-glibcs.py.Joseph Myers
As requested in <https://sourceware.org/ml/libc-alpha/2016-11/msg00664.html>, this patch makes the commands recorded in build-many-glibcs.py quote words so they can be cut-and-pasted back into a shell. (Note that these logs are generated by the wrapper script generated to run commands with logs, hence the needs for quoting logic to be implemented in that shell script.) * scripts/build-many-glibcs.py (Context.write_files): Make wrapper script quote words in command output to log suitably for input to the shell.
2016-11-18MIPS: Add `.insn' to ensure a text label is defined as code not dataMaciej W. Rozycki
Avoid a build error with microMIPS compilation and recent versions of GAS which complain if a branch targets a label which is marked as data rather than microMIPS code: ../sysdeps/mips/mips32/crti.S: Assembler messages: ../sysdeps/mips/mips32/crti.S:72: Error: branch to a symbol in another ISA mode make[2]: *** [.../csu/crti.o] Error 1 as commit 9d862524f6ae ("MIPS: Verify the ISA mode and alignment of branch and jump targets") closed a hole in branch processing, making relocation calculation respect the ISA mode of the symbol referred. This allowed diagnosing the situation where an attempt is made to pass control from code assembled for one ISA mode to code assembled for a different ISA mode and either relaxing the branch to a cross-mode jump or if that is not possible, then reporting this as an error rather than letting such code build and then fail unpredictably at the run time. This however requires the correct annotation of branch targets as code, because the ISA mode is not relevant for data symbols and is therefore not recorded for them. The `.insn' pseudo-op is used for this purpose and has been supported by GAS since: Wed Feb 12 14:36:29 1997 Ian Lance Taylor <ian@cygnus.com> * config/tc-mips.c (mips_pseudo_table): Add "insn". (s_insn): New static function. * doc/c-mips.texi: Document .insn. so there has been no reason to avoid it where required. More recently this pseudo-op has been documented, by the microMIPS architecture specification[1][2], as required for the correct interpretation of any code label which is not followed by an actual instruction in an assembly source. Use it in our crti.S files then, to mark that the trailing label there with no instructions following is indeed not a code bug and the branch is legitimate. References: [1] "MIPS Architecture for Programmers, Volume II-B: The microMIPS32 Instruction Set", MIPS Technologies, Inc., Document Number: MD00582, Revision 5.04, January 15, 2014, Section 7.1 "Assembly-Level Compatibility", p. 533 [2] "MIPS Architecture for Programmers, Volume II-B: The microMIPS64 Instruction Set", MIPS Technologies, Inc., Document Number: MD00594, Revision 5.04, January 15, 2014, Section 8.1 "Assembly-Level Compatibility", p. 623 2016-11-18 Matthew Fortune <Matthew.Fortune@imgtec.com> Maciej W. Rozycki <macro@imgtec.com> * sysdeps/mips/mips32/crti.S (_init): Add `.insn' pseudo-op at `.Lno_weak_fn' label. * sysdeps/mips/mips64/n32/crti.S (_init): Likewise. * sysdeps/mips/mips64/n64/crti.S (_init): Likewise.
2016-11-17Consolidate Linux setrlimit and getrlimit implementationAdhemerval Zanella
This patch consolidates all Linux setrlimit and getrlimit on the default sysdeps/unix/sysv/linux/{set,get}rlimit{64}.c. It contains two exceptions: 1. mips32 and mips64n32 which requires a versioned symbol for GLIBC 2.19 and higher due a broken RLIM64_INFINITY constant. 2. sparc32 does not define a compat symbol for getrlimit64 for old 2GB limit. I am not sure if it is required, but a RLIM_INFINITY fix [1] change its definition without adding a compat symbol. This patch does not aim to address this possible issue, it follow current symbol export. The default implementation uses prlimit64 for 64 bit rlim_t ({set,get}rlimit64) and if it fails with ENOSYS it fall back to {get,set}rlimit syscall. This code path is only used on kernel older than 2.6.36 (basically now only x86) and I avoid to user __ASSUME_PRLIMTI64 to simplify the implementation. Once x86 moves to be on par with other architectures regarding minimum kernel supported we can get rid of using old syscalls and default path. A new type size define is added, __RLIM_T_MATCHES_RLIM64_T, where is set as default for 64 bits ports. This allows the default implementation to avoid {get,set}rlimit building and alias {get,set}rlimit64 to {get,set}rlimit. Checked on x86_64, i386, armhf, aarch64, and powerpc64le. I also did a sanity build plus check-abi on all other supported architectures. [1] Commit 9c96ff23858b0759e12ad69e3c4599931c90bee8 Adhemerval Zanella <adhemerval.zanella@linaro.org> Yury Norov <ynorov@caviumnetworks.com> * bits/typesizes.h (__RLIM_T_MATCHES_RLIM64_T): define. * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h (__RLIM_T_MATCHES_RLIM64_T): Likewise. * sysdeps/unix/sysv/linux/generic/bits/typesizes.h (__RLIM_T_MATCHES_RLIM64_T): Likewise. * sysdeps/unix/sysv/linux/s390/bits/typesizes.h [__s390x__] (__RLIM_T_MATCHES_RLIM64_T): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h [__arch64__ || __sparcv9] (__RLIM_T_MATCHES_RLIM64_T): Likewise. * sysdeps/unix/sysv/linux/x86/bits/typesizes.h [__86_64__] (__RLIM_T_MATCHES_RLIM64_T): Likewise. * sysdeps/unix/sysv/linux/arm/Makefile [$(subdir) = resource] (sysdep_routines): Remove oldgetrlimit64. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = resource] (sysdep_routines): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = resource] (sysdep_routines): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = resource] (sysdep_routines): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = resource] (sysdep_routines): Likewise. * sysdeps/unix/sysv/linux/arm/getrlimit64.c: Remove file. * sysdeps/unix/sysv/linux/arm/oldgetrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/hppa/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/i386/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/i386/oldgetrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/m68k/oldgetrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/oldgetrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/oldgetrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/sh/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/setrlimit64.c: Likewise. * sysdeps/sysv/linux/generic/wordsize-32/syscalls.list: Remove setrlimit and getrlimit. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/getrlimit.c: New file. * sysdeps/unix/sysv/linux/sparc/getrlimit64.c: Likewise. * sysdeps/unix/sysv/linux/setrlimit.c: Likewise. * sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Handle __RLIM_T_MATCHES_RLIM64_T and add alias if defined. (__old_getrlimit64): Add compatibility symbol. * sysdeps/unix/sysv/linux/setrlimit64.c (__setrlimit): Likewise.
2016-11-17Actually use newly built host libraries in build-many-glibcs.py.Joseph Myers
This patch adds the missing GCC configure options required to make use of the newly built host libraries in build-many-glibcs.py. * scripts/build-many-glibcs.py (Config.build_gcc): Configure with newly built gmp, mpfr and mpc.
2016-11-17Make Alpha <sys/user.h> self-contained.Joseph Myers
The check-installed-headers tests show up that the Alpha <sys/user.h> is not self-contained, using size_t without including any header that defines it. This patch fixes it by including <stddef.h>, as done for other architectures' versions of this header. Tested for Alpha (compilation only). * sysdeps/unix/sysv/linux/alpha/sys/user.h: Include <stddef.h>.
2016-11-16Enable linknamespace testing for libdl and libcrypt.Joseph Myers
When I set up linknamespace testing, the lists of libraries that might contain functions from various standards were based on the -l options POSIX says may be required to find certain functions with the c99 utility. glibc has some POSIX functions in the libdl and libcrypt libraries, not mentioned in the definition of the c99 utility (so an implementation of that utility using glibc would need to use -ldl -lcrypt automatically). This patch adds those libraries to the ones considered in linknamespace testing for relevant standards. (The crypt functions are XSI only, present in XPG3 and above; the libdl ones were added in UNIX98, then moved from XSI to BASE in the 2008 edition of POSIX.) * conform/Makefile (linknamespace-libs): Rename to linknamespace-libs-thr. (linknamespace-libs-posix): New variable. (linknamespace-libs-xsi): Likewise. (linknamespace-libs-XPG3): Include libcrypt.a. (linknamespace-libs-XPG4): Use $(linknamespace-libs-XPG3). (linknamespace-libs-POSIX): Use $(linknamespace-libs-thr). (linknamespace-libs-UNIX98): Use $(linknamespace-libs-xsi). (linknamespace-libs-XOPEN2K): Likewise. (linknamespace-libs-XOPEN2K8): Likewise. (linknamespace-libs-POSIX2008): Use $(linknamespace-libs-posix).
2016-11-16Fix crypt snprintf namespace (bug 20829).Joseph Myers
Extending linknamespace tests to cover libcrypt showed that crypt brings in references to snprintf, but is in XPG3 and XPG4 which don't have snprintf. This patch fixes it to use __snprintf instead, exporting __snprintf from libc.so at version GLIBC_PRIVATE and adding libc_hidden_proto / libc_hidden_def accordingly. Tested for x86_64 and x86, in conjunction with the testsuite changes to enable linknamespace testing for libdl and libcrypt. Also tested (compilation only) for powerpc to make sure there were no problem interactions with the optional-long-double handling for snprintf. [BZ #20829] * stdio-common/Versions (__snprintf): Add to version GLIBC_PRIVATE. * include/stdio.h (__snprintf): Use libc_hidden_proto. * stdio-common/snprintf.c (__snprintf): Use libc_hidden_def. * crypt/sha256-crypt.c (__sha256_crypt_r): Use __snprintf instead of snprintf. * crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.
2016-11-16Correct comments in string.h re strcoll_l, strxfrm_l.Zack Weinberg
* string/string.h: Remove obsolete comment stating that strcoll_l and strxfrm_l have not yet been standardized.
2016-11-16New internal function __access_noerrnoAdhemerval Zanella
Implement an internal version of __access called __access_noerrno that avoids setting errno. This is useful to check accessibility of files very early on in process startup i.e. before TLS setup. This allows tunables to replace MALLOC_CHECK_ safely (i.e. check existence of /etc/suid-debug to enable/disable MALLOC_CHECK) and at the same time initialize very early so that it can override IFUNCs. Checked on x86_64. * hurd/hurd.h (__hurd_fail_noerrno): New function. * include/unistd.h [IS_IN (rtld) || !defined SHARED]: Declare __access_noerrno. * io/access.c (__access_noerrno): New function. * sysdeps/mach/hurd/access.c (hurd_fail_seterrno): New function. (hurd_fail_seterrno): Likewise. (access_common): Likewise. (__access_noerrno): Likewise. * sysdeps/nacl/access.c (__access_noerrno): Likewise. * sysdeps/unix/sysv/linux/access.c (__access_noerrno): Likewise. * sysdeps/nacl/nacl-interfaces.h (NACL_CALL_NOERRNO): New macro.
2016-11-16Fix SH4 register-dump.h for soft-float.Joseph Myers
This patch fixes SH4 register-dump.h to declare a variable inside the the build for soft-float. Tested (compilation only) for SH4 soft-float. * sysdeps/unix/sysv/linux/sh/sh4/register-dump.h (register_dump): Only declare fpregs if [__SH_FPU_ANY__].
2016-11-15Make SH ucontext always match current kernels.Joseph Myers
As discussed in the thread starting at <https://sourceware.org/ml/libc-alpha/2015-06/msg00657.html>, there are various problems with the sigcontext / mcontext / ucontext structures on SH. The soft-float SH4 case in fact does not build at present, with errors processing sysdeps/unix/sysv/linux/sh/sh4/ucontext_i.sym with gen-as-const.awk ("error: 'mcontext_t {aka struct <anonymous>}' has no member named 'fpregs'"). Linux 4.8 (commit bbe6c77857c38f4acbdc4fc70399515226d1859a) moved to always using the same sigcontext structure on SH, with room for floating-point registers whether or not present on the processor. This patch makes the glibc header match. Tested (compilation only) for sh4-linux-gnu hard float, and in conjunction with other fixes for soft float. * sysdeps/unix/sysv/linux/sh/sys/ucontext.h [__SH4__ || __SH4A__]: Make code unconditional. [!(__SH4__ || __SH4A__)]: Remove conditional code.
2016-11-15manual: Remove non-existent mount options S_IMMUTABLE and S_APPEND [BZ #11235]Rical Jasan
These were removed in 2010, while addressing [BZ #11235]. This commit removes their documentation from the manual.
2016-11-15ChangeLog: fix dateMike Frysinger
2016-11-15configure: accept __stack_chk_fail_local for ssp support too [BZ #20662]Denis Kaganovich
When glibc is compiled with gcc 6.2 that has been configured with --enable-default-pie and --enable-default-ssp, the configure script fails to detect that the compiler has ssp turned on by default when being built for i686-linux-gnu. This is because gcc is emitting __stack_chk_fail_local but the script is only looking for __stack_chk_fail. Support both. Example output: checking whether x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed implicitly enables -fstack-protector... no
2016-11-15s390x: Add hidden definition for __sigsetjmpFlorian Weimer
2016-11-14Fix build-many-glibcs.py style issues.Joseph Myers
* scripts/build-many-glibcs.py (os.path): Do not import. (Context): Inherit explicitly from object. Remove blank line between class and docstring. (Config): Likewise. (Glibc): Likewise. (Command): Likewise. (CommandList): Likewise. (Context.write_files): Store chmod mode in a variable.
2016-11-14Make tilegx32 install libraries in lib32 directories.Joseph Myers
This patch makes tilegx32 install libraries in lib32 directories, matching what GCC expects and avoiding conflict with 64-bit libraries installed in lib directories. Tested (compilation only) for tilegx (32-bit and 64-bit, BE and LE, GCC 5). * sysdeps/unix/sysv/linux/tile/tilegx/configure.ac: Use LIBC_SLIBDIR_RTLDDIR for tilegx32. * sysdeps/unix/sysv/linux/tile/tilegx/configure: Regenerated.
2016-11-14Forgot to add the ChangeLog to the previous commit, doh.Zack Weinberg
2016-11-14Fix build-and-build-again bug in sunrpc tests.Zack Weinberg
rpcgen will error out if the file it's asked to create already exists. Several other rules in sunrpc/Makefile take care to delete rpcgen- generated files before creating them, but rpcgen-tests doesn't, which can lead to spurious test failures in an incremental rebuild. * sunrpc/Makefile (rpcgen-tests): Delete the .out file before creating or re-creating it.
2016-11-14Fix typo in string/bits/string2.h.Zack Weinberg
The comment above the bzero() macro in this file appears to have been copied verbatim from the comment above the memset() prototype in string.h proper. bzero() has no 'c' argument and can only set memory contents to 0. (The comment above the prototype of bzero() in string.h proper does not make the same mistake.) * string/bits/string2.h: Fix typo in comment.
2016-11-14[BZ #19239] Issue deprecation warnings on macro expansion.Zack Weinberg
By using __glibc_macro_warning instead of __attribute_deprecated__, we get the deprecation warnings whenever the macros are expanded, not just when they compile to a function call. This is important for unintentional uses like the test case in #19239 (C++ var(value) initialization syntax, with a variable named "major"). It's also simpler, because __REDIRECT is no longer required. * misc/sys/sysmacros.h (__SYSMACROS_DM, __SYSMACROS_DM1): New macros. (__SYSMACROS_DEPRECATION_MSG, __SYSMACROS_FST_DECL_TEMPL) (__SYSMACROS_FST_IMPL_TEMPL): Delete. (major, minor, makedev): Use __SYSMACROS_DM in definition, instead of redirected function names. * misc/sys/cdefs.h (__glibc_macro_warning): Activate for clang >= 3.5 as well. Document that MESSAGE must be a single string literal.
2016-11-11Add script to build many glibc configurations.Joseph Myers
This patch adds a Python (3.5 or later) script to build many different configurations of glibc, including building the required cross compilers first. It's not intended to change any patch testing requirements, although some people may wish to use it for high-risk patches such as adding warning options (and it can also be used to test building, including compiling tests, for an individual configuration, if e.g. you wish to do such a compilation test of a patch for an architecture it touches). The configurations include all the GNU/Linux ABI variants in <https://sourceware.org/glibc/wiki/ABIList> (although some do not yet build cleanly) and it would be desirable to cover enough other variants e.g. for CPUs using different sysdeps directories to test building each piece of code in glibc at least once. It would also be desirable to extend it to cover Hurd and NaCl, which might best be done by people familiar with those configurations. You call the script as build-many-glibcs.py /some/where thing-to-do <other-arguments> where /some/where is a working directory for the script. It will create and use subdirectories build, install, logs therein. You can use it with thing-to-do being "checkout" to create a subdirectory src therein, with subdirectories binutils, gcc, glibc, gmp, linux, mpc, mpfr with the sources of those components, or create those directories manually (all except glibc can be symlinks to sources elsewhere). In the checkout case, by default it checks out GCC 6 branch, binutils 2.27 branch, glibc mainline and releases of other components. You can specify <component>-<version> to choose a version to check out, where <version> is "vcs-mainline" or "vcs-<branch>" to check out from version control (only supported for gcc, binutils, glibc) and otherwise a release version number to download and use a tarball; components not specified on the command line have default versions checked out. If you rerun "checkout" (with the same version specifications) it will update checkouts from version control, but will not detect cases where the location something is expected to be checked out from has changed. Other than "checkout", thing-to-do is one of host-libraries, compilers, glibcs. So you run, in that order: build-many-glibcs.py /some/where host-libraries build-many-glibcs.py /some/where compilers build-many-glibcs.py /some/where glibcs host-libraries is run once and then those libraries are used for all the compilers. compilers can be run once and then used many times for testing different glibc versions (so a bot only needs to update glibc and rerun the glibcs task, if using stable GCC / binutils; if testing the latest versions of the whole toolchain together including mainline GCC, it would probably want to update everything and rerun both compilers and glibcs). You can also name particular variants after "compilers" or "glibcs" to build just those variants (the possible variants are hardcoded in the script). I may add support for allowing the set of configurations to depend on the GCC version (to get cleaner default results), and optionally looping over architecture-independent glibc variants of CFLAGS and configure options as well, for every glibc configuration listed (e.g. -Os). GCC versions before 4.9 are not expected to work (the code uses --with-glibc-version to get the bootstrap GCC appropriately configured). There are various problems for particular configurations as well. Command-line options to the script: -jN to run N jobs in parallel (default the number of CPU cores reported by the system); --keep=all or --keep=failed to control keeping around build directories (default --keep=none). * scripts/build-many-glibcs.py: New file.
2016-11-11Ignore -Wmaybe-uninitialized in stdlib/bug-getcontext.c.Joseph Myers
Doing all-ABIs compile testing produces a compiler warning in stdlib/bug-getcontext.c on nios2 and tilepro (with GCC 5 branch): bug-getcontext.c: In function 'do_test': bug-getcontext.c:53:6: error: 'except_mask' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (mask != except_mask) ^ This warning appears nonsensical; except_mask is initialized where it's declared. I think what must be happening here is that the compiler is confused by the returns-twice nature of getcontext: if there were a call to setcontext, local variables could indeed have lost their values on the second return from getcontext. This patch duly uses the DIAG_* macros to disable the warning here. Tested for nios2 and tilepro (compilation only; after this patch all the tests compile, though there are other failures) and x86_64 (full testsuite run). * stdlib/bug-getcontext.c: Include <libc-internal.h>. (do_test): Disable -Wmaybe-uninitialized around uses of except_mask.
2016-11-11Make SH <sys/user.h> self-contained.Joseph Myers
The check-installed-headers tests show up that the SH <sys/user.h> is not self-contained, using size_t without including any header that defines it. This patch fixes it by including <stddef.h>, as done for other architectures' versions of this header. Tested for SH3 and SH4 (compilation only). * sysdeps/unix/sysv/linux/sh/sys/user.h: Include <stddef.h>.
2016-11-10Make sure tilepro uses kernel atomics fo atomic_storeChris Metcalf
It's not legal for raw stores to be mixed with atomic operations on tilepro, since the atomics are managed by kernel fast syscalls. It's possible for a hardware store and a kernel fast atomic to race with each other in such a way that the hardware store is lost. Suppose you have an initial zero value, and you race with a store of 2 and a kernel cmpxchg from 0 to 1. The legal output is only 2: either the store hit first and the cmpxchg failed, or the cmpxchg hit first and succeeded, then was overwritten by the 2. But if the kernel cmpxchg starts first and loads the zero, then the store hits and sets the value to 2, the cmpxchg will still decide it was successful and write the 1, leaving the value illegally set to 1. Using atomic_exchange variants to implement atomic_store fixes this problem for tilepro.
2016-11-10Refactor some libm type-generic macros.Joseph Myers
This patch refactors some type-generic libm macros, in both math.h and math_private.h, to be based on a common __MATH_TG macro rather than all replicating similar logic to choose a function to call based on the type of the argument. This should serve to illustrate what I think float128 support for such macros should look like: common macros such as __MATH_TG may need different definitions depending on whether float128 is supported in glibc, so that the individual macros themselves do not need conditionals on float128 support. Tested for x86_64, x86, mips64 and powerpc. * math/math.h (__MATH_TG): New macro. [__USE_ISOC99] (fpclassify): Define using __MATH_TG. [__USE_ISOC99] (signbit): Likewise. [__USE_ISOC99] (isfinite): Likewise. [__USE_ISOC99] (isnan): Likewise. [__USE_ISOC99] (isinf): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (issignaling): Likewise. [__GLIBC_USE (IEC_60559_BFP_EXT)] (__MATH_EVAL_FMT2): New macro. [__GLIBC_USE (IEC_60559_BFP_EXT)] (iseqsig): Define using __MATH_TG and __MATH_EVAL_FMT2. * sysdeps/generic/math_private.h (fabs_tg): Define using __MATH_TG. * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h [!__NO_LONG_DOUBLE_MATH] (__iscanonicalf): New macro. [!__NO_LONG_DOUBLE_MATH] (__iscanonical): Likewise. [!__NO_LONG_DOUBLE_MATH] (iscanonical): Define using __MATH_TG. * sysdeps/ieee754/ldbl-96/bits/iscanonical.h (__iscanonicalf): New macro. (__iscanonical): Likewise. (iscanonical): Define using __MATH_TG.
2016-11-10Fix sh4 build with __ASSUME_ST_INO_64_BIT redefinitionAdhemerval Zanella
Since 327792c sh4 builds fails with: ../sysdeps/unix/sysv/linux/kernel-features.h:49:0: error: "__ASSUME_ST_INO_64_BIT" redefined [-Werror] #define __ASSUME_ST_INO_64_BIT 1 ^ In file included from ../sysdeps/unix/sysv/linux/sysdep.h:19:0, from ../sysdeps/unix/sysv/linux/sh/sysdep.h:24, from ../sysdeps/unix/sysv/linux/sh/sh4/sysdep.h:4, from <stdin>:1: ../sysdeps/unix/sysv/linux/sh/kernel-features.h:47:0: note: this is the location of the previous definition #define __ASSUME_ST_INO_64_BIT 0 It is because sh4 kernel-features.sh is included multiple times without guards and this patch fixes by adding them. Tested on a sh4-linux-gnu build. * sysdeps/unix/sysv/linux/sh/kernel-features.h: Add include guards.
2016-11-10Consolidate Linux access implementationAdhemerval Zanella
This patch consolidates the Linux access implementation on sysdeps/unix/sysv/linux/access.c. Similar to auto-generation through syscalls.list, __NR_access is check and __NR_faccessat is used only for newer architectures (where __NR_access is not defined). Checked on x86_64. * sysdeps/unix/sysv/linux/access.c: New file. * sysdeps/unix/sysv/linux/generic/access.c: Remove file.
2016-11-10Add definitions to sysdeps/tile/tilepro/bits/wordsize.h.Steve Ellcey
* sysdeps/tile/tilepro/bits/wordsize.h: Define __WORDSIZE32_SIZE_ULONG and __WORDSIZE32_PTRDIFF_LONG.
2016-11-10Regenerate ULPs for aarch64Siddhesh Poyarekar
* sysdeps/aarch64/libm-test-ulps: Regenerated.
2016-11-09Consolidate Linux truncate implementationsAdhemerval Zanella
This patch consolidates all Linux truncate implementation on sysdeps/unix/sysv/linux/truncate{64}.c. It is based on {INTERNAL,INLINE}_SYSCALL patch [1] to simplify the syscall construction. General idea is to build ftruncate iff __OFF_T_MATCHES_OFF64_T is not defined, otherwise ftruncate64 will be build and ftruncate will be an alias. The fallocate will use old compat syscall and pass 32-bit off_t argument, while fallocate64 will handle the correct off64_t passing using __ALIGNMENT_ARG and SYSCALL_LL64 macros. Tested on x86_64, i386, aarch64, and armhf. * sysdeps/unix/sysv/linux/arm/truncate64.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/truncate.c: Likewise. * sysdeps/sysv/linux/generic/wordsize-32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/truncate64.c: Likewise. * sysdeps/unix/sysv/linux/truncate.c: New file. * sysdeps/unix/sysv/linux/truncate64.c (truncate64): Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG and SYSCALL_LL64 macros. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (truncate): Remove. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (truncate): Likewise. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
2016-11-09Consolidate Linux ftruncate implementationsAdhemerval Zanella
THis patch consolidates all Linux ftruncate implementation on sysdeps/unix/sysv/linux/ftruncate{64}.c. It is based on {INTERNAL,INLINE}_SYSCALL patch [1] to simplify the syscall construction. General idea is to build ftruncate iff __OFF_T_MATCHES_OFF64_T is not defined, otherwise ftruncate64 will be build and ftruncate will be an alias. The fallocate will use old compat syscall and pass 32-bit off_t argument, while fallocate64 will handle the correct off64_t passing using __ALIGNMENT_ARG and SYSCALL_LL64 macros. Tested on x86_64, i386, aarch64, and armhf. * posix/tst-truncate-common.c: New file. * posix/tst-truncate.c: Use tst-truncate-common.c. * posix/tst-truncate64.c: Likewise and add LFS tests. * sysdeps/unix/sysv/linux/arm/ftruncate64.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/ftruncate.c: Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/ftruncate64.c: Likewise. * sysdeps/unix/sysv/linux/ftruncate.c: New file. * sysdeps/unix/sysv/linux/ftruncate64.c (__ftruncate64): Use INLINE_SYSCALL_CALL, __ALIGNMENT_ARG and SYSCALL_LL64 macros. [__OFF_T_MATCHES_OFF64_T] (ftruncate): Add alias. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (ftruncate): Remove. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (ftruncate): Likewise. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
2016-11-08Fix rpcgen buffer overrun (bug 20790).Joseph Myers
Building with GCC 7 produces an error building rpcgen: rpc_parse.c: In function 'get_prog_declaration': rpc_parse.c:543:25: error: may write a terminating nul past the end of the destination [-Werror=format-length=] sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ ~~~~^ rpc_parse.c:543:5: note: format output between 5 and 14 bytes into a destination of size 10 sprintf (name, "%s%d", ARGNAME, num); /* default name of argument */ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ That buffer overrun is for the case where the .x file declares a program with a million arguments. The strcpy two lines above can generate a buffer overrun much more simply for a long argument name. The limit on length of line read by rpcgen (MAXLINESIZE == 1024) provides a bound on the buffer size needed, so this patch just changes the buffer size to MAXLINESIZE to avoid both possible buffer overruns. A testcase is added that rpcgen does not crash with a 500-character argument name, where it previously crashed. It would not at all surprise me if there are many other ways of crashing rpcgen with either valid or invalid input; fuzz testing would likely find various such bugs, though I don't think they are that important to fix (rpcgen is not that likely to be used with untrusted .x files as input). (As well as fuzz-findable bugs there are probably also issues when various int variables get overflowed on very large input.) The test infrastructure for rpcgen-not-crashing tests would need extending if tests are to be added for cases where rpcgen should produce an error, as opposed to cases where it should succeed. Tested for x86_64 and x86. [BZ #20790] * sunrpc/rpc_parse.c (get_prog_declaration): Increase buffer size to MAXLINESIZE. * sunrpc/bug20790.x: New file. * sunrpc/Makefile [$(run-built-tests) = yes] (rpcgen-tests): New variable. [$(run-built-tests) = yes] (tests-special): Add $(rpcgen-tests). [$(run-built-tests) = yes] ($(rpcgen-tests)): New rule.
2016-11-08Add localplt.data for sh.Joseph Myers
This patch adds a localplt.data file for sh so that test passes. The architecture-specific entries are for _Unwind_Find_FDE, _exit and __errno_location. Tested for sh3 and sh4. * sysdeps/unix/sysv/linux/sh/localplt.data: New file.
2016-11-08Add localplt.data for hppa.Joseph Myers
This patch adds a localplt.data file for hppa so that test passes. Architecture maintainers should feel free to clean up the sysdeps code so that some or all of the system-specific entries libc.so: _exit libc.so: __sigsetjmp libc.so: _IO_funlockfile libc.so: sigprocmask libc.so: __errno_location libpthread.so: __errno_location are no longer needed. Tested for hppa. Note: check-execstack and check-textrel still fail; you may wish to look at those to get to a clean baseline there (they are less obvious for people not familiar with the architecture). * sysdeps/unix/sysv/linux/hppa/localplt.data: New file.
2016-11-08Update alpha localplt.data.Joseph Myers
This patch updates alpha localplt.data so the localplt test passes in my compile-only all-ABIs glibc testing. The failures I see without this patch are: Missing required PLT reference: ld.so: __tls_get_addr Missing required PLT reference: ld.so: free Now, __tls_get_addr can be made optional. For free, rather than making it optional as in libc.so it seems better to mark all the malloc-related symbols in both libc.so and ld.so as allowing an R_ALPHA_GLOB_DAT relocation as an alternative to using a PLT entry, so this patch does so. Tested for alpha. * sysdeps/unix/sysv/linux/alpha/localplt.data: Make __tls_get_addr optional in ld.so. Allow R_ALPHA_GLOB_DAT relocation for malloc, calloc, realloc, free, memalign and __libc_memalign rather than making them optional.
2016-11-08Update nios2 localplt.data.Joseph Myers
This patch updates nios2 localplt.data so the localplt test passes in my compile-only all-ABIs glibc testing. A new PLT entry for __extendsfdf2 is added. Tested for nios2. * sysdeps/unix/sysv/linux/nios2/localplt.data: Add __extendsfdf2 for libc.so.
2016-11-08Consolidate lseek/lseek64/llseek implementationsAdhemerval Zanella
This patch consolidates all Linux lseek/lseek64/llseek implementation in on on sysdeps/unix/sysv/linux/lseek{64}.c. It also removes the llseek file and instead consolidate the LFS lseek implementation on lseek64.c as for other LFS symbols implementations. The general idea is: - lseek: ABIs that not define __OFF_T_MATCHES_OFF64_T will preferable use __NR__llseek if kernel supports it, otherwise they will use __NR_lseek. ABIs that defines __OFF_T_MATCHES_OFF64_T won't produce any symbol. - lseek64: ABIs with __OFF_T_MATCHES_OFF64_T will preferable use __NR_lseek (since it will use 64-bit arguments without low/high splitting) and __NR__llseek if __NR_lseek is not defined (for some ILP32 ports). - llseek: files will be removed and symbols will be aliased ot lseek64. ABI without __OFF_T_MATCHES_OFF64_T and without __NR_llseek (basically MIPS64n32 so far) are covered by building lseek with off_t as expected and lseek64 using __NR_lseek (as expected for off64_t being passed using 64-bit registers). For this consolidation I mantained the x32 assembly specific implementation because to correctly fix this it would required both the x32 fix for {INLINE,INTERNAL}_SYSCALL [1] and a wrapper to correctly subscribe it to return 64 bits instead of default 32 bits (as for times). It could a future cleanup. It is based on my previous {INTERNAL,INLINE}_SYSCALL_CALL macro [2], although it is mainly for simplification. Tested on x86_64, i686, aarch64, armhf, and powerpc64le. * nptl/Makefile (libpthread-routines): Remove ptw-llseek and add ptw-lseek64. * sysdeps/unix/sysv/linux/Makefile (sysdeps_routines): Remove llseek. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Likewise. * sysdeps/unix/sysv/linux/generic/wordsize-32/llseek.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/lseek.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/llseek.c: Likewise. * sysdeps/unix/sysv/linux/llseek.c: Remove file. * sysdeps/unix/sysv/linux/lseek.c: New file. * sysdeps/unix/sysv/linux/lseek64.c: Add default Linux implementation. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list: Remove lseek and __libc_lseek64 from auto-generation. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/lseek64.S: New file. [1] https://sourceware.org/ml/libc-alpha/2016-08/msg00443.html [2] https://sourceware.org/ml/libc-alpha/2016-08/msg00646.html
2016-11-07Write messages to stdout and use write_message instead of writeGabriel F. T. Gomes
Replaces calls to write on file descriptor 2 with calls to write_message, which writes to STDOUT_FILENO (1) and properly deals with the return of write.
2016-11-07Use write_message instead of writeGabriel F. T. Gomes
In the test cases, there are writes to stdout which do not check the result value. This patch replaces such occurrences with calls to write_message, which properly deals with the unused result. Tested for powerpc64le.
2016-11-07Make check-installed-headers.sh ignore sys/sysctl.h for x32.Joseph Myers
check-installed-headers tests were failing for x32 because of the x86 bits/sysctl.h containing a #error for x32. This patch makes the tests ignore sys/sysctl.h for x32, similar to the other special-casing of particular headers. Tested for x86_64 (full testing for -m64, compile-only for x32). * scripts/check-installed-headers.sh: Ignore sys/sysctl.h for x32.
2016-11-07Define __ASSUME_ST_INO_64_BIT on all platforms.Steve Ellcey
* sysdeps/unix/sysv/linux/alpha/kernel-features.h: #define __ASSUME_ST_INO_64_BIT as 0 * sysdeps/unix/sysv/linux/sh/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/fxstat64.c: Replace #ifdef with #if over the code where __ASSUME_ST_INO_64_BIT is used. * sysdeps/unix/sysv/linux/lxstat64.c: Likewise. * sysdeps/unix/sysv/linux/xstat64.c: Likewise. * sysdeps/unix/sysv/linux/xstatconv.c: Likewise.
2016-11-07nptl: Document the reason why __kind in pthread_mutex_t is part of the ABIFlorian Weimer
2016-11-07Document do_test in test-skeleton.cSteve Ellcey
* test-skeleton.c: Document do_test usage.
2016-11-06gconv.h: fix build with GCC 7Aurelien Jarno
gconv.h is using a flex array to define the __gconv_info member in an invalid way, causing GCC 7 to issue an error: | In file included from ../include/gconv.h:1:0, | from ../sysdeps/unix/sysv/linux/_G_config.h:32, | from ../libio/libio.h:31, | from ../include/libio.h:4, | from ../libio/stdio.h:74, | from ../include/stdio.h:5, | from test-math-isinff.cc:22: | ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_codecvt' | In file included from ../include/libio.h:4:0, | from ../libio/stdio.h:74, | from ../include/stdio.h:5, | from test-math-isinff.cc:22: | ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here | ../libio/libio.h:187:8: note: in the definition of 'struct _IO_codecvt' | In file included from ../include/gconv.h:1:0, | from ../sysdeps/unix/sysv/linux/_G_config.h:32, | from ../libio/libio.h:31, | from ../include/libio.h:4, | from ../libio/stdio.h:74, | from ../include/stdio.h:5, | from test-math-isinff.cc:22: | ../iconv/gconv.h:142:50: error: flexible array member '__gconv_info::__data' not at end of 'struct _IO_wide_data' | In file included from ../include/libio.h:4:0, | from ../libio/stdio.h:74, | from ../include/stdio.h:5, | from test-math-isinff.cc:22: | ../libio/libio.h:211:14: note: next member '_G_iconv_t _IO_codecvt::__cd_out' declared here | ../libio/libio.h:215:8: note: in the definition of 'struct _IO_wide_data' This is basically a revert to the code from 15 years ago. More details are available in the GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78039 Changelog: * iconv/gconv.h (__gconv_info): Define __data element using a zero-length array.
2016-11-04Speed up math/test-tgmath2.cSteve Ellcey
* math/test-tgmath2.c: Split up test function.