about summary refs log tree commit diff
Commit message (Collapse)AuthorAgeFilesLines
* Quote shell commands in logs from build-many-glibcs.py.Joseph Myers2016-11-182-1/+17
| | | | | | | | | | | | | | 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.
* MIPS: Add `.insn' to ensure a text label is defined as code not dataMaciej W. Rozycki2016-11-184-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Consolidate Linux setrlimit and getrlimit implementationAdhemerval Zanella2016-11-1742-147/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Actually use newly built host libraries in build-many-glibcs.py.Joseph Myers2016-11-172-0/+7
| | | | | | | | 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.
* Make Alpha <sys/user.h> self-contained.Joseph Myers2016-11-172-0/+5
| | | | | | | | | | | 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>.
* Enable linknamespace testing for libdl and libcrypt.Joseph Myers2016-11-162-9/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Fix crypt snprintf namespace (bug 20829).Joseph Myers2016-11-166-4/+19
| | | | | | | | | | | | | | | | | | | | | | 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.
* Correct comments in string.h re strcoll_l, strxfrm_l.Zack Weinberg2016-11-162-5/+8
| | | | | * string/string.h: Remove obsolete comment stating that strcoll_l and strxfrm_l have not yet been standardized.
* New internal function __access_noerrnoAdhemerval Zanella2016-11-168-6/+114
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix SH4 register-dump.h for soft-float.Joseph Myers2016-11-162-1/+6
| | | | | | | | | | 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__].
* Make SH ucontext always match current kernels.Joseph Myers2016-11-152-15/+6
| | | | | | | | | | | | | | | | | | | | | | | 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.
* manual: Remove non-existent mount options S_IMMUTABLE and S_APPEND [BZ #11235]Rical Jasan2016-11-152-14/+5
| | | | | These were removed in 2010, while addressing [BZ #11235]. This commit removes their documentation from the manual.
* ChangeLog: fix dateMike Frysinger2016-11-151-1/+1
|
* configure: accept __stack_chk_fail_local for ssp support too [BZ #20662]Denis Kaganovich2016-11-153-6/+19
| | | | | | | | | | | | | | 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
* s390x: Add hidden definition for __sigsetjmpFlorian Weimer2016-11-153-36/+57
|
* Fix build-many-glibcs.py style issues.Joseph Myers2016-11-142-17/+19
| | | | | | | | | | | * 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.
* Make tilegx32 install libraries in lib32 directories.Joseph Myers2016-11-143-0/+29
| | | | | | | | | | | | | 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.
* Forgot to add the ChangeLog to the previous commit, doh.Zack Weinberg2016-11-141-0/+3
|
* Fix build-and-build-again bug in sunrpc tests.Zack Weinberg2016-11-141-0/+1
| | | | | | | | | | 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.
* Fix typo in string/bits/string2.h.Zack Weinberg2016-11-142-1/+5
| | | | | | | | | | 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.
* [BZ #19239] Issue deprecation warnings on macro expansion.Zack Weinberg2016-11-143-35/+39
| | | | | | | | | | | | | | | | | | 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.
* Add script to build many glibc configurations.Joseph Myers2016-11-112-0/+1144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Ignore -Wmaybe-uninitialized in stdlib/bug-getcontext.c.Joseph Myers2016-11-112-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Make SH <sys/user.h> self-contained.Joseph Myers2016-11-112-0/+5
| | | | | | | | | | | 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>.
* Make sure tilepro uses kernel atomics fo atomic_storeChris Metcalf2016-11-102-0/+15
| | | | | | | | | | | | | | | | | | 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.
* Refactor some libm type-generic macros.Joseph Myers2016-11-105-99/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix sh4 build with __ASSUME_ST_INO_64_BIT redefinitionAdhemerval Zanella2016-11-102-0/+8
| | | | | | | | | | | | | | | | | | | | | | 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.
* Consolidate Linux access implementationAdhemerval Zanella2016-11-102-7/+13
| | | | | | | | | | | | 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.
* Add definitions to sysdeps/tile/tilepro/bits/wordsize.h.Steve Ellcey2016-11-102-0/+7
| | | | | * sysdeps/tile/tilepro/bits/wordsize.h: Define __WORDSIZE32_SIZE_ULONG and __WORDSIZE32_PTRDIFF_LONG.
* Regenerate ULPs for aarch64Siddhesh Poyarekar2016-11-102-2/+6
| | | | * sysdeps/aarch64/libm-test-ulps: Regenerated.
* Consolidate Linux truncate implementationsAdhemerval Zanella2016-11-0911-159/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Consolidate Linux ftruncate implementationsAdhemerval Zanella2016-11-0914-275/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix rpcgen buffer overrun (bug 20790).Joseph Myers2016-11-084-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add localplt.data for sh.Joseph Myers2016-11-082-0/+22
| | | | | | | | | | 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.
* Add localplt.data for hppa.Joseph Myers2016-11-082-0/+25
| | | | | | | | | | | | | | | | | | | | | 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.
* Update alpha localplt.data.Joseph Myers2016-11-082-11/+16
| | | | | | | | | | | | | | | | | | | | | | 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.
* Update nios2 localplt.data.Joseph Myers2016-11-082-0/+6
| | | | | | | | | | | 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.
* Consolidate lseek/lseek64/llseek implementationsAdhemerval Zanella2016-11-0813-111/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Write messages to stdout and use write_message instead of writeGabriel F. T. Gomes2016-11-079-54/+70
| | | | | | 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.
* Use write_message instead of writeGabriel F. T. Gomes2016-11-075-26/+37
| | | | | | | | 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.
* Make check-installed-headers.sh ignore sys/sysctl.h for x32.Joseph Myers2016-11-072-0/+27
| | | | | | | | | | | 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.
* Define __ASSUME_ST_INO_64_BIT on all platforms.Steve Ellcey2016-11-077-4/+18
| | | | | | | | | | | * 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.
* nptl: Document the reason why __kind in pthread_mutex_t is part of the ABIFlorian Weimer2016-11-0716-14/+49
|
* Document do_test in test-skeleton.cSteve Ellcey2016-11-072-1/+20
| | | | * test-skeleton.c: Document do_test usage.
* gconv.h: fix build with GCC 7Aurelien Jarno2016-11-062-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Speed up math/test-tgmath2.cSteve Ellcey2016-11-042-9/+126
| | | | * math/test-tgmath2.c: Split up test function.
* Do not generate UNRESOLVED results for run-built-tests = no.Joseph Myers2016-11-042-1/+11
| | | | | | | | | | | | | | | | | | | | | | Testing with run-built-tests = no generates many UNRESOLVED results in tests.sum (and so in the output of "make check"), for all the tests that are only compiled and not run in such a configuration. This doesn't seem useful in the "make check" output, and also causes "make check" to exist with error status even when all tests that can be run in such a configuration passed. This patch changes it not to consider those tests when generating subdir-tests.sum, and so tests.sum, so that you get a smaller number of tests considered in the final results rather than a huge pile of UNRESOLVED. Tested with a cross-compiler to ARM in a run-built-tests = no configuration. * Rules (tests-expected): New variable, depending on $(run-built-tests). (tests): Pass $(tests-expected) to merge-test-results.sh, not $(tests).
* Handle tests-unsupported if run-built-tests = no.Joseph Myers2016-11-042-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests-unsupported variable lists tests that should neither be compiled nor run, because some support needed to compile them is missing. The implementation of this feature involves having a rule to create .out files for these tests that takes precedence over the default rule. This does not work in the run-built-tests = no case (cross compiling without use of a wrapper to run the tests on a separate system, in which cases most tests are compiled only) because in that case the tests target depends on $(tests) to ensure all tests get compiled. This patch changes that dependency to filter out $(tests-unsupported). Tested with cross-compilation to ARM with GCC 5, where libstdc++ is missing some C++11 support because of the bug I fixed in <https://gcc.gnu.org/ml/gcc-patches/2015-10/msg01040.html> and so tests-unsupported is nonempty and the tests in question fail to compile. (When I originally observed the bug, it was with a native build / test simply using an x86_64 compiler that had been configured as a cross compiler to isolate it from the system headers / libraries, so the configuration issue applied to the compiler but run-built-tests was yes, so I don't observe the issue with tests-unsupported with that compiler.) * Rules [$(run-built-tests) = no] (tests): Do not depend on $(tests-unsupported).
* Fix sparc build due missing __WORDSIZE_TIME64_COMPAT32 definitionAdhemerval Zanella2016-11-042-0/+7
| | | | | | | | | | | This patch adds the missing Linux sparc definitions from d060cd0. Both value are copied from default sparc value [1] and with this fix now both sparc 32 and 64 bits builds on Linux. * sysdeps/unix/sysv/linux/sparc/bits/wordsize.h (__WORDSIZE_TIME64_COMPAT32): Define for both 32 and 64 bits. [1] sysdeps/sparc/sparc{32,64}/bits/wordsize.h
* Fix alpha sqrt fegetenv namespace (bug 20768).Joseph Myers2016-11-042-1/+5
| | | | | | | | | | | | | | | | | On alpha, sqrt (a C90 function) brings in references to fegetenv (C99), resulting in linknamespace test failures: [initial] __sqrt -> [libm.a(w_sqrt.o)] __ieee754_sqrt -> [libm.a(e_sqrt.o)] __feholdexcept -> [libm.a(feholdexcpt.o)] fegetenv This patch fixes this by making __feholdexcept call __fegetenv instead of fegetenv. Tested for Alpha (compilation only). [BZ #20768] * sysdeps/alpha/fpu/feholdexcpt.c (__feholdexcept): Call __fegetenv instead of fegetenv.