about summary refs log tree commit diff
path: root/sysdeps
Commit message (Collapse)AuthorAgeFilesLines
* Consolidate Linux mmap implementation (BZ#21270)Adhemerval Zanella2017-04-1223-565/+172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates all Linux mmap implementations on default sysdeps/unix/sysv/linux/mmap{64}.c one. To accomodate all required architecture specific requeriments a new internal header is created (mmap_internal.h) where each architecture add its specific code requirements. Currently only x86_64 (to define MMAP_PREPARE to add MAP_32BITS), s390 (which have a different kernel ABI for mmap), m68k (which have variable minimum page sizes), and MIPS n32 (which zero extend the offset to handle negative one correctly) redefine the new header. The patch also fixes BZ#21270 where default mmap64 on architectures which uses mmap2 silent truncates large offsets value (larger than 1 << (page shift + 8 * sizeof (off_t)) or 1<<44 on architectures with 4096 bytes page size). The new consolidate implementation returns EINVAL as allowed by POSIX. It also adds a tests for on current tst-mmap-offset one. I have run a full make check on x86_64, x86_64-32, i686, aarch64, armhf, powerpc, powerpc64le, sparc64, and sparcv9 without any regressions. I also ran some basic tests (tst-mmap-offset) on sh4, m68k, and on qemu simulated MIPS32 and MIPS64. [BZ #21270] * posix/tst-mmap-offset.c (do_prepare): New function. (do_test): Rename to do_test_bz18877 and use FAIL_RET. (do_test_bz21270): New function. * sysdeps/unix/sysv/linux/aarch64/mmap.c: Remove file. * sysdeps/unix/sysv/linux/arm/mmap.c: Remove file. * sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/hppa/mmap.c: Likewise. * sysdeps/unix/sysv/linux/i386/mmap.c: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap.S: Likewise. * sysdeps/unix/sysv/linux/m68k/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/mmap.S: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/mmap64.S: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/mmap.S: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/mmap64.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap.c: Likewise. * sysdeps/unix/sysv/linux/mmap_internal.h: New file. * sysdeps/unix/sysv/linux/m68k/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/s390/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/mmap_internal.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list: Remove mmap from auto-generation list. * sysdeps/unix/sysv/linux/mips/mips64/n32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mmap.c: New file. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Add check for invalid offsets and support for mmap2 syscall.
* powerpc: refactor memcmp and memmove IFUNC.Wainer dos Santos Moschetta2017-04-116-52/+19
| | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power4.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memmove-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/memcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memmove.S: Likewise.
* powerpc: refactor memcpy and mempcpy IFUNC.Wainer dos Santos Moschetta2017-04-1114-119/+46
| | | | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memcpy-a2.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memcpy-cell.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power4.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power6.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/mempcpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/a2/memcpy.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/cell/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power4/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power7/mempcpy.S: Likewise.
* powerpc: refactor memchr, memrchr, and rawmemchr IFUNC.Wainer dos Santos Moschetta2017-04-116-48/+21
| | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memchr-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memrchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/rawmemchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memchr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/memrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power7/rawmemchr.S: Likewise.
* powerpc: refactor memset IFUNC.Wainer dos Santos Moschetta2017-04-1110-85/+32
| | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/memset-power4.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/memset-power6.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/memset.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power4/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power6/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power7/memset.S: Likewise. * sysdeps/powerpc/powerpc64/power8/memset.S: Likewise.
* powerpc: refactor strcasestr and strstr IFUNC.Wainer dos Santos Moschetta2017-04-114-34/+14
| | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S: Define the strcasestr implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define strstr implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/power7/strstr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
* powerpc: refactor strchr, strchrnul, and strrchr IFUNC.Wainer dos Santos Moschetta2017-04-1111-97/+44
| | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strchr-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strchr-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchr-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchrnul-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strchrnul-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strchr.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strchrnul.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strrchr.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strchr.S: Likewise. * sysdeps/powerpc/powerpc64/strchr.S: Likewise.
* powerpc: refactor strnlen and strlen IFUNC.Wainer dos Santos Moschetta2017-04-118-64/+28
| | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strlen-power7.S: Define the strlen implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strlen-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strnlen-power7.S: Define the strnlen implementation name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/power7/strlen.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strnlen.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strlen.S: Likewise. * sysdeps/powerpc/powerpc64/strlen.S: Likewise.
* powerpc: refactor strcasecmp, strcmp, and strncmp IFUNC.Wainer dos Santos Moschetta2017-04-1119-171/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/strcasecmp_l-power7.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power8.S Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power4.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-power9.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncmp-ppc64.S: Likewise. * sysdeps/powerpc/powerpc64/power4/strncmp.S: Set a default function name if not defined and pass as parameter to macros accordingly. * sysdeps/powerpc/powerpc64/power7/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/power9/strncmp.S: Likewise. * sysdeps/powerpc/powerpc64/strcmp.S: Likewise. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* powerpc: refactor stpcpy, stpncpy, strcpy, and strncpy IFUNC.Wainer dos Santos Moschetta2017-04-119-99/+39
| | | | | | | | | | | | | | | | | | | | Clean up the IFUNC implementations for powerpc in order to remove unneeded macro definitions. Tested on ppc64le with and without --disable-multi-arch flag. * sysdeps/powerpc/powerpc64/multiarch/stpcpy-power8.S: Define the implementation-specific function name and remove unneeded macros definition. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strcpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/power7/strncpy.S: Set a default function name if not defined. * sysdeps/powerpc/powerpc64/power8/strcpy.S: Likewise. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise.
* Consolidate pthreadtype.h placementConsolidate pthreadtype.h placementAdhemerval Zanella2017-04-104-0/+1
| | | | | | | | | | | | | | | | | | | | | This patch moves all arch specific pthreadtypes.h to a similar path for all architectures (sysdeps/unix/sysv/<arch>/bits). No functional or build change is expected. The idea is mainly to organize the header placement for all architectures. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, tile{pro,gx}-linux-gnu, and x86_64-linux-gnu). * sysdeps/unix/sysv/linux/x86/Implies: New file. * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Move to ... * sysdeps/alpha/nptl/bits/pthreadtypes.h: ... here. * sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h: Move to ... * sysdeps/powerpc/nptl/bits/pthreadtypes.h: ... here. * sysdeps/x86/bits/pthreadtypes.h: Move to ... * sysdeps/x86/nptl/bits/pthreadtypes.h: ... here.
* Add sysdeps/x86/dl-procinfo.cH.J. Lu2017-04-103-28/+54
| | | | | | | | | | Add sysdeps/x86/dl-procinfo.c for x86 version of processor capability information to reduce duplication between i386 and x86_64 dl-procinfo.c. * sysdeps/i386/dl-procinfo.c: Include <sysdeps/x86/dl-procinfo.c>. * sysdeps/x86_64/dl-procinfo.c: Likewise. * sysdeps/x86/dl-procinfo.c: New file.
* Remove unneeded declarations from math_private.hGabriel F. T. Gomes2017-04-103-20/+2
| | | | | | | | | | | | | | | | | The declarations of many functions in math_private.h are not required since __MATHDECL and __MATHDECLX, in math.h, already provide the declarations for these functions. This patch removes the declarations from math_private.h. It also adds the inclusion of math.h to the files which depended on the declaration of functions in math_private.h. Tested for powerpc64le and s390x. * sysdeps/generic/math_private.h: Remove declarations of many functions that are already declared in math.h. * sysdeps/ieee754/ldbl-128/e_logl.c: Include math.h to get the declaration for __frexpl. * sysdeps/ieee754/ldbl-128ibm/e_logl.c: Include math.h to get the declarations for __scalbnl and fabsl.
* Check if SSE is available with HAS_CPU_FEATUREH.J. Lu2017-04-0715-14/+18
| | | | | | | | | | | | | | | | | | | | | | | | Similar to other CPU feature checks, check if SSE is available with HAS_CPU_FEATURE. * sysdeps/i386/fpu/fclrexcpt.c (__feclearexcept): Use HAS_CPU_FEATURE to check for SSE. * sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Likewise. * sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Likewise. * sysdeps/i386/fpu/fegetenv.c (__fegetenv): Likewise. * sysdeps/i386/fpu/fegetmode.c (fegetmode): Likewise. * sysdeps/i386/fpu/feholdexcpt.c (__feholdexcept): Likewise. * sysdeps/i386/fpu/fesetenv.c (__fesetenv): Likewise. * sysdeps/i386/fpu/fesetmode.c (fesetmode): Likewise. * sysdeps/i386/fpu/fesetround.c (__fesetround): Likewise. * sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise. * sysdeps/i386/fpu/fgetexcptflg.c (__fegetexceptflag): Likewise. * sysdeps/i386/fpu/fsetexcptflg.c (__fesetexceptflag): Likewise. * sysdeps/i386/fpu/ftestexcept.c (fetestexcept): Likewise. * sysdeps/i386/setfpucw.c (__setfpucw): Likewise. * sysdeps/x86/cpu-features.h (bit_cpu_SSE): New. (index_cpu_SSE): Likewise. (reg_SSE): Likewise.
* getopt: remove USE_NONOPTION_FLAGSZack Weinberg2017-04-071-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | glibc's implementation of getopt includes code to parse an environment variable named _XXX_GNU_nonoption_argv_flags_ (where XXX is the current process's PID in decimal); but all of it has been #ifdefed out since 2001, with no official way to turn it back on. According to commentary in our config.h.in, bash version 2.0 set this environment variable to indicate argv elements that were the result of glob expansion and therefore should not be treated as options, but the feature was "disabled later" because "it caused problems". According to bash's CHANGES file, "later" was release 2.01; it gives no more detail about what the problems were. Version 2.0 of bash was released on the last day of 1996, and version 2.01 in June of 1997. Twenty years later, I think it is safe to assume that this environment variable isn't coming back. * config.h.in (USE_NONOPTION_FLAGS): Remove. * csu/init-first.c: Remove all #ifdef USE_NONOPTION_FLAGS blocks. * sysdeps/mach/hurd/i386/init-first.c: Likewise. * posix/getopt_int.h: Likewise. * posix/getopt.c: Likewise. Also remove SWAP_FLAGS and the __libc_argc and __libc_argv externs, which were only used by #ifdef USE_NONOPTION_FLAGS blocks. * posix/getopt_init.c: Remove file. * posix/Makefile (routines): Remove getopt_init. * include/getopt.h: Don't declare __getopt_initialize_environment. * manual/getopt.texi: Remove mention of USE_NONOPTION_FLAGS in a comment.
* sparc: Fix .udiv plt on libcAdhemerval Zanella2017-04-064-0/+9
| | | | | | | | | | | | | | | | | | | | With the removal of divdi3 object from sparcv9-linux-gnu build, its definition came from libgcc and its functions internall calls .udiv. Since glibc also exports these symbols for compatibility reasons, it will end up creating PLT calls internally in libc.so. To avoid it, this patch uses the linker option --wrap to replace all the internal libc.so .udiv calls to the wrapper __wrap_.udiv. Along with strong alias in the udiv implementations, it makes linker do local calls. Checked on sparcv9-linux-gnu. * sysdeps/sparc/sparc32/Makefile (libc.so-gnulib): New rule. * sysdeps/sparc/sparc32/sparcv8/udiv.S (.udiv): Make a strong_alias to __wrap_.udiv. * sysdeps/sparc/sparc32/sparcv9/udiv.S (.udiv): Likewise. * sysdeps/sparc/sparc32/udiv.S (.udiv): Likewise.
* Build divdi3 only for architecture that required itAdhemerval Zanella2017-04-0610-11/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in [1], divdi3 object is only exported in a handful ABIs (i386, m68k, powerpc32, s390-32, and ia64), however it is built for all current architectures regardless. This patch refact the make rules for this object to so only the aforementioned architectures that actually require it builds it. Also, to avoid internal PLT calls to the exported symbol from the module, glibc uses an internal header (symbol-hacks.h) which is unrequired (and in fact breaks the build for architectures that intend to get symbol definitions from libgcc.a). The patch also changes it to create its own header (divdi3-symbol-hacks.h) and adjust the architectures that require it accordingly. I checked the build/check (with run-built-tests=no) on the following architectures (which I think must cover all supported ABI/builds) using GCC 6.3: aarch64-linux-gnu alpha-linux-gnu arm-linux-gnueabihf hppa-linux-gnu ia64-linux-gnu m68k-linux-gnu microblaze-linux-gnu mips64-n32-linux-gnu mips-linux-gnu mips64-linux-gnu nios2-linux-gnu powerpc-linux-gnu powerpc-linux-gnu-power4 powerpc64-linux-gnu powerpc64le-linux-gnu s390x-linux-gnu s390-linux-gnu sh4-linux-gnu sh4-linux-gnu-soft sparc64-linux-gnu sparcv9-linux-gnu tilegx-linux-gnu tilegx-linux-gnu-32 tilepro-linux-gnu x86_64-linux-gnu x86_64-linux-gnu-x32 i686-linux-gnu I only saw one regression on sparcv9-linux-gnu (extra PLT call to .udiv) which I address in next patch in the set. It also correctly build SH with GCC 7.0.1 (without any regression from c89721e25d). [1] https://sourceware.org/ml/libc-alpha/2017-03/msg00243.html * sysdeps/i386/symbol-hacks.h: New file. * sysdeps/m68k/symbol-hacks.h: New file. * sysdeps/powerpc/powerpc32/symbol-hacks.h: New file. * sysdeps/s390/s390-32/symbol-hacks.h: New file. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) = csu] (sysdep_routines): New rule: divdi3 object. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/m68k/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/Makefile [$(subdir) = csu] (sysdep_routines): Likewise. [$(subdir) = csu] (sysdep-only-routines): Likewise. [$(subdir) = csu] (CFLAGS-divdi3.c): Likewise. * sysdeps/wordsize-32/Makefile: Remove file. * sysdeps/wordsize-32/symbol-hacks.h: Definitions move to ... * sysdeps/wordsize-32/divdi3-symbol-hacks.h: ... here.
* powerpc64: Add POWER8 strnlenWainer dos Santos Moschetta2017-04-055-5/+473
| | | | | | | | | | | | | | | | | | | | | | | | Added strnlen POWER8 otimized for long strings. It delivers same performance as POWER7 implementation for short strings. This takes advantage of reasonably performing unaligned loads and bit permutes to check the first 1-16 bytes until quadword aligned, then checks in 64 bytes strides until unsafe, then 16 bytes, truncating the count if need be. Likewise, the POWER7 code is recycled for less than 32 bytes strings. Tested on ppc64 and ppc64le. * sysdeps/powerpc/powerpc64/multiarch/Makefile (sysdep_routines): Add strnlen-power8. * sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c (strnlen): Add __strnlen_power8 to list of strnlen functions. * sysdeps/powerpc/powerpc64/multiarch/strnlen-power8.S: New file. * sysdeps/powerpc/powerpc64/multiarch/strnlen.c (__strnlen): Add __strnlen_power8 to ifunc list. * sysdeps/powerpc/powerpc64/power8/strnlen.S: New file.
* Remove CALL_THREAD_FCT macroAdhemerval Zanella2017-04-043-74/+0
| | | | | | | | | | | | | | | | This patch removes CALL_THREAD_FCT macro usage and its defition for x86. For 32 bits it usage is only for force 16 stack alignment, however stack is already explicit aligned in clone syscall. For 64 bits and x32 it just a function call and there is no need to code it with inline assembly. Checked on i686-linux-gnu, x86_64-linux-gnu, and x86_64-linux-gnu-x32. * nptl/pthread_create.c (START_THREAD_DEFN): Remove CALL_THREAD_FCT macro usage. * sysdeps/i386/nptl/tls.h (CALL_THREAD_FCT): Remove definition. * sysdeps/x86_64/nptl/tls.h (CALL_THREAD_FCT): Likewise. * sysdeps/x86_64/32/nptl/tls.h: Remove file.
* Remove __ASSUME_REQUEUE_PIAdhemerval Zanella2017-04-045-9/+0
| | | | | | | | | | | | | | | | | | | | | | The new cond var implementation (ed19993b5b0d) removed all the __ASSUME_{REQUEUE_PI,FUTEX_LOCK_PI} internal usage so there is no need to keep defining it. This patch removes all USE_REQUEUE_PI and __ASSUME_REQUEUE_PI. It is as follow up from BZ#18463. Checked with a build for x86_64-linux-gnu, arm-linux-gnueabhf, m68-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu. * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_REQUEUE_PI): Likewise.
* S390: Clobber also r14 in TLS_LD, TLS_GD macros on 31bit.Stefan Liebler2017-04-041-4/+6
| | | | | | | | | | | | | | | | | | This patch also clobbers r14 in TLS_LD, TLS_GD macros on 31bit. This ensures that r14 isn't used to save and restore r12 while r14 is clobbered by the bas-instruction. As note: r12 can't be added to clobber list as gcc would fail with: error: PIC register clobbered by ‘12’ in ‘asm’ For 64bit this fix was already done in 2004 in the commit b80af23ac6973e69df6cd23d221fa44fffb21e17. ChangeLog: * sysdeps/s390/s390-32/tls-macros.h (TLS_LD, TLS_GD): Clobber also r14.
* posix_spawn: use a larger min stack for -fstack-check [BZ #21253]Mike Frysinger2017-04-031-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | When glibc is built with -fstack-check, trying to use posix_spawn can lead to segfaults due to gcc internally probing stack memory too far. The new spawn API will allocate a minimum of 1 page, but the stack checking logic might probe a couple of pages. When it tries to walk them, everything falls apart. The gcc internal docs [1] state the default interval checking is one page. Which means we need two pages (the current one, and the next probed). No target currently defines it larger. Further, it mentions that the default minimum stack size needed to recover from an overflow is 4/8KiB for sjlj or 8/12KiB for others. But some Linux targets (like mips and ppc) go up to 16KiB (and some non-Linux targets go up to 24KiB). Let's create each child with a minimum of 32KiB slack space to support them all, and give us future breathing room. No test is added as existing ones crash. Even a simple call is enough to trigger the problem: char *argv[] = { "/bin/ls", NULL }; posix_spawn(NULL, "/bin/ls", NULL, NULL, argv, NULL); [1] https://gcc.gnu.org/onlinedocs/gcc-6.3.0/gccint/Stack-Checking.html
* Fix more test-errno issuesAdhemerval Zanella2017-03-301-2/+7
| | | | | | | | | | | | | | | | | | This patch fixes some test-errno-linux unexpected returns for the tested syscalls on some older kernels (I saw it on a Linux 3.8 on armv7l). Basically: - inotify_add_watch: Linux v3.8 (676a0675c) removed the test to check at least one valid bit in flags (to return EINVAL). It was later added back in v3.9 (04df32fa1). - quotactl: returns ENOSYS for kernels not configured with CONFIG_QUOTA. Checked on x86_64-linux-gnu and armv7l-linux-gnueabihf. * sysdeps/unix/sysv/linux/test-errno-linux.c (do_test): Handle non expected inotify_add_watch and quotactl return.
* Change return type in the declaration of __ieee754_rem_pio2lGabriel F. T. Gomes2017-03-301-1/+1
| | | | | | | | | | | | | The implementation of __ieee754_rem_pio2l in ldbl-128, ldbl-128ibm, and ldbl-96 return the type int32_t, whereas math_private.h declares it as returning int. This patch changes the declaration to match the declaration in thoses directories, as well as it changes the stub implementation in math/e_rem_pio2l.c, similarly. * math/e_rem_pio2l.c (__ieee754_rem_pio2l): Change return type to int32_t. * sysdeps/generic/math_private.h: Declare __ieee754_rem_pio2l as returning int32_t.
* Fix i686 memchr overflow calculation (BZ#21182)Adhemerval Zanella2017-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes the regression added by 23d2770 for final address overflow calculation. The subtraction of the considered size (16) at line 120 is at wrong place, for sizes less than 16 subsequent overflow check will not take in consideration an invalid size (since the subtraction will be negative). Also, the lea instruction also does not raise the carry flag (CF) that is used in subsequent jbe to check for overflow. The fix is to follow x86_64 logic from 3daef2c where the overflow is first check and a sub instruction is issued. In case of resulting negative size, CF will be set by the sub instruction and a NULL result will be returned. The patch also add similar tests reported in bug report. Checked on i686-linux-gnu and x86_64-linux-gnu. * string/test-memchr.c (do_test): Add BZ#21182 checks for address near end of a page. * sysdeps/i386/i686/multiarch/memchr-sse2.S (__memchr): Fix overflow calculation.
* Consolidate set* Linux implementationAdhemerval Zanella2017-03-2864-379/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch consolidates the Linux setegid, seteuid, setgid, setgroups, setregid, setresgid, setresuid, setreuid, and setuid implementation on default sysdeps/unix/sysv/linux/set*.c implementation. It basically removes all the architecture define implementations and add support for __NR_set*32 syscall on Linux default implementation. 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/arm/setegid.c: Remove file. * sysdeps/unix/sysv/linux/arm/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/arm/setregid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/arm/setuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c: Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/i386/setregid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/i386/setuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setegid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setregid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/m68k/setuid.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sh/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sh/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sh/setuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setegid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/seteuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setgroups.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setregid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresgid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setresuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setreuid.c: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/setuid.c: Likewise. * sysdeps/unix/sysv/linux/setegid.c (setegid): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/setgid.c (setgid): Use __NR_setgid32 if defined. * sysdeps/unix/sysv/linux/setgroups.c (setgroups): Use __NR_setgroups32 if defined. * sysdeps/unix/sysv/linux/setregid.c (__setregid): Use __NR_setregid32 if defined. * sysdeps/unix/sysv/linux/setresgid.c (__setresgid): Use __NR_setresgid32 is defined. * sysdeps/unix/sysv/linux/setresuid.c (__setresuid): Use __NR_setresuid32 if defined. * sysdeps/unix/sysv/linux/setreuid.c (__setreuid): Use __NR_setreuid32 if defined. * sysdeps/unix/sysv/linux/setuid.c (__setuid): Use __NR_setuid32 if defined.
* Define more termios.h macros unconditionally for alpha (bug 21277).Joseph Myers2017-03-271-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | termios.h should define IUCLC for UNIX98 and older XSI standards. The sysdeps/unix/sysv/linux/alpha version defines it only if __USE_MISC, so causing some conform/ tests to fail. Other versions define it unconditionally (I* being a reserved namespace for this header); the API should be consistent between architectures in the absence of a clear reason for it to differ (and given that a symbol is part of the API on two architectures, I don't see any reason for the feature test macros required ever to differ between those architectures), so this patch makes the alpha version define it unconditionally as well. Two non-POSIX macros alongside it, IMAXBEL and IUTF8, are also defined unconditionally on other architectures, so this patch makes them consistent by defining them unconditionally on alpha as well. Tested (compilation only) with build-many-glibcs.py. [BZ #21277] * sysdeps/unix/sysv/linux/alpha/bits/termios.h (IUCLC): Define unconditionally. (IMAXBEL): Likewise. (IUTF8): Likewise.
* [AArch64] Update libm-test-ulpsSzabolcs Nagy2017-03-271-80/+88
| | | | * sysdeps/aarch64/libm-test-ulps: Update.
* x86-64: Improve branch predication in _dl_runtime_resolve_avx512_opt [BZ #21258]H.J. Lu2017-03-212-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Skylake server, _dl_runtime_resolve_avx512_opt is used to preserve the first 8 vector registers. The code layout is if only %xmm0 - %xmm7 registers are used preserve %xmm0 - %xmm7 registers if only %ymm0 - %ymm7 registers are used preserve %ymm0 - %ymm7 registers preserve %zmm0 - %zmm7 registers Branch predication always executes the fallthrough code path to preserve %zmm0 - %zmm7 registers speculatively, even though only %xmm0 - %xmm7 registers are used. This leads to lower CPU frequency on Skylake server. This patch changes the fallthrough code path to preserve %xmm0 - %xmm7 registers instead: if whole %zmm0 - %zmm7 registers are used preserve %zmm0 - %zmm7 registers if only %ymm0 - %ymm7 registers are used preserve %ymm0 - %ymm7 registers preserve %xmm0 - %xmm7 registers Tested on Skylake server. [BZ #21258] * sysdeps/x86_64/dl-trampoline.S (_dl_runtime_resolve_opt): Define only if _dl_runtime_resolve is defined to _dl_runtime_resolve_sse_vex. * sysdeps/x86_64/dl-trampoline.h (_dl_runtime_resolve_opt): Fallthrough to _dl_runtime_resolve_sse_vex.
* conformtest: Add x32 XFAILs for mq_attr element types (bug 21279).Joseph Myers2017-03-201-1/+1
| | | | | | | | | | | | | | | | | | POSIX specifies long as the type of elements of struct mq_attr. For x32, they are __syscall_slong_t (i.e. long long). This patch XFAILs the corresponding tests for x32 in the conformtest expectations (the bug should not be closed without an actual fix). Tested with build-many-glibcs.py. [BZ #21279] * sysdeps/unix/sysv/linux/x86_64/x32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): Update comment. * conform/data/mqueue.h-data (mq_attr.mq_flags): XFAIL for x86_64-x32-linux. (mq_attr.mq_maxmsg): Likewise. (mq_attr.mq_msgsize): Likewise. (mq_attr.mq_curmsgs): Likewise.
* conformtest: Add mips XFAIL for struct stat st_rdev type (bug 21278).Joseph Myers2017-03-201-1/+1
| | | | | | | | | | | | | | MIPS o32 struct stat has the wrong type of st_rdev. This patch XFAILs that test in the conformtest expectations for this case (the bug should not be closed without an actual fix, however). Tested with build-many-glibcs.py. [BZ #21278] * sysdeps/unix/sysv/linux/mips/mips32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): Update comment. * conform/data/sys/stat.h-data (stat.st_rdev): XFAIL for mips-o32-linux.
* Fix alpha termios.h NL2, NL3 namespace (bug 21268).Joseph Myers2017-03-201-2/+4
| | | | | | | | | | | | | | | sysdeps/unix/sysv/linux/alpha/bits/termios.h defines NL2 and NL3 for __USE_MISC || __USE_XOPEN. These should only be defined for __USE_MISC as they are not part of any standard namespace. This patch conditions them accordingly, matching the powerpc version of the header (the only other one in glibc that defines these macros). Tested (compilation only) with build-many-glibcs.py. [BZ #21268] * sysdeps/unix/sysv/linux/alpha/bits/termios.h (NL2): Define only if [__USE_MISC] (NL3): Likewise.
* posix_spawn: fix stack setup on ia64 [BZ #21275]Mike Frysinger2017-03-201-5/+6
| | | | | | | | | The ia64-specific clone2 call expects the base of the stack mapping and the stack size as sep arguments, not an initial stack value as on other stack-grows-down architectures. Reuse the stack-grows-up macro so we pass in the right stack base. Reported-by: Matt Turner <mattst88@gentoo.org>
* linux ttyname and ttyname_r: do not return wrong resultsChristian Brauner2017-03-193-8/+59
| | | | | | | | | | | | | If a link (say /proc/self/fd/0) pointing to a device, say /dev/pts/2, in a parent mount namespace is passed to ttyname, and a /dev/pts/2 exists (in a different devpts) in the current namespace, then it returns /dev/pts/2. But /dev/pts/2 is NOT the current tty, it is a different file and device. Detect this case and return ENODEV. Userspace can choose to take this as a hint that the fd points to a tty device but to act on the fd rather than the link. Signed-off-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
* conformtest: XFAIL tv_nsec tests for x32 (bug 16437).Joseph Myers2017-03-181-0/+5
| | | | | | | | | | | | | | | | | This patch XFAILs the conformtest tv_nsec tests for x32 so that the incorrect type does not potentially hide other failures. As this is not a fix for the bug, it should remain open in Bugzilla. Tested (compilation only) with build-many-glibcs.py. [BZ #16437] * sysdeps/unix/sysv/linux/x86_64/x32/Makefile [$(subdir) = conform] (conformtest-xfail-conds): New variable. * conform/data/signal.h-data (timespec.tv_nsec): XFAIL for x86_64-x32-linux. * conform/data/sys/select.h-data (timespec.tv_nsec): Likewise. * conform/data/sys/stat.h-data (timespec.tv_nsec): Likewise. * conform/data/time.h-data (timespec.tv_nsec): Likewise.
* Fix sparc64 bits/setjmp.h namespace (bug 21261).Joseph Myers2017-03-182-21/+22
| | | | | | | | | | | | | | | | | | sysdeps/unix/sysv/linux/sparc/bits/setjmp.h defines 64-bit __jmp_buf with a load of identifiers that are not part of any standard namespace, resulting in conform/ tests failing. This patch fixes this by moving those identifiers to the implementation namespace, so enabling the conform/ tests to pass for sparc64. Tested (compilation only) for sparc64 with build-many-glibcs.py. [BZ #21261] * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h [__WORDSIZE == 64 && !_ASM] (__sparc64_jmp_buf): Use reserved names for all fields. * sysdeps/sparc/sparc64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Update for jmp_buf field renaming. (_JMPBUF_UNWINDS_ADJ): Likewise.
* Use CPU_FEATURES_CPU_P to check if AVX is availableH.J. Lu2017-03-171-2/+1
| | | | | | | Don't use bit_cpu_AVX directly. * sysdeps/x86/cpu-features.c (init_cpu_features): Check AVX with CPU_FEATURES_CPU_P.
* Make alpha termios.h define IXANY unconditionally (bug 21259).Joseph Myers2017-03-171-1/+1
| | | | | | | | | | | | | | | | | sysdeps/unix/sysv/linux/alpha/bits/termios.h defines IXANY only if __USE_MISC. But it's in the base standard for POSIX.1:2008, and XSI-shaded in previous standards. This patch makes the header define it unconditionally, like other versions of this header do (it's always reserved by standards that don't require it, so defining unconditionally is OK by the standards). Tested (compilation only) for alpha with build-many-glibcs.py. Note that there are still termios.h conformtest failures after this patch because of other issues with the alpha version of this header. [BZ #21259] * sysdeps/unix/sysv/linux/alpha/bits/termios.h (IXANY): Define unconditionally, not just for [__USE_MISC].
* conformtest: Add mips XFAIL for struct stat st_dev type (bug 17786).Joseph Myers2017-03-171-0/+4
| | | | | | | | | | | | | | | | As noted in bug 17786, MIPS o32 struct stat has the wrong type of st_dev. This patch XFAILs that test in the conformtest expectations for this case (the test still fails after the patch because there's also a similar issue for st_rdev that needs reporting and XFAILing separately, and the bug should not be closed without an actual fix, not just XFAILing). Tested for mips with build-many-glibcs.py. [BZ #17786] * sysdeps/unix/sysv/linux/mips/mips32/Makefile: New file. * conform/data/sys/stat.h-data (stat.st_dev): XFAIL for mips-o32-linux.
* conformtest: Add alpha XFAIL for struct netent n_net type (bug 21260).Joseph Myers2017-03-171-0/+5
| | | | | | | | | | | | | | As noted in bug 21260, sysdeps/unix/sysv/linux/alpha/bits/netdb.h defines struct netent with n_net of type unsigned long instead of the correct uint32_t. This patch XFAILs that test in the conformtest expectations for alpha. (This is not a fix for the bug, and it should not be closed without an actual fix.) Tested for alpha with build-many-glibcs.py. [BZ #21260] * sysdeps/unix/sysv/linux/alpha/Makefile [$(subdir) = conform] (conformtest-xfail-conds): New variable.
* Remove C++ namespace handling from glibc headers.Joseph Myers2017-03-161-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add ifunc support for aarch64.Steve Ellcey2017-03-157-0/+205
| | | | | | | | | | | * 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.
* x86_64: fix static build of __mempcpy_chk for compilers defaulting to PIC/PIEMike Frysinger2017-03-151-1/+1
| | | | | | | | | | | | 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.
* Improve float range reduction accuracy near pi/2 (bug 21094).Joseph Myers2017-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* hppa: Fix setting of __libc_stack_endJohn David Anglin2017-03-151-5/+4
| | | | | | | | | | | | | | 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
* Fix test-errno issuesAdhemerval Zanella2017-03-152-7/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix test-math-vector-sincos.h aliasing.Joseph Myers2017-03-151-14/+14
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix missing posix_fadvise64 mips64 static build (BZ #21232)Adhemerval Zanella2017-03-141-0/+2
| | | | | | | | | | | 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.
* Remove _dl_platform_stringAndreas Schwab2017-03-146-36/+2
| | | | There are no non-trivial uses of _dl_platform_string.
* hurd: Make send/recv more posixishSamuel Thibault2017-03-132-2/+10
| | | | | | | | 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.