about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
Commit message (Collapse)AuthorAgeFilesLines
...
* i386: Remove syscall assembly codes with 6 argumentsH.J. Lu2015-10-155-268/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes i386 assembly implementation for mmap, mmap64, semtimeop now that i386 have 6 argument syscall support from C code and GCC 5 can inline syscalls with 6 arguments. We also compile mmap.c, mmap64.c and semtimedop.c with -fomit-frame-pointer since %ebp may be used to pass the 6th argument to syscall. Fo sysdeps/unix/sysv/linux/i386/mmap.c, with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <__mmap>: 0: sub $0x10,%esp 3: mov 0x28(%esp),%eax 7: mov %ebx,(%esp) a: mov 0x18(%esp),%ecx e: mov %esi,0x4(%esp) 12: mov 0x14(%esp),%ebx 16: mov %edi,0x8(%esp) 1a: mov 0x1c(%esp),%edx 1e: test $0xfff,%eax 23: mov 0x20(%esp),%esi 27: mov %ebp,0xc(%esp) 2b: mov 0x24(%esp),%edi 2f: jne 60 <__mmap+0x60> 31: shr $0xc,%eax 34: mov %eax,%ebp 36: mov $0xc0,%eax 3b: call *%gs:0x10 42: cmp $0xfffff000,%eax 47: ja 65 <__mmap+0x65> 49: mov (%esp),%ebx 4c: mov 0x4(%esp),%esi 50: mov 0x8(%esp),%edi 54: mov 0xc(%esp),%ebp 58: add $0x10,%esp 5b: ret 5c: lea 0x0(%esi,%eiz,1),%esi 60: mov $0xffffffea,%eax 65: mov (%esp),%ebx 68: mov 0x4(%esp),%esi 6c: mov 0x8(%esp),%edi 70: mov 0xc(%esp),%ebp 74: add $0x10,%esp 77: jmp 78 <__mmap+0x78> vs sysdeps/unix/sysv/linux/i386/mmap.S: <__mmap>: 0: push %ebp 1: push %ebx 2: push %esi 3: push %edi 4: mov 0x14(%esp),%ebx 8: mov 0x18(%esp),%ecx c: mov 0x1c(%esp),%edx 10: mov 0x20(%esp),%esi 14: mov 0x24(%esp),%edi 18: mov 0x28(%esp),%ebp 1c: test $0xfff,%ebp 22: mov $0xffffffea,%eax 27: jne 38 <__mmap+0x38> 29: shr $0xc,%ebp 2c: mov $0xc0,%eax 31: call *%gs:0x10 38: pop %edi 39: pop %esi 3a: pop %ebx 3b: pop %ebp 3c: cmp $0xfffff000,%eax 41: ja 44 <__mmap+0x44> 43: ret 44: call 45 <__mmap+0x45> 45: R_386_PC32 __x86.get_pc_thunk.cx 49: add $0x2,%ecx 4b: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 4f: mov 0x0(%ecx),%ecx 51: R_386_TLS_GOTIE __libc_errno 55: neg %eax 57: mov %eax,%gs:(%ecx) 5a: or $0xffffffff,%eax 5d: ret The C version has: 3: mov 0x28(%esp),%eax ... 1e: test $0xfff,%eax ... 31: sar $0xc,%eax 34: mov %eax,%ebp is due to missing $ebx register constraint for inline asm. We have to use "r" constraint with register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); and compiler chose %eax for offset (arg6) in if (offset & (MMAP_PAGE_UNIT - 1)) * sysdeps/unix/sysv/linux/i386/Makefile (CFLAGS-epoll_pwait.c): Add -fomit-frame-pointer. (CFLAGS-mmap.c): Likewise. (CFLAGS-mmap64.c): Likewise. (CFLAGS-semtimedop.c): Likewise. * sysdeps/unix/sysv/linux/i386/mmap.c: New file. * sysdeps/unix/sysv/linux/i386/mmap.S: Remove file. * sysdeps/unix/sysv/linux/i386/mmap64.S: Likewise. * sysdeps/unix/sysv/linux/i386/semtimedop.S: Likewise.
* Avoid PLT when calling __sched_getaffinity_newH.J. Lu2015-10-141-0/+7
| | | | | | | | | | | This patch adds an internal entry for __sched_getaffinity_new so that __sched_getaffinity_old calls __sched_getaffinity_new without going through PLT. [BZ #18822] * sysdeps/unix/sysv/linux/sched_getaffinity.c (__sched_getaffinity_new): Add libc_hidden_proto and libc_hidden_def.
* Support PLT and GOT references in local PIC checkH.J. Lu2015-10-141-8/+8
| | | | | | | | | | | | | | Linker in binutils 2.26 and newer generate GOT references instead PLT references when -z now is passed to linker. We need to extend scripts/localplt.awk to allow PLT or GOT references. [BZ #19007] * scripts/localplt.awk: Also allow GOT references. * sysdeps/unix/sysv/linux/i386/localplt.data: Mark _Unwind_Find_FDE, calloc, memalign, realloc and __libc_memalign with "+ REL R_386_GLOB_DAT". * sysdeps/x86_64/localplt.data: Mark calloc, memalign, realloc and __libc_memalign with "+ RELA R_X86_64_GLOB_DAT".
* Use INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-149-47/+39
| | | | | | | | | | | | | | | | | | | | | | This patch uses INTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE to avoid reading and writing errno directly so that we don't need to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error. * sysdeps/unix/sysv/linux/i386/brk.c (__brk): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/i386/fxstatat.c (__fxstatat): Likewise. * sysdeps/unix/sysv/linux/i386/setegid.c (setegid): Likewise. * sysdeps/unix/sysv/linux/i386/seteuid.c (seteuid): Likewise. * sysdeps/unix/sysv/linux/i386/fxstat.c (__fxstat): Use INTERNAL_SYSCALLINTERNAL_SYSCALL and INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/i386/lockf64.c (lockf64): Likewise. * sysdeps/unix/sysv/linux/i386/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Likewise. * sysdeps/unix/sysv/linux/i386/xstat.c (__xstat): Likewise.
* Use INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-1329-158/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces { __set_errno (ERRNO); return -1; } with INLINE_SYSCALL_ERROR_RETURN_VALUE (ERRNO). * sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Use INLINE_SYSCALL_ERROR_RETURN_VALUE. * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise. * sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise. * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise. * sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise. * sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise. * sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise. * sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise. * sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise. * sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise. * sysdeps/unix/sysv/linux/lutimes.c (lutimes): Likewise. * sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/lxstat64.c (___lxstat64): Likewise. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Likewise. * sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise. * sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise. * sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise. * sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise. * sysdeps/unix/sysv/linux/shmat.c (shmat): Likewise. * sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise. * sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise. * sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise. * sysdeps/unix/sysv/linux/xmknod.c (__xmknod): Likewise. * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise. * sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/xstatconv.c (__xstat_conv): Likewise. (__xstat64_conv): Likewise. (__xstat32_conv): Likewise.
* Add INLINE_SYSCALL_ERROR_RETURN_VALUEH.J. Lu2015-10-1322-85/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ia32 PIC, the first thing of many syscalls does is to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error, which is required for setting errno. In most cases, there are no errors. But we still call __x86.get_pc_thunk.reg. This patch adds INLINE_SYSCALL_ERROR_RETURN_VALUE so that i386 can optimize setting errno by branching to the internal __syscall_error without PLT. With i386 INLINE_SYSCALL_ERROR_RETURN_VALUE and i386 syscall inlining optimization for GCC 5, for sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <fchmodat>: 0: push %ebx 1: mov 0x14(%esp),%eax 5: mov 0x8(%esp),%ebx 9: mov 0xc(%esp),%ecx d: mov 0x10(%esp),%edx 11: test $0xfffffeff,%eax 16: jne 38 <fchmodat+0x38> 18: test $0x1,%ah 1b: jne 48 <fchmodat+0x48> 1d: mov $0x132,%eax 22: call *%gs:0x10 29: cmp $0xfffff000,%eax 2e: ja 58 <fchmodat+0x58> 30: pop %ebx 31: ret 32: lea 0x0(%esi),%esi 38: pop %ebx 39: mov $0xffffffea,%eax 3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error 43: nop 44: lea 0x0(%esi,%eiz,1),%esi 48: pop %ebx 49: mov $0xffffffa1,%eax 4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: pop %ebx 59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error instead of <fchmodat>: 0: sub $0x8,%esp 3: mov 0x18(%esp),%eax 7: mov %ebx,(%esp) a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 15: mov %edi,0x4(%esp) 19: test $0xfffffeff,%eax 1e: jne 70 <fchmodat+0x70> 20: test $0x1,%ah 23: jne 88 <fchmodat+0x88> 25: mov 0x14(%esp),%edx 29: mov 0x10(%esp),%ecx 2d: mov 0xc(%esp),%edi 31: xchg %ebx,%edi 33: mov $0x132,%eax 38: call *%gs:0x10 3f: xchg %edi,%ebx 41: cmp $0xfffff000,%eax 46: ja 58 <fchmodat+0x58> 48: mov (%esp),%ebx 4b: mov 0x4(%esp),%edi 4f: add $0x8,%esp 52: ret 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno 5e: neg %eax 60: mov %eax,%gs:(%edx) 63: mov $0xffffffff,%eax 68: jmp 48 <fchmodat+0x48> 6a: lea 0x0(%esi),%esi 70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno 76: movl $0x16,%gs:(%eax) 7d: mov $0xffffffff,%eax 82: jmp 48 <fchmodat+0x48> 84: lea 0x0(%esi,%eiz,1),%esi 88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno 8e: movl $0x5f,%gs:(%eax) 95: mov $0xffffffff,%eax 9a: jmp 48 <fchmodat+0x48> * sysdeps/unix/sysv/linux/sysdep.h: New file. * sysdeps/unix/sysv/linux/i386/sysdep.c: Likewise. * sysdeps/unix/sysv/linux/alpha/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. * sysdeps/unix/sysv/linux/arm/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/generic/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/hppa/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/i386/Makefile [$(subdir) == csu] (sysdep-dl-routines): Add sysdep. [$(subdir) == nptl] (libpthread-routines): Likewise. [$(subdir) == rt] (librt-routines): Likewise. * sysdeps/unix/sysv/linux/i386/clone.S (__clone): Don't check PIC when branching to SYSCALL_ERROR_LABEL. * sysdeps/unix/sysv/linux/i386/sysdep.S: Removed. * sysdeps/unix/sysv/linux/i386/sysdep.h: Include <sysdeps/unix/sysv/linux/sysdep.h>. (SYSCALL_ERROR_LABEL): Changed to __syscall_error. (SYSCALL_ERROR_ERRNO): Removed. (SYSCALL_ERROR_HANDLER): Changed to empty. (SYSCALL_ERROR_HANDLER_TLS_STORE): Likewise. (__syscall_error): New prototype. [IS_IN (libc)] (INLINE_SYSCALL): New macro. (INLINE_SYSCALL_ERROR_RETURN_VALUE): Likewise.
* Mark lseek/llseek as non-cancellableAdhemerval Zanella2015-10-093-3/+3
| | | | | | | | | | | | | This patch sets lseek/llseek for 64-bit, MIPS n32, and x86_32 as non- cancelable. This make it consistant with 32-bit platform. Tested on i686, x86_64, and x32. * sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (lseek): Set as non-cancelable. * sysdeps/unix/sysv/linux/wordsize-64/syscalls.list (llseek): Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/lseek.S (__libc_lseek64): Likewise.
* Move sysdeps/unix/sysv/linux/i386/i486/*.? to i386H.J. Lu2015-09-3030-254/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since glibc doesn't support i386 any more, we can move sysdeps/unix/sysv/linux/i386/i486/*.? to i386. [BZ #19006] * sysdeps/unix/sysv/linux/i386/i486/libc-lowlevellock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/libc-lowlevellock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/lll_timedlock_wait.c: Moved to ... * sysdeps/unix/sysv/linux/i386/lll_timedlock_wait.c: Here. * sysdeps/unix/sysv/linux/i386/i486/lll_timedwait_tid.c: Moved to ... * sysdeps/unix/sysv/linux/i386/lll_timedwait_tid.c: Here. * sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/lowlevellock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/lowlevelrobustlock.S: Moved to ... * sysdeps/unix/sysv/linux/i386/lowlevelrobustlock.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_barrier_wait.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_broadcast.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_signal.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_timedwait.S: Here. * sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Moved to ... * sysdeps/unix/sysv/linux/i386/pthread_cond_wait.S: Here. * sysdeps/unix/sysv/linux/i386/i586/libc-lowlevellock.S: Removed. * sysdeps/unix/sysv/linux/i386/i586/lll_timedlock_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lll_timedwait_tid.c: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/lowlevelrobustlock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_barrier_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_broadcast.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_signal.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_timedwait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i586/pthread_cond_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/libc-lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lll_timedlock_wait.c: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lll_timedwait_tid.c: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lowlevellock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/lowlevelrobustlock.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_barrier_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_broadcast.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_signal.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_wait.S: Likewise. * sysdeps/unix/sysv/linux/i386/i686/pthread_cond_timedwait.S: Replace ../i486/pthread_cond_timedwait.S with ../pthread_cond_timedwait.S.
* Use __libc_ptf_call in _longjmp_unwindH.J. Lu2015-09-181-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use __libc_ptf_call in _longjmp_unwind to avoid duplicated logic. On x86-64, I got jmp-unwind.os: _longjmp_unwind: movl __libc_pthread_functions_init(%rip), %eax testl %eax, %eax jne .L4 rep ret .L4: movq 304+__libc_pthread_functions(%rip), %rax movq %rsp, %rsi ror $2*8+1, %rax xor %fs:48, %rax jmp *%rax jmp-unwind.o: _longjmp_unwind: movl $__pthread_cleanup_upto, %eax testq %rax, %rax je .L1 movq %rsp, %rsi jmp __pthread_cleanup_upto .L1: rep ret * sysdeps/nptl/jmp-unwind.c: Include <libc-lock.h> instead of <nptl/pthreadP.h>. (_longjmp_unwind): Use __libc_ptf_call. * sysdeps/unix/sysv/linux/s390/jmp-unwind.c: Likewise.
* alpha: drop __ASSUME_FDATASYNCMike Frysinger2015-09-173-52/+0
| | | | | | Since we require a new enough kernel all the time, the __ASSUME_FDATASYNC define has been hardcoded to 1. That means we can delete the alpha file for fdatasync now and rely on the syscalls list like other ports.
* Use __pthread_setcancelstate in libc.aH.J. Lu2015-09-171-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch references __pthread_setcancelstate instead of pthread_setcancelstate in libc.a. [BZ #18970] * misc/error.c (error): Replace pthread_setcancelstate with __pthread_setcancelstate. (error_at_line): Likewise. * posix/wordexp.c (parse_comm): Likewise. * stdlib/fmtmsg.c (fmtmsg): Likewise. * nptl/forward.c (pthread_setcancelstate): Renamed to ... (__pthread_setcancelstate): This. (pthread_setcancelstate): Add an alias. * nptl/nptl-init.c (pthread_functions): Replace ptr_pthread_setcancelstate with ptr___pthread_setcancelstate. * sysdeps/nptl/pthread-functions.h (pthread_functions): Likewise. * nptl/pthreadP.h (__pthread_setcancelstate): Mark it with hidden_proto. * nptl/pthread_setcancelstate.c (__pthread_setcancelstate): Mark it with hidden_def. * sysdeps/nptl/libc-lockP.h (__pthread_setcancelstate): New. (pthread_setcancelstate): Renamed to ... (__pthread_setcancelstate): This. * sysdeps/unix/sysv/linux/fatal-prepare.h (FATAL_PREPARE): Use __libc_ptf_call with __pthread_setcancelstate.
* Restore sparc64 implementation of semctlAndreas Schwab2015-09-171-0/+54
| | | | | The sparc64 variant of the ipc syscall does not dereference the pointer argument for the SEMCTL operation.
* Remove extra va_start/va_end calls (bug 17244)Andreas Schwab2015-09-161-8/+0
|
* linux/getsysstats.c: use sysinfo() instead of parsing /proc/meminfoRasmus Villemoes2015-09-123-59/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiling git's test suite, Linus noted [1] that a disproportionately large amount of time was spent reading /proc/meminfo. This is done by the glibc functions get_phys_pages and get_avphys_pages, but they only need the MemTotal and MemFree fields, respectively. That same information can be obtained with a single syscall, sysinfo, instead of six: open, fstat, mmap, read, close, munmap. While sysinfo also provides more than necessary, it does a lot less work than what the kernel needs to do to provide the entire /proc/meminfo. Both strace -T and in-app microbenchmarks shows that the sysinfo() approach is roughly an order of magnitude faster. sysinfo() is much older than what glibc currently requires, so I don't think there's any reason to keep the old parsing code. Moreover, this makes get_[av]phys_pages work even in the absence of /proc. Linus noted that something as simple as 'bash -c "echo"' would trigger the reading of /proc/meminfo, but gdb says that many more applications than just bash are affected: Starting program: /bin/bash "-c" "echo" Breakpoint 1, __get_phys_pages () at ../sysdeps/unix/sysv/linux/getsysstats.c:283 283 ../sysdeps/unix/sysv/linux/getsysstats.c: No such file or directory. (gdb) bt So it seems that any application that uses qsort on a moderately sized array will incur this cost (once), which is obviously proportionately more expensive for lots of short-lived processes (such as the git test suite). [1] http://thread.gmane.org/gmane.linux.kernel/2019285 Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> * sysdeps/unix/sysv/linux/getsysstats.c (__get_phys_pages): Use sysinfo system call instead of parsing /proc/meminfo. * sysdeps/unix/sysv/linux/getsysstats.c (__get_avphys_pages): Likewise.
* Move bits/atomic.h to atomic-machine.h (bug 14912).Joseph Myers2015-09-115-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was noted in <https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the bits/*.h naming scheme should only be used for installed headers. This patch renames bits/atomic.h to atomic-machine.h to follow that convention. This is the only change in this series that needs to change the filename rather than simply removing a directory level (because both atomic.h and bits/atomic.h exist at present). Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #14912] * sysdeps/aarch64/bits/atomic.h: Move to ... * sysdeps/aarch64/atomic-machine.h: ...here. (_AARCH64_BITS_ATOMIC_H): Rename macro to _AARCH64_ATOMIC_MACHINE_H. * sysdeps/alpha/bits/atomic.h: Move to ... * sysdeps/alpha/atomic-machine.h: ...here. * sysdeps/arm/bits/atomic.h: Move to ... * sysdeps/arm/atomic-machine.h: ...here. Update comments. * bits/atomic.h: Move to ... * sysdeps/generic/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/i386/bits/atomic.h: Move to ... * sysdeps/i386/atomic-machine.h: ...here. * sysdeps/ia64/bits/atomic.h: Move to ... * sysdeps/ia64/atomic-machine.h: ...here. * sysdeps/m68k/coldfire/bits/atomic.h: Move to ... * sysdeps/m68k/coldfire/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/m68k/m680x0/m68020/bits/atomic.h: Move to ... * sysdeps/m68k/m680x0/m68020/atomic-machine.h: ...here. * sysdeps/microblaze/bits/atomic.h: Move to ... * sysdeps/microblaze/atomic-machine.h: ...here. * sysdeps/mips/bits/atomic.h: Move to ... * sysdeps/mips/atomic-machine.h: ...here. (_MIPS_BITS_ATOMIC_H): Rename macro to _MIPS_ATOMIC_MACHINE_H. * sysdeps/powerpc/bits/atomic.h: Move to ... * sysdeps/powerpc/atomic-machine.h: ...here. Update comments. * sysdeps/powerpc/powerpc32/bits/atomic.h: Move to ... * sysdeps/powerpc/powerpc32/atomic-machine.h: ...here. Update comments. Include <atomic-machine.h> instead of <bits/atomic.h>. * sysdeps/powerpc/powerpc64/bits/atomic.h: Move to ... * sysdeps/powerpc/powerpc64/atomic-machine.h: ...here. Include <atomic-machine.h> instead of <bits/atomic.h>. * sysdeps/s390/bits/atomic.h: Move to ... * sysdeps/s390/atomic-machine.h: ...here. * sysdeps/sparc/sparc32/bits/atomic.h: Move to ... * sysdeps/sparc/sparc32/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/sparc/sparc32/sparcv9/bits/atomic.h: Move to ... * sysdeps/sparc/sparc32/sparcv9/atomic-machine.h: ...here. * sysdeps/sparc/sparc64/bits/atomic.h: Move to ... * sysdeps/sparc/sparc64/atomic-machine.h: ...here. * sysdeps/tile/bits/atomic.h: Move to ... * sysdeps/tile/atomic-machine.h: ...here. * sysdeps/tile/tilegx/bits/atomic.h: Move to ... * sysdeps/tile/tilegx/atomic-machine.h: ...here. Include <sysdeps/tile/atomic-machine.h> instead of <sysdeps/tile/bits/atomic.h>. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/tile/tilepro/bits/atomic.h: Move to ... * sysdeps/tile/tilepro/atomic-machine.h: ...here. Include <sysdeps/tile/atomic-machine.h> instead of <sysdeps/tile/bits/atomic.h>. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/arm/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/arm/atomic-machine.h: ...here. Include <sysdeps/arm/atomic-machine.h> instead of <sysdeps/arm/bits/atomic.h>. * sysdeps/unix/sysv/linux/hppa/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/hppa/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h: ...here. (_BITS_ATOMIC_H): Rename macro to _ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/nios2/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/nios2/atomic-machine.h: ...here. (_NIOS2_BITS_ATOMIC_H): Rename macro to _NIOS2_ATOMIC_MACHINE_H. * sysdeps/unix/sysv/linux/sh/bits/atomic.h: Move to ... * sysdeps/unix/sysv/linux/sh/atomic-machine.h: ...here. * sysdeps/x86_64/bits/atomic.h: Move to ... * sysdeps/x86_64/atomic-machine.h: ...here. * include/atomic.h: Include <atomic-machine.h> instead of <bits/atomic.h>.
* Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).Joseph Myers2015-09-087-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was noted in <https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the bits/*.h naming scheme should only be used for installed headers. This patch renames bits/libc-lock.h to plain libc-lock.h and bits/libc-lockP.h to plain libc-lockP.h to follow that convention. Note that I don't know where libc-lockP.h comes from for Hurd (the Hurd libc-lock.h includes libc-lockP.h, but the only libc-lockP.h in the glibc source tree is for NPTL) - some unmerged patch? - but I updated the #include in the Hurd libc-lock.h anyway. Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #14912] * bits/libc-lock.h: Move to ... * sysdeps/generic/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/mach/hurd/bits/libc-lock.h: Move to ... * sysdeps/mach/hurd/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. [_LIBC]: Include <libc-lockP.h> instead of <bits/libc-lockP.h>. * sysdeps/mach/bits/libc-lock.h: Move to ... * sysdeps/mach/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/nptl/bits/libc-lock.h: Move to ... * sysdeps/nptl/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/nptl/bits/libc-lockP.h: Move to ... * sysdeps/nptl/libc-lockP.h: ...here. (_BITS_LIBC_LOCKP_H): Rename macro to _LIBC_LOCKP_H. * crypt/crypt_util.c: Include <libc-lock.h> instead of <bits/libc-lock.h>. * dirent/scandir-tail.c: Likewise. * dlfcn/dlerror.c: Likewise. * elf/dl-close.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-writev.h: Likewise. * elf/rtld.c: Likewise. * grp/fgetgrent.c: Likewise. * gshadow/fgetsgent.c: Likewise. * gshadow/sgetsgent.c: Likewise. * iconv/gconv_conf.c: Likewise. * iconv/gconv_db.c: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_trans.c: Likewise. * include/link.h: Likewise. * inet/getnameinfo.c: Likewise. * inet/getnetgrent.c: Likewise. * inet/getnetgrent_r.c: Likewise. * intl/bindtextdom.c: Likewise. * intl/dcigettext.c: Likewise. * intl/finddomain.c: Likewise. * intl/gettextP.h: Likewise. * intl/loadmsgcat.c: Likewise. * intl/localealias.c: Likewise. * intl/textdomain.c: Likewise. * libidn/idn-stub.c: Likewise. * libio/libioP.h: Likewise. * locale/duplocale.c: Likewise. * locale/freelocale.c: Likewise. * locale/newlocale.c: Likewise. * locale/setlocale.c: Likewise. * login/getutent_r.c: Likewise. * login/getutid_r.c: Likewise. * login/getutline_r.c: Likewise. * login/utmp-private.h: Likewise. * login/utmpname.c: Likewise. * malloc/mtrace.c: Likewise. * misc/efgcvt.c: Likewise. * misc/error.c: Likewise. * misc/fstab.c: Likewise. * misc/getpass.c: Likewise. * misc/mntent.c: Likewise. * misc/syslog.c: Likewise. * nis/nis_call.c: Likewise. * nis/nis_callback.c: Likewise. * nis/nss-default.c: Likewise. * nis/nss_compat/compat-grp.c: Likewise. * nis/nss_compat/compat-initgroups.c: Likewise. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nis/nss_nis/nis-alias.c: Likewise. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise. * nis/nss_nisplus/nisplus-alias.c: Likewise. * nis/nss_nisplus/nisplus-ethers.c: Likewise. * nis/nss_nisplus/nisplus-grp.c: Likewise. * nis/nss_nisplus/nisplus-hosts.c: Likewise. * nis/nss_nisplus/nisplus-initgroups.c: Likewise. * nis/nss_nisplus/nisplus-network.c: Likewise. * nis/nss_nisplus/nisplus-proto.c: Likewise. * nis/nss_nisplus/nisplus-pwd.c: Likewise. * nis/nss_nisplus/nisplus-rpc.c: Likewise. * nis/nss_nisplus/nisplus-service.c: Likewise. * nis/nss_nisplus/nisplus-spwd.c: Likewise. * nis/ypclnt.c: Likewise. * nptl/libc_pthread_init.c: Likewise. * nss/getXXbyYY.c: Likewise. * nss/getXXent.c: Likewise. * nss/getXXent_r.c: Likewise. * nss/nss_db/db-XXX.c: Likewise. * nss/nss_db/db-netgrp.c: Likewise. * nss/nss_db/nss_db.h: Likewise. * nss/nss_files/files-XXX.c: Likewise. * nss/nss_files/files-alias.c: Likewise. * nss/nsswitch.c: Likewise. * posix/regex_internal.h: Likewise. * posix/wordexp.c: Likewise. * pwd/fgetpwent.c: Likewise. * resolv/res_hconf.c: Likewise. * resolv/res_libc.c: Likewise. * shadow/fgetspent.c: Likewise. * shadow/lckpwdf.c: Likewise. * shadow/sgetspent.c: Likewise. * socket/opensock.c: Likewise. * stdio-common/reg-modifier.c: Likewise. * stdio-common/reg-printf.c: Likewise. * stdio-common/reg-type.c: Likewise. * stdio-common/vfprintf.c: Likewise. * stdio-common/vfscanf.c: Likewise. * stdlib/abort.c: Likewise. * stdlib/cxa_atexit.c: Likewise. * stdlib/fmtmsg.c: Likewise. * stdlib/random.c: Likewise. * stdlib/setenv.c: Likewise. * string/strsignal.c: Likewise. * sunrpc/auth_none.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * sunrpc/create_xid.c: Likewise. * sunrpc/key_call.c: Likewise. * sunrpc/rpc_thread.c: Likewise. * sysdeps/arm/backtrace.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/stdio-lock.h: Likewise. * sysdeps/generic/unwind-dw2-fde.c: Likewise. * sysdeps/i386/backtrace.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Likewise. * sysdeps/m68k/backtrace.c: Likewise. * sysdeps/mach/hurd/cthreads.c: Likewise. * sysdeps/mach/hurd/dirstream.h: Likewise. * sysdeps/mach/hurd/malloc-machine.h: Likewise. * sysdeps/nptl/malloc-machine.h: Likewise. * sysdeps/nptl/stdio-lock.h: Likewise. * sysdeps/posix/dirstream.h: Likewise. * sysdeps/posix/getaddrinfo.c: Likewise. * sysdeps/posix/system.c: Likewise. * sysdeps/pthread/aio_suspend.c: Likewise. * sysdeps/s390/s390-32/backtrace.c: Likewise. * sysdeps/s390/s390-64/backtrace.c: Likewise. * sysdeps/unix/sysv/linux/check_pf.c: Likewise. * sysdeps/unix/sysv/linux/if_index.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: Likewise. * sysdeps/unix/sysv/linux/shm-directory.c: Likewise. * sysdeps/unix/sysv/linux/system.c: Likewise. * sysdeps/x86_64/backtrace.c: Likewise. * time/alt_digit.c: Likewise. * time/era.c: Likewise. * time/tzset.c: Likewise. * wcsmbs/wcsmbsload.c: Likewise. * nptl/tst-initializers1.c (do_test): Refer to <libc-lock.h> instead of <bits/libc-lock.h> in comment.
* Terminate FDE before return trampoline in makecontext for powerpc (bug 18635)Andreas Schwab2015-09-041-0/+6
| | | | | | | | | This fixes tst-makecontext for PowerPC. [BZ #18635] * sysdeps/unix/sysv/linux/powerpc/powerpc32/makecontext.S (__makecontext): Terminate FDE before return label. (__novec_makecontext): Likewise.
* powerpc: Fix compiler warning in some syscalls.Carlos Eduardo Seo2015-09-041-1/+1
| | | | | | | | | Commit f4491417cc80b4a01e72e9d218af137765ee5918 introduced some warnings when building GLIBC with GCC 5.x. similar to those fixed by commit dd6e8af6ba1b8a95a7f1dc7422e5ea4ccc7fbd93. This patch fixes those warnings. * sysdeps/unix/sysv/linux/socketpair.c: Use the address of the first member of struct sv in syscall macro.
* Rename bits/m68k-vdso.h to m68k-vdso.h (bug 14912).Joseph Myers2015-09-045-4/+4
| | | | | | | | | | | | | | | | | It was noted in <https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the bits/*.h naming scheme should only be used for installed headers. This patch renames bits/m68k-vdso.h to plain m68k-vdso.h to follow that convention. [BZ #14912] * sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: Move to ... * sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: ...here. * sysdeps/unix/sysv/linux/m68k/coldfire/bits/atomic.h: Include <m68k-vdso.h> instead of <bits/m68k-vdso.h>. * sysdeps/unix/sysv/linux/m68k/init-first.c: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise.
* Add netinet/in.h values from Linux 4.2.Joseph Myers2015-09-011-0/+1
| | | | | | | | | | | | | | This patch adds new constants from Linux 4.2 to netinet/in.h: IPPROTO_MPLS and IP_BIND_ADDRESS_NO_PORT (both in include/uapi/linux/in.h in Linux; one directly in netinet/in.h, one in bits/in.h in glibc). Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). * inet/netinet/in.h (IPPROTO_MPLS): New enum value and macro. * sysdeps/unix/sysv/linux/bits/in.h (IP_BIND_ADDRESS_NO_PORT): New macro.
* Fix wordsize-32 mmap offset for negative value (BZ#18877)Adhemerval Zanella2015-08-281-4/+4
| | | | | | | | | | | | | | | | This patch fixes the default wordsize-32 mmap implementation offset calculation for negative values. Current code uses signed shift operation to calculate the multiple size to use with syscall and it is implementation defined. Change it to use a division base on mmap page size (default being as before, 4096). Tested on armv7hf. [BZ #18877] * posix/Makefile (tests): Add tst-mmap-offset. * posix/tst-mmap.c: New file. * sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c (__mmap): Fix offset calculation for negative values.
* powerpc: Revert to default atomic ops in elision codePaul E. Murphy2015-08-261-21/+0
| | | | | | | | | | | Power ISA 2.07B section B.5.5 relaxed the barrier requirement around a TLE enabled lock. It is now identical to a traditional lock. 2015-08-26 Paul E. Murphy <murphyp@linux.vnet.ibm.com> * sysdeps/unix/sysv/linux/powerpc/elision-lock.c (__arch_compare_and_exchange_val_32_acq): Remove and use common definition. ISA 2.07B no longer requires full sync.
* mips: siginfo.h: add SIGSYS details [BZ #18863]Mike Frysinger2015-08-261-0/+11
| | | | | Linux 3.13 added SIGSYS details to siginfo_t; update glibc's copy to keep in sync with it.
* S390: Add hwcaps value for vector facility.Stefan Liebler2015-08-261-0/+1
| | | | | | | | | | | | | | | The HWCAP_S390_VX flag in hwcap field of auxiliary vector indicates if the vector facility is available and the kernel is aware of it. This can be tested with LD_SHOW_AUXV=1 <prog>. Currently it does not show te, because it was not incremented by commit "S/390: Add hwcap value for transactional execution.". Thus _DL_HWCAP_COUNT is incremented by two. ChangeLog: * sysdeps/s390/dl-procinfo.c (_dl_s390_platforms): Add vector flag. * sysdeps/s390/dl-procinfo.h: Add vector capability. * sysdeps/unix/sysv/linux/s390/bits/hwcap.h (HWCAP_S390_VX): Define.
* Don't run tst-getpid2 with LD_BIND_NOW=1H.J. Lu2015-08-251-5/+0
| | | | | | | | Since _dl_x86_64_save_sse and _dl_x86_64_restore_sse are removed now, we don't need to run tst-getpid2 with LD_BIND_NOW=1. [BZ #11214] * sysdeps/unix/sysv/linux/Makefile (tst-getpid2-ENV): Removed.
* Call direct system calls for socket operationsRajalakshmi Srinivasaraghavan2015-08-2518-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | Explicit system calls for the socket operations were added in Linux kernel in commit 86250b9d12ca for powerpc. This patch make use of those instead of calling socketcall to save number of cycles on networking syscalls. 2015-08-25 Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> * sysdeps/unix/sysv/linux/powerpc/kernel-features.h: Define new macros. * sysdeps/unix/sysv/linux/accept.c: Call direct system call. * sysdeps/unix/sysv/linux/bind.c: Call direct system call. * sysdeps/unix/sysv/linux/connect.c: Call direct system call. * sysdeps/unix/sysv/linux/getpeername.c: Call direct system call. * sysdeps/unix/sysv/linux/getsockname.c: Call direct system call. * sysdeps/unix/sysv/linux/getsockopt.c: Call direct system call. * sysdeps/unix/sysv/linux/listen.c: Call direct system call. * sysdeps/unix/sysv/linux/recv.c: Call direct system call. * sysdeps/unix/sysv/linux/recvfrom.c: Call direct system call. * sysdeps/unix/sysv/linux/recvmsg.c: Call direct system call. * sysdeps/unix/sysv/linux/send.c: Call direct system call. * sysdeps/unix/sysv/linux/sendmsg.c: Call direct system call. * sysdeps/unix/sysv/linux/sendto.c: Call direct system call. * sysdeps/unix/sysv/linux/setsockopt.c: Call direct system call. * sysdeps/unix/sysv/linux/shutdown.c: Call direct system call. * sysdeps/unix/sysv/linux/socket.c: Call direct system call. * sysdeps/unix/sysv/linux/socketpair.c: Call direct system call.
* powerpc: Fix tabort usage in syscallsPaul E. Murphy2015-08-251-0/+1
| | | | | | | | | | | | | | | | | | | Fix usage of tabort in generated syscalls. r0 has special meaning when used with this instruction, thus it will not generate persistent errors, nor return an error code. This mitigates poor CPU usage when performing elided critical sections. Additionally, transactions should be aborted when entering a user invoked syscall. Otherwise the results of the transaction may be undefined. 2015-08-25 Paul E. Murphy <murphyp@linux.vnet.ibm.com> * sysdeps/powerpc/powerpc32/sysdep.h (ABORT_TRANSACTION): Use register other than r0 for tabort, it has special meaning. * sysdeps/powerpc/powerpc64/sysdep.h (ABORT_TRANSACTION): Likewise * sysdeps/unix.sysv/linux/powerpc/syscall.S (syscall): Abort transaction before starting syscall.
* Remove __ASSUME_IPC64Andreas Schwab2015-08-2423-706/+1
| | | | | | | PowerPC has always used __IPC_64 like most other architectures, which means that __ASSUME_IPC64 can be always true. Also, all other architecture implementations that use the ipc syscall are effectively identical to the generic version and can be removed.
* Revert "Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURN"H.J. Lu2015-08-2162-268/+292
| | | | This reverts commit 0c5b8b5941e036dcaac69cecee9f01fdf9218e6e.
* Revert "Fix a typo in linux lxstat.c"H.J. Lu2015-08-211-2/+2
| | | | This reverts commit e4ad5e722cec9a274cd84585d9c33f696e36f847.
* Fix a typo in linux lxstat.cH.J. Lu2015-08-211-2/+2
| | | | * sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Fix a typo.
* Add INLINE_SYSCALL_RETURN/INLINE_SYSCALL_ERROR_RETURNH.J. Lu2015-08-2162-292/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ia32 PIC, the first thing of many syscalls does is to call __x86.get_pc_thunk.reg to load PC into reg in case there is an error, which is required for setting errno. In most cases, there are no errors. But we still call __x86.get_pc_thunk.reg. This patch adds INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN so that i386 can optimize setting errno by branching to the internal __syscall_error without PLT. INLINE_SYSCALL_ERROR_RETURN is designed to take the negative error number returned from the majority of Linux kernels for which negating is a no-op with INTERNAL_SYSCALL_ERRNO. With i386 INLINE_SYSCALL_RETURN, INLINE_SYSCALL_ERROR_RETURN and i386 syscall inlining optimization for GCC 5, for sysdeps/unix/sysv/linux/fchmodat.c with -O2 -march=i686 -mtune=generic, GCC 5.2 now generates: <fchmodat>: 0: push %ebx 1: mov 0x14(%esp),%eax 5: mov 0x8(%esp),%ebx 9: mov 0xc(%esp),%ecx d: mov 0x10(%esp),%edx 11: test $0xfffffeff,%eax 16: jne 38 <fchmodat+0x38> 18: test $0x1,%ah 1b: jne 48 <fchmodat+0x48> 1d: mov $0x132,%eax 22: call *%gs:0x10 29: cmp $0xfffff000,%eax 2e: ja 58 <fchmodat+0x58> 30: pop %ebx 31: ret 32: lea 0x0(%esi),%esi 38: pop %ebx 39: mov $0xffffffea,%eax 3e: jmp 3f <fchmodat+0x3f> 3f: R_386_PC32 __syscall_error 43: nop 44: lea 0x0(%esi,%eiz,1),%esi 48: pop %ebx 49: mov $0xffffffa1,%eax 4e: jmp 4f <fchmodat+0x4f> 4f: R_386_PC32 __syscall_error 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: pop %ebx 59: jmp 5a <fchmodat+0x5a> 5a: R_386_PC32 __syscall_error instead of <fchmodat>: 0: sub $0x8,%esp 3: mov 0x18(%esp),%eax 7: mov %ebx,(%esp) a: call b <fchmodat+0xb> b: R_386_PC32 __x86.get_pc_thunk.bx f: add $0x2,%ebx 11: R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 15: mov %edi,0x4(%esp) 19: test $0xfffffeff,%eax 1e: jne 70 <fchmodat+0x70> 20: test $0x1,%ah 23: jne 88 <fchmodat+0x88> 25: mov 0x14(%esp),%edx 29: mov 0x10(%esp),%ecx 2d: mov 0xc(%esp),%edi 31: xchg %ebx,%edi 33: mov $0x132,%eax 38: call *%gs:0x10 3f: xchg %edi,%ebx 41: cmp $0xfffff000,%eax 46: ja 58 <fchmodat+0x58> 48: mov (%esp),%ebx 4b: mov 0x4(%esp),%edi 4f: add $0x8,%esp 52: ret 53: nop 54: lea 0x0(%esi,%eiz,1),%esi 58: mov 0x0(%ebx),%edx 5a: R_386_TLS_GOTIE __libc_errno 5e: neg %eax 60: mov %eax,%gs:(%edx) 63: mov $0xffffffff,%eax 68: jmp 48 <fchmodat+0x48> 6a: lea 0x0(%esi),%esi 70: mov 0x0(%ebx),%eax 72: R_386_TLS_GOTIE __libc_errno 76: movl $0x16,%gs:(%eax) 7d: mov $0xffffffff,%eax 82: jmp 48 <fchmodat+0x48> 84: lea 0x0(%esi,%eiz,1),%esi 88: mov 0x0(%ebx),%eax 8a: R_386_TLS_GOTIE __libc_errno 8e: movl $0x5f,%gs:(%eax) 95: mov $0xffffffff,%eax 9a: jmp 48 <fchmodat+0x48> * sysdeps/unix/sysdep.h (INLINE_SYSCALL_RETURN): New. (INLINE_SYSCALL_ERROR_RETURN): Likewise. * sysdeps/unix/sysv/linux/adjtime.c (ADJTIME): Use INLINE_SYSCALL_RETURN and INLINE_SYSCALL_ERROR_RETURN. * sysdeps/unix/sysv/linux/aio_sigqueue.c (__aio_sigqueue): Likewise. * sysdeps/unix/sysv/linux/dl-openat64.c (openat64): Likewise. * sysdeps/unix/sysv/linux/eventfd.c (eventfd): Likewise. * sysdeps/unix/sysv/linux/faccessat.c (faccessat): Likewise. * sysdeps/unix/sysv/linux/fchmodat.c (fchmodat): Likewise. * sysdeps/unix/sysv/linux/fcntl.c (do_fcntl): Likewise. * sysdeps/unix/sysv/linux/fstatfs64.c (__fstatfs64): Likewise. * sysdeps/unix/sysv/linux/ftruncate64.c (__ftruncate64): Likewise. * sysdeps/unix/sysv/linux/futimens.c (futimens): Likewise. * sysdeps/unix/sysv/linux/futimes.c (__futimes): Likewise. * sysdeps/unix/sysv/linux/futimesat.c (futimesat): Likewise. * sysdeps/unix/sysv/linux/fxstat.c (__fxstat): Likewise. * sysdeps/unix/sysv/linux/fxstat64.c (___fxstat64): Likewise. * sysdeps/unix/sysv/linux/fxstatat.c (__fxstatat): Likewise. * sysdeps/unix/sysv/linux/fxstatat64.c (__fxstatat64): Likewise. * sysdeps/unix/sysv/linux/gai_sigqueue.c (__gai_sigqueue): Likewise. * sysdeps/unix/sysv/linux/getpriority.c (__getpriority): Likewise. * sysdeps/unix/sysv/linux/getrlimit64.c (__getrlimit64): Likewise. * sysdeps/unix/sysv/linux/llseek.c (__llseek): Likewise. * sysdeps/unix/sysv/linux/lutimes.c (lutimes): Likewise. * sysdeps/unix/sysv/linux/lxstat.c (__lxstat): Likewise. * sysdeps/unix/sysv/linux/lxstat64.c (___lxstat64): Likewise. * sysdeps/unix/sysv/linux/mmap64.c (__mmap64): Likewise. * sysdeps/unix/sysv/linux/mq_close.c (mq_close): Likewise. * sysdeps/unix/sysv/linux/mq_open.c (__mq_open): Likewise. * sysdeps/unix/sysv/linux/mq_unlink.c (mq_unlink): Likewise. * sysdeps/unix/sysv/linux/msgget.c (msgget): Likewise. * sysdeps/unix/sysv/linux/prlimit.c (prlimit): Likewise. * sysdeps/unix/sysv/linux/pt-raise.c (raise): Likewise. * sysdeps/unix/sysv/linux/raise.c (raise): Likewise. * sysdeps/unix/sysv/linux/readahead.c (__readahead): Likewise. * sysdeps/unix/sysv/linux/reboot.c (reboot): Likewise. * sysdeps/unix/sysv/linux/semget.c (semget): Likewise. * sysdeps/unix/sysv/linux/semop.c (semop): Likewise. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Likewise. * sysdeps/unix/sysv/linux/setrlimit64.c (setrlimit64): Likewise. * sysdeps/unix/sysv/linux/shmat.c (shmat): Likewise. * sysdeps/unix/sysv/linux/shmdt.c (shmdt): Likewise. * sysdeps/unix/sysv/linux/shmget.c (shmget): Likewise. * sysdeps/unix/sysv/linux/signalfd.c (signalfd): Likewise. * sysdeps/unix/sysv/linux/sigpending.c (sigpending): Likewise. * sysdeps/unix/sysv/linux/sigprocmask.c ( __sigprocmask): Likewise. * sysdeps/unix/sysv/linux/sigqueue.c (__sigqueue): Likewise. * sysdeps/unix/sysv/linux/speed.c (cfsetospeed): Likewise. * sysdeps/unix/sysv/linux/statfs64.c (__statfs64): Likewise. * sysdeps/unix/sysv/linux/sysctl.c (__sysctl): Likewise. * sysdeps/unix/sysv/linux/tcsendbrk.c (tcsendbreak): Likewise. * sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise. * sysdeps/unix/sysv/linux/timer_getoverr.c (timer_getoverrun): Likewise. * sysdeps/unix/sysv/linux/timer_gettime.c (timer_gettime): Likewise. * sysdeps/unix/sysv/linux/timer_settime.c (timer_settime): Likewise. * sysdeps/unix/sysv/linux/truncate64.c (truncate64): Likewise. * sysdeps/unix/sysv/linux/ustat.c (ustat): Likewise. * sysdeps/unix/sysv/linux/utimensat.c (utimensat): Likewise. * sysdeps/unix/sysv/linux/utimes.c (__utimes): Likewise. * sysdeps/unix/sysv/linux/xmknod.c (__xmknod): Likewise. * sysdeps/unix/sysv/linux/xmknodat.c (__xmknodat): Likewise. * sysdeps/unix/sysv/linux/xstat.c (__xstat): Likewise. * sysdeps/unix/sysv/linux/xstat64.c (___xstat64): Likewise. * sysdeps/unix/sysv/linux/xstatconv.c (__xstat_conv): Likewise. (__xstat64_conv): Likewise. (__xstat32_conv): Likewise. * sysdeps/unix/sysv/linux/sched_getaffinity.c (__sched_getaffinity_new): Add libc_hidden_proto and libc_hidden_def. Use INLINE_SYSCALL_ERROR_RETURN.
* Move x86_64 init-arch.h to sysdeps/x86/init-arch.hH.J. Lu2015-08-201-1/+0
| | | | | | | | | | | | Move sysdeps/x86_64/multiarch/init-arch.h to sysdeps/x86/init-arch.h which can be used for both i386 and x86_64. * sysdeps/i386/i686/multiarch/init-arch.h: Removed. * sysdeps/unix/sysv/linux/x86/init-arch.h: Likewise. * sysdeps/x86_64/cacheinfo.c: Include <init-arch.h> instead of "multiarch/init-arch.h". * sysdeps/x86_64/multiarch/init-arch.h: Renamed to ... * sysdeps/x86/init-arch.h: This.
* Remove x86 init-arch.cH.J. Lu2015-08-201-1/+0
| | | | | | | | Both files include sysdeps/x86_64/multiarch/init-arch.c which has been removed. * sysdeps/i386/i686/multiarch/init-arch.c: Removed. * sysdeps/unix/sysv/linux/x86/init-arch.c: Likewise.
* Mark __xstatXX_conv as hiddenH.J. Lu2015-08-191-3/+6
| | | | | | | | | | | | __xstat_conv, __xstat64_conv and __xstat32_conv are internal to glibc. They should be marked as hidden so that they can't be called without PLT. [BZ #18822] * sysdeps/unix/sysv/linux/xstatconv.h (__xstat_conv): Add attribute_hidden. (__xstat64_conv): Likewise. (__xstat32_conv): Likewise.
* Call __setcontext with HIDDEN_JUMPTARGETH.J. Lu2015-08-192-6/+2
| | | | | | | | | | | i386 __makecontext should call __setcontext with HIDDEN_JUMPTARGET. [BZ #18822] * sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext): Don't load %ebx when calling __setcontext. Call __setcontext with HIDDEN_JUMPTARGET. * sysdeps/unix/sysv/linux/i386/setcontext.S (__setcontext): Add libc_hidden_def.
* Use x86-64 cacheinfo.c and sysconf.c for x86H.J. Lu2015-08-193-510/+0
| | | | | | | | | | | | | | | Since _dl_x86_cpu_features is always available, we can use x86-64 cacheinfo.c and sysconf.c for both i386 and x86-64. * sysdeps/i386/i686/Makefile [$(subdir) == string] (sysdep_routines): Moved to ... * sysdeps/i386/Makefile: Here. * sysdeps/i386/i686/cacheinfo.c: Moved to ... * sysdeps/i386/cacheinfo.c: Here. * sysdeps/unix/sysv/linux/i386/sysconf.c: Removed. * sysdeps/unix/sysv/linux/i386/i686/sysconf.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysconf.c: Moved to ... * sysdeps/unix/sysv/linux/x86/sysconf.c: Here.
* hppa: timerfd.h: move to common sys/timerfd.hMike Frysinger2015-08-181-33/+3
| | | | | Use the common sys/timerfd.h to avoid duplication and move the arch-specific settings into bits/timerfd.h.
* hppa: signalfd.h: move to common sys/signalfd.hMike Frysinger2015-08-181-39/+3
| | | | | Use the common sys/signalfd.h to avoid duplication and move the arch-specific settings into bits/signalfd.h.
* hppa: inotify.h: move to common sys/inotify.hMike Frysinger2015-08-182-106/+29
| | | | | Use the common sys/inotify.h to avoid duplication and move the arch-specific settings into bits/inotify.h.
* hppa: eventfd.h: move to common sys/eventfd.hMike Frysinger2015-08-181-26/+4
| | | | | Use the common sys/eventfd.h to avoid duplication and move the arch-specific settings into bits/eventfd.h.
* hppa: epoll.h: move to common sys/epoll.hMike Frysinger2015-08-182-143/+27
| | | | | Use the common sys/epoll.h to avoid duplication and move the arch-specific settings into bits/epoll.h.
* hppa: sigaction.h: update define export based on __USE_XOPEN2K8Mike Frysinger2015-08-181-0/+2
| | | | | This brings hppa in line with other ports by exporting a few more defines based on the __USE_XOPEN2K8 define and not just __USE_MISC.
* hppa: shm.h: add SHM_EXECMike Frysinger2015-08-181-0/+1
| | | | This brings hppa in line with all the other arches.
* hppa: drop __ASSUME_LWS_CAS defineMike Frysinger2015-08-182-11/+2
| | | | | We require recent enough kernels for this now, and we've been hardcoding it to 1, so drop it entirely now.
* Add version set GLIBC_2.19 for linux/powerpcAndreas Schwab2015-08-171-0/+4
|
* Don't include <cpuid.h> in elision-conf.hH.J. Lu2015-08-131-1/+0
| | | | | | | Don't include the unused <cpuid.h> in Linux/x86 elision-conf.h. * sysdeps/unix/sysv/linux/x86/elision-conf.h: Don't include <cpuid.h>.
* Update x86 elision-conf.c for <cpu-features.h>H.J. Lu2015-08-131-2/+2
| | | | | | | | This patch updates x86 elision-conf.c to use the newly defined HAS_CPU_FEATURE from <cpu-features.h>. * sysdeps/unix/sysv/linux/x86/elision-conf.c (elision_init): Replace HAS_RTM with HAS_CPU_FEATURE (RTM).
* Add _dl_x86_cpu_features to rtld_globalH.J. Lu2015-08-132-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds _dl_x86_cpu_features to rtld_global in x86 ld.so and initializes it early before __libc_start_main is called so that cpu_features is always available when it is used and we can avoid calling __init_cpu_features in IFUNC selectors. * sysdeps/i386/dl-machine.h: Include <cpu-features.c>. (dl_platform_init): Call init_cpu_features. * sysdeps/i386/dl-procinfo.c (_dl_x86_cpu_features): New. * sysdeps/i386/i686/cacheinfo.c (DISABLE_PREFERRED_MEMORY_INSTRUCTION): Removed. * sysdeps/i386/i686/multiarch/Makefile (aux): Remove init-arch. * sysdeps/i386/i686/multiarch/Versions: Removed. * sysdeps/i386/i686/multiarch/ifunc-defines.sym (KIND_OFFSET): Removed. * sysdeps/i386/ldsodefs.h: Include <cpu-features.h>. * sysdeps/unix/sysv/linux/x86/Makefile (libpthread-sysdep_routines): Remove init-arch. * sysdeps/unix/sysv/linux/x86_64/dl-procinfo.c: Include <sysdeps/x86_64/dl-procinfo.c> instead of sysdeps/generic/dl-procinfo.c>. * sysdeps/x86/Makefile [$(subdir) == csu] (gen-as-const-headers): Add cpu-features-offsets.sym and rtld-global-offsets.sym. [$(subdir) == elf] (sysdep-dl-routines): Add dl-get-cpu-features. [$(subdir) == elf] (tests): Add tst-get-cpu-features. [$(subdir) == elf] (tests-static): Add tst-get-cpu-features-static. * sysdeps/x86/Versions: New file. * sysdeps/x86/cpu-features-offsets.sym: Likewise. * sysdeps/x86/cpu-features.c: Likewise. * sysdeps/x86/cpu-features.h: Likewise. * sysdeps/x86/dl-get-cpu-features.c: Likewise. * sysdeps/x86/libc-start.c: Likewise. * sysdeps/x86/rtld-global-offsets.sym: Likewise. * sysdeps/x86/tst-get-cpu-features-static.c: Likewise. * sysdeps/x86/tst-get-cpu-features.c: Likewise. * sysdeps/x86_64/dl-procinfo.c: Likewise. * sysdeps/x86_64/cacheinfo.c (__cpuid_count): Removed. Assume USE_MULTIARCH is defined and don't check it. (is_intel): Replace __cpu_features with GLRO(dl_x86_cpu_features). (is_amd): Likewise. (max_cpuid): Likewise. (intel_check_word): Likewise. (__cache_sysconf): Don't call __init_cpu_features. (__x86_preferred_memory_instruction): Removed. (init_cacheinfo): Don't call __init_cpu_features. Replace __cpu_features with GLRO(dl_x86_cpu_features). * sysdeps/x86_64/dl-machine.h: <cpu-features.c>. (dl_platform_init): Call init_cpu_features. * sysdeps/x86_64/ldsodefs.h: Include <cpu-features.h>. * sysdeps/x86_64/multiarch/Makefile (aux): Remove init-arch. * sysdeps/x86_64/multiarch/Versions: Removed. * sysdeps/x86_64/multiarch/cacheinfo.c: Likewise. * sysdeps/x86_64/multiarch/init-arch.c: Likewise. * sysdeps/x86_64/multiarch/ifunc-defines.sym (KIND_OFFSET): Removed. * sysdeps/x86_64/multiarch/init-arch.h: Rewrite.
* Remove unused definition of __openat(64)_nocancelAndreas Schwab2015-08-112-21/+0
|