about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile39
-rw-r--r--sysdeps/unix/sysv/linux/i386/configure39
-rw-r--r--sysdeps/unix/sysv/linux/i386/configure.ac17
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h6
4 files changed, 60 insertions, 41 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 9609752256..6aac0dfe15 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -1,47 +1,18 @@
 # The default ABI is 32.
 default-abi := 32
 
-# %ebp is used to pass the 6th argument to system calls, so these
-# system calls are incompatible with a frame pointer.
-uses-6-syscall-arguments = -fomit-frame-pointer
-
 ifeq ($(subdir),misc)
 sysdep_routines += ioperm iopl vm86
-CFLAGS-epoll_pwait.o += $(uses-6-syscall-arguments)
-CFLAGS-epoll_pwait.os += $(uses-6-syscall-arguments)
-CFLAGS-mmap.o += $(uses-6-syscall-arguments)
-CFLAGS-mmap.os += $(uses-6-syscall-arguments)
-CFLAGS-mmap64.o += $(uses-6-syscall-arguments)
-CFLAGS-mmap64.os += $(uses-6-syscall-arguments)
-CFLAGS-pselect.o += $(uses-6-syscall-arguments)
-CFLAGS-pselect.os += $(uses-6-syscall-arguments)
-CFLAGS-rtld-mmap.os += $(uses-6-syscall-arguments)
-endif
-
-ifeq ($(subdir),sysvipc)
-CFLAGS-semtimedop.o += $(uses-6-syscall-arguments)
-CFLAGS-semtimedop.os += $(uses-6-syscall-arguments)
 endif
 
 ifeq ($(subdir),elf)
+sysdep-dl-routines += libc-do-syscall
 sysdep-others += lddlibc4
 install-bin += lddlibc4
 endif
 
 ifeq ($(subdir),io)
 sysdep_routines += libc-do-syscall
-CFLAGS-posix_fadvise64.o += $(uses-6-syscall-arguments)
-CFLAGS-posix_fadvise64.os += $(uses-6-syscall-arguments)
-CFLAGS-posix_fallocate.o += $(uses-6-syscall-arguments)
-CFLAGS-posix_fallocate.os += $(uses-6-syscall-arguments)
-CFLAGS-posix_fallocate64.o += $(uses-6-syscall-arguments)
-CFLAGS-posix_fallocate64.os += $(uses-6-syscall-arguments)
-CFLAGS-sync_file_range.o += $(uses-6-syscall-arguments)
-CFLAGS-sync_file_range.os += $(uses-6-syscall-arguments)
-CFLAGS-fallocate.o += $(uses-6-syscall-arguments)
-CFLAGS-fallocate.os += $(uses-6-syscall-arguments)
-CFLAGS-fallocate64.o += $(uses-6-syscall-arguments)
-CFLAGS-fallocate64.os += $(uses-6-syscall-arguments)
 endif
 
 ifeq ($(subdir),nptl)
@@ -61,14 +32,6 @@ ifeq ($(subdir),nptl)
 # pull in __syscall_error routine
 libpthread-routines += sysdep
 libpthread-shared-only-routines += sysdep
-CFLAGS-pthread_rwlock_timedrdlock.o += $(uses-6-syscall-arguments)
-CFLAGS-pthread_rwlock_timedrdlock.os += $(uses-6-syscall-arguments)
-CFLAGS-pthread_rwlock_timedwrlock.o += $(uses-6-syscall-arguments)
-CFLAGS-pthread_rwlock_timedwrlock.os += $(uses-6-syscall-arguments)
-CFLAGS-sem_wait.o += $(uses-6-syscall-arguments)
-CFLAGS-sem_wait.os += $(uses-6-syscall-arguments)
-CFLAGS-sem_timedwait.o += $(uses-6-syscall-arguments)
-CFLAGS-sem_timedwait.os += $(uses-6-syscall-arguments)
 endif
 
 ifeq ($(subdir),rt)
diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure
index eb72659dc3..ae2c3567c5 100644
--- a/sysdeps/unix/sysv/linux/i386/configure
+++ b/sysdeps/unix/sysv/linux/i386/configure
@@ -3,5 +3,44 @@
 
 arch_minimum_kernel=2.6.32
 
+# Check if CFLAGS allows compiler to use ebp register in inline assembly.
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler flags allows ebp in inline assembly" >&5
+$as_echo_n "checking if compiler flags allows ebp in inline assembly... " >&6; }
+if ${libc_cv_can_use_register_asm_ebp+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    void foo (int i)
+    {
+      register int reg asm ("ebp") = i;
+      asm ("# %0" : : "r" (reg));
+    }
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_can_use_register_asm_ebp=yes
+else
+  libc_cv_can_use_register_asm_ebp=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_can_use_register_asm_ebp" >&5
+$as_echo "$libc_cv_can_use_register_asm_ebp" >&6; }
+if test $libc_cv_can_use_register_asm_ebp = yes; then
+  $as_echo "#define CAN_USE_REGISTER_ASM_EBP 1" >>confdefs.h
+
+fi
+
 libc_cv_gcc_unwind_find_fde=yes
 ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac
index 1a11da6dad..1cd632e5c6 100644
--- a/sysdeps/unix/sysv/linux/i386/configure.ac
+++ b/sysdeps/unix/sysv/linux/i386/configure.ac
@@ -3,5 +3,22 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 
 arch_minimum_kernel=2.6.32
 
+# Check if CFLAGS allows compiler to use ebp register in inline assembly.
+AC_CACHE_CHECK([if compiler flags allows ebp in inline assembly],
+                libc_cv_can_use_register_asm_ebp, [
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([
+    void foo (int i)
+    {
+      register int reg asm ("ebp") = i;
+      asm ("# %0" : : "r" (reg));
+    }])],
+  [libc_cv_can_use_register_asm_ebp=yes],
+  [libc_cv_can_use_register_asm_ebp=no])
+])
+if test $libc_cv_can_use_register_asm_ebp = yes; then
+  AC_DEFINE(CAN_USE_REGISTER_ASM_EBP)
+fi
+
 libc_cv_gcc_unwind_find_fde=yes
 ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index baf46421b2..449b23e49b 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -44,9 +44,9 @@
 /* Since GCC 5 and above can properly spill %ebx with PIC when needed,
    we can inline syscalls with 6 arguments if GCC 5 or above is used
    to compile glibc.  Disable GCC 5 optimization when compiling for
-   profiling since asm ("ebp") can't be used to put the 6th argument
-   in %ebp for syscall.  */
-#if __GNUC_PREREQ (5,0) && !defined PROF
+   profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
+   can't be used to put the 6th argument in %ebp for syscall.  */
+#if __GNUC_PREREQ (5,0) && !defined PROF && CAN_USE_REGISTER_ASM_EBP
 # define OPTIMIZE_FOR_GCC_5
 #endif