@@ -255,8 +255,13 @@
/* Define if static PIE is enabled. */
#define ENABLE_STATIC_PIE 0
-/* Some compiler options may now allow to use ebp in __asm__ (used mainly
- in i386 6 argument syscall issue). */
+/* Some configurations may not allow to use of the i386 %ebp register
+ in inline assembly. In this case, this macro is defined as 0.
+ Note that this macro only reflects the compiler behavior with the
+ default/user-specified flags. Profiling builds can never use %ebp
+ in this way because they require a frame pointer. See
+ I386_USE_REGISTER_EBP in sysdeps/unix/sysv/linux/i386/sysdep.h for
+ the macro that actual code should check. */
#define CAN_USE_REGISTER_ASM_EBP 0
#endif
@@ -1281,10 +1281,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
#endif
__stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
-#ifdef check_consistency
- check_consistency ();
-#endif
-
errval = (*GL(dl_make_stack_executable_hook)) (stack_endp);
if (errval)
{
@@ -50,10 +50,6 @@ _dl_make_stack_executable (void **stack_endp)
GL(dl_stack_flags) |= PF_X;
out:
-#ifdef check_consistency
- check_consistency ();
-#endif
-
return result;
}
rtld_hidden_def (_dl_make_stack_executable)
@@ -18,7 +18,7 @@
#include <sysdep.h>
-#ifndef OPTIMIZE_FOR_GCC_5
+#if !I386_USE_REGISTER_ASM_EBP
/* %eax, %ecx, %edx and %esi contain the values expected by the kernel.
%edi points to a structure with the values of %ebx, %edi and %ebp. */
@@ -50,4 +50,4 @@ ENTRY (__libc_do_syscall)
cfi_restore (ebx)
ret
END (__libc_do_syscall)
-#endif
+#endif /* !I386_USE_REGISTER_ASM_EBP */
@@ -29,7 +29,6 @@
#include <dl-sysdep.h>
#include <tls.h>
-
/* For Linux we can use the system call table in the header file
/usr/include/asm/unistd.h
of the kernel. But these symbols do not follow the SYS_* syntax
@@ -46,15 +45,19 @@
# endif
#endif
-/* 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 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
+/* Indicator for whether inline assembly can use the %ebp register.
+ The configure script only detects the compiler behavior with
+ default compiler flags. In a profiling build, a frame pointer is
+ always required, so %ebp is never usable. Code should always check
+ I386_USE_REGISTER_ASM_EBP for this reason, and not
+ CAN_USE_REGISTER_ASM_EBP. */
+#ifdef PROF
+# define I386_USE_REGISTER_ASM_EBP 0
+#else
+# define I386_USE_REGISTER_ASM_EBP CAN_USE_REGISTER_ASM_EBP
#endif
+
#ifdef __ASSEMBLER__
/* Linux uses a negative return value to indicate syscall errors,
@@ -241,7 +244,7 @@
extern int __syscall_error (int)
attribute_hidden __attribute__ ((__regparm__ (1)));
-#ifndef OPTIMIZE_FOR_GCC_5
+#if !I386_USE_REGISTER_ASM_EBP
/* We need some help from the assembler to generate optimal code. We
define some macros here which later will be used. */
asm (".L__X'%ebx = 1\n\t"
@@ -338,10 +341,10 @@ struct libc_do_syscall_args
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 5, args)
/* Each object using 6-argument inline syscalls must include a
definition of __libc_do_syscall. */
-#ifdef OPTIMIZE_FOR_GCC_5
+#if I386_USE_REGISTER_ASM_EBP
# define INTERNAL_SYSCALL_MAIN_6(name, err, args...) \
INTERNAL_SYSCALL_MAIN_INLINE(name, err, 6, args)
-#else /* GCC 5 */
+#else /* !I386_USE_REGISTER_ASM_EBP */
# define INTERNAL_SYSCALL_MAIN_6(name, err, arg1, arg2, arg3, \
arg4, arg5, arg6) \
struct libc_do_syscall_args _xv = \
@@ -356,14 +359,14 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
: "memory", "cc")
-#endif /* GCC 5 */
+#endif /* !I386_USE_REGISTER_ASM_EBP */
#define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \
register unsigned int resultvar; \
INTERNAL_SYSCALL_MAIN_##nr (name, err, args); \
(int) resultvar; })
#if I386_USE_SYSENTER
-# ifdef OPTIMIZE_FOR_GCC_5
+# if I386_USE_REGISTER_ASM_EBP
# ifdef PIC
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
LOADREGS_##nr(args) \
@@ -399,7 +402,7 @@ struct libc_do_syscall_args
: "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
(int) resultvar; })
# endif
-# else /* GCC 5 */
+# else /* !I386_USE_REGISTER_ASM_EBP */
# ifdef PIC
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
EXTRAVAR_##nr \
@@ -445,9 +448,9 @@ struct libc_do_syscall_args
: "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
# endif
-# endif /* GCC 5 */
+# endif /* !I386_USE_REGISTER_ASM_EBP */
#else
-# ifdef OPTIMIZE_FOR_GCC_5
+# if I386_USE_REGISTER_ASM_EBP
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
LOADREGS_##nr(args) \
asm volatile ( \
@@ -463,7 +466,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "a" (name) ASMARGS_##nr(args) : "memory", "cc"); \
(int) resultvar; })
-# else /* GCC 5 */
+# else /* !I386_USE_REGISTER_ASM_EBP */
# define INTERNAL_SYSCALL_MAIN_INLINE(name, err, nr, args...) \
EXTRAVAR_##nr \
asm volatile ( \
@@ -484,7 +487,7 @@ struct libc_do_syscall_args
: "=a" (resultvar) \
: "0" (name) ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; })
-# endif /* GCC 5 */
+# endif /* !I386_USE_REGISTER_ASM_EBP */
#endif
#undef INTERNAL_SYSCALL_DECL
@@ -549,7 +552,7 @@ struct libc_do_syscall_args
# define RESTOREARGS_5
#endif
-#ifdef OPTIMIZE_FOR_GCC_5
+#if I386_USE_REGISTER_ASM_EBP
# define LOADREGS_0()
# define ASMARGS_0()
# define LOADREGS_1(arg1) \
@@ -577,7 +580,7 @@ struct libc_do_syscall_args
LOADREGS_5 (arg1, arg2, arg3, arg4, arg5)
# define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
ASMARGS_5 (arg1, arg2, arg3, arg4, arg5), "r" (_a6)
-#endif /* GCC 5 */
+#endif /* !I386_USE_REGISTER_ASM_EBP */
#define ASMFMT_0()
#ifdef __PIC__
@@ -615,20 +618,6 @@ struct libc_do_syscall_args
# define EXTRAVAR_5
#endif
-/* Consistency check for position-independent code. */
-#if defined __PIC__ && !defined OPTIMIZE_FOR_GCC_5
-# define check_consistency() \
- ({ int __res; \
- __asm__ __volatile__ \
- (LOAD_PIC_REG_STR (cx) ";" \
- "subl %%ebx, %%ecx;" \
- "je 1f;" \
- "ud2;" \
- "1:\n" \
- : "=c" (__res)); \
- __res; })
-#endif
-
#endif /* __ASSEMBLER__ */