--- glibc-2.23/config.h.in 2017-07-14 00:29:09.830086217 +0200 +++ glibc-2.23/config.h.in 2016-02-18 18:54:00.000000000 +0100 @@ -231,4 +231,8 @@ /* PowerPC32 uses fctidz for floating point to long long conversions. */ #define HAVE_PPC_FCTIDZ 0 +/* Some compiler options may now allow to use ebp in __asm__ (used mainly + in i386 6 argument syscall issue). */ +#define CAN_USE_REGISTER_ASM_EBP 0 + #endif --- glibc-2.23/sysdeps/unix/sysv/linux/i386/configure 2016-02-18 18:54:00.000000000 +0100 +++ glibc-2.23/sysdeps/unix/sysv/linux/i386/configure 2017-07-14 00:13:43.386731868 +0200 @@ -1,5 +1,44 @@ # This file is generated from configure.ac by Autoconf. DO NOT EDIT! # Local configure fragment for sysdeps/unix/sysv/linux/i386. +# 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 --- glibc-2.23/sysdeps/unix/sysv/linux/i386/configure.ac 2016-02-18 18:54:00.000000000 +0100 +++ glibc-2.23/sysdeps/unix/sysv/linux/i386/configure.ac 2017-07-14 00:15:10.776733850 +0200 @@ -1,5 +1,22 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. # Local configure fragment for sysdeps/unix/sysv/linux/i386. +# 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 --- glibc-2.23/sysdeps/unix/sysv/linux/i386/Makefile 2016-02-18 18:54:00.000000000 +0100 +++ glibc-2.23/sysdeps/unix/sysv/linux/i386/Makefile 2017-07-14 00:12:08.030063038 +0200 @@ -3,19 +3,6 @@ ifeq ($(subdir),misc) sysdep_routines += ioperm iopl vm86 -# %ebp may be used to pass the 6th argument to syscall. -CFLAGS-epoll_pwait.o += -fomit-frame-pointer -CFLAGS-epoll_pwait.os += -fomit-frame-pointer -CFLAGS-mmap.o += -fomit-frame-pointer -CFLAGS-mmap.os += -fomit-frame-pointer -CFLAGS-mmap64.o += -fomit-frame-pointer -CFLAGS-mmap64.os += -fomit-frame-pointer -endif - -ifeq ($(subdir),sysvipc) -# %ebp may be used to pass the 6th argument to syscall. -CFLAGS-semtimedop.o += -fomit-frame-pointer -CFLAGS-semtimedop.os += -fomit-frame-pointer endif ifeq ($(subdir),elf) --- glibc-2.23/sysdeps/unix/sysv/linux/i386/sysdep.h 2016-02-18 18:54:00.000000000 +0100 +++ glibc-2.23/sysdeps/unix/sysv/linux/i386/sysdep.h 2017-07-14 00:16:09.406735180 +0200 @@ -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