i386: Remove build support for GCC older than GCC 6

Message ID 20200406144914.1640384-1-hjl.tools@gmail.com
State Committed
Headers
Series i386: Remove build support for GCC older than GCC 6 |

Commit Message

H.J. Lu April 6, 2020, 2:49 p.m. UTC
  Since GCC 6.2 or later is required to build glibc, remove build support
for GCC older than GCC 6.

Testd with GCC 6.4 and GCC 9.3.
---
 sysdeps/i386/sysdep.h                 |   2 -
 sysdeps/i386/tls-macros.h             |  37 +----
 sysdeps/unix/sysv/linux/i386/sysdep.h | 206 ++++----------------------
 3 files changed, 28 insertions(+), 217 deletions(-)
  

Comments

Adhemerval Zanella April 6, 2020, 5:37 p.m. UTC | #1
On 06/04/2020 11:49, H.J. Lu via Libc-alpha wrote:

> diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
> index 6671afe65e..cfa562ecb0 100644
> --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
> @@ -43,15 +43,6 @@
>  # 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
> -#endif
> -

Unfortunately we can't remove the alternate syscall mechanism that is
usd for GCC older than 5, since it is used for -Os and
-fno-omit-frame-pointer (CAN_USE_REGISTER_ASM_EBP).
  
H.J. Lu April 6, 2020, 6:39 p.m. UTC | #2
On Mon, Apr 6, 2020 at 10:38 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
>
>
> On 06/04/2020 11:49, H.J. Lu via Libc-alpha wrote:
>
> > diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
> > index 6671afe65e..cfa562ecb0 100644
> > --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
> > +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
> > @@ -43,15 +43,6 @@
> >  # 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
> > -#endif
> > -
>
> Unfortunately we can't remove the alternate syscall mechanism that is
> usd for GCC older than 5, since it is used for -Os and
> -fno-omit-frame-pointer (CAN_USE_REGISTER_ASM_EBP).

Here is the updated patch to remove __GNUC_PREREQ (5,0).
  
Adhemerval Zanella April 7, 2020, 1:41 p.m. UTC | #3
On 06/04/2020 15:39, H.J. Lu wrote:
> On Mon, Apr 6, 2020 at 10:38 AM Adhemerval Zanella via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>>
>>
>> On 06/04/2020 11:49, H.J. Lu via Libc-alpha wrote:
>>
>>> diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
>>> index 6671afe65e..cfa562ecb0 100644
>>> --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
>>> +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
>>> @@ -43,15 +43,6 @@
>>>  # 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
>>> -#endif
>>> -
>>
>> Unfortunately we can't remove the alternate syscall mechanism that is
>> usd for GCC older than 5, since it is used for -Os and
>> -fno-omit-frame-pointer (CAN_USE_REGISTER_ASM_EBP).
> 
> Here is the updated patch to remove __GNUC_PREREQ (5,0).
> 

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
> index 6094af8fec..2f786a251b 100644
> --- a/sysdeps/i386/sysdep.h
> +++ b/sysdeps/i386/sysdep.h
> @@ -18,8 +18,6 @@
>  
>  #include <sysdeps/x86/sysdep.h>
>  
> -#include <features.h> /* For __GNUC_PREREQ.  */
> -
>  /* It is desirable that the names of PIC thunks match those used by
>     GCC so that multiple copies are eliminated by the linker.  Because
>     GCC 4.6 and earlier use __i686 in the names, it is necessary to

Ok.

> diff --git a/sysdeps/i386/tls-macros.h b/sysdeps/i386/tls-macros.h
> index 053cba05d1..9c1303dc45 100644
> --- a/sysdeps/i386/tls-macros.h
> +++ b/sysdeps/i386/tls-macros.h
> @@ -1,5 +1,3 @@
> -#include <features.h> /* For __GNUC_PREREQ.  */
> -
>  #define TLS_LE(x) \
>    ({ int *__l;								      \
>       asm ("movl %%gs:0,%0\n\t"						      \
> @@ -7,15 +5,7 @@
>  	  : "=r" (__l));						      \
>       __l; })
>  
> -#if defined PIC && !__GNUC_PREREQ (5,0)
> -# define TLS_IE(x) \
> -  ({ int *__l;								      \
> -     asm ("movl %%gs:0,%0\n\t"						      \
> -	  "subl " #x "@gottpoff(%%ebx),%0"				      \
> -	  : "=r" (__l));						      \
> -     __l; })
> -#else
> -# define TLS_IE(x) \
> +#define TLS_IE(x) \
>    ({ int *__l, __b;							      \
>       asm ("call 1f\n\t"							      \
>  	  ".subsection 1\n"						      \
> @@ -27,18 +17,8 @@
>  	  "subl " #x "@gottpoff(%%ebx),%0"				      \
>  	  : "=r" (__l), "=&b" (__b));					      \
>       __l; })
> -#endif
>  
> -#if defined PIC && !__GNUC_PREREQ (5,0)
> -# define TLS_LD(x) \
> -  ({ int *__l, __c, __d;						      \
> -     asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
> -	  "call ___tls_get_addr@plt\n\t"				      \
> -	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
> -	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
> -     __l; })
> -#else
> -# define TLS_LD(x) \
> +#define TLS_LD(x) \
>    ({ int *__l, __b, __c, __d;						      \
>       asm ("call 1f\n\t"							      \
>  	  ".subsection 1\n"						      \
> @@ -51,18 +31,8 @@
>  	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
>  	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
>       __l; })
> -#endif
>  
> -#if defined PIC && !__GNUC_PREREQ (5,0)
> -# define TLS_GD(x) \
> -  ({ int *__l, __c, __d;						      \
> -     asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
> -	  "call ___tls_get_addr@plt\n\t"				      \
> -	  "nop"								      \
> -	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
> -     __l; })
> -#else
> -# define TLS_GD(x) \
> +#define TLS_GD(x) \
>    ({ int *__l, __b, __c, __d;						      \
>       asm ("call 1f\n\t"							      \
>  	  ".subsection 1\n"						      \
> @@ -75,4 +45,3 @@
>  	  "nop"								      \
>  	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
>       __l; })
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
> index 6671afe65e..f6847a67e3 100644
> --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
> @@ -48,7 +48,7 @@
>     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
> +#if !defined PROF && CAN_USE_REGISTER_ASM_EBP
>  # define OPTIMIZE_FOR_GCC_5
>  #endif
>  

Should we use CAN_USE_REGISTER_ASM_EBP instead of OPTIMIZE_FOR_GCC_5 to
describe better what the multiple syscall mechanism are doing?

> @@ -580,21 +580,6 @@ struct libc_do_syscall_args
>  # define EXTRAVAR_5
>  #endif
>  
> -/* Consistency check for position-independent code.  Disabled for GCC 5
> -   and above since there is no fixed PIC register in GCC 5 and above.  */
> -#if defined __PIC__ && !__GNUC_PREREQ (5,0)
> -# 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__ */
>  

Ok. For gcc version where -Os / -fno-omit-frame-pointer still sets
CAN_USE_REGISTER_ASM_EBP, is this check still worth?
  
H.J. Lu April 7, 2020, 1:51 p.m. UTC | #4
On Tue, Apr 7, 2020 at 6:41 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 06/04/2020 15:39, H.J. Lu wrote:
> > On Mon, Apr 6, 2020 at 10:38 AM Adhemerval Zanella via Libc-alpha
> > <libc-alpha@sourceware.org> wrote:
> >>
> >>
> >>
> >> On 06/04/2020 11:49, H.J. Lu via Libc-alpha wrote:
> >>
> >>> diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
> >>> index 6671afe65e..cfa562ecb0 100644
> >>> --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
> >>> +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
> >>> @@ -43,15 +43,6 @@
> >>>  # 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
> >>> -#endif
> >>> -
> >>
> >> Unfortunately we can't remove the alternate syscall mechanism that is
> >> usd for GCC older than 5, since it is used for -Os and
> >> -fno-omit-frame-pointer (CAN_USE_REGISTER_ASM_EBP).
> >
> > Here is the updated patch to remove __GNUC_PREREQ (5,0).
> >
>
> LGTM, thanks.
>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> > diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
> > index 6094af8fec..2f786a251b 100644
> > --- a/sysdeps/i386/sysdep.h
> > +++ b/sysdeps/i386/sysdep.h
> > @@ -18,8 +18,6 @@
> >
> >  #include <sysdeps/x86/sysdep.h>
> >
> > -#include <features.h> /* For __GNUC_PREREQ.  */
> > -
> >  /* It is desirable that the names of PIC thunks match those used by
> >     GCC so that multiple copies are eliminated by the linker.  Because
> >     GCC 4.6 and earlier use __i686 in the names, it is necessary to
>
> Ok.
>
> > diff --git a/sysdeps/i386/tls-macros.h b/sysdeps/i386/tls-macros.h
> > index 053cba05d1..9c1303dc45 100644
> > --- a/sysdeps/i386/tls-macros.h
> > +++ b/sysdeps/i386/tls-macros.h
> > @@ -1,5 +1,3 @@
> > -#include <features.h> /* For __GNUC_PREREQ.  */
> > -
> >  #define TLS_LE(x) \
> >    ({ int *__l;                                                                     \
> >       asm ("movl %%gs:0,%0\n\t"                                                     \
> > @@ -7,15 +5,7 @@
> >         : "=r" (__l));                                                      \
> >       __l; })
> >
> > -#if defined PIC && !__GNUC_PREREQ (5,0)
> > -# define TLS_IE(x) \
> > -  ({ int *__l;                                                                     \
> > -     asm ("movl %%gs:0,%0\n\t"                                                     \
> > -       "subl " #x "@gottpoff(%%ebx),%0"                                    \
> > -       : "=r" (__l));                                                      \
> > -     __l; })
> > -#else
> > -# define TLS_IE(x) \
> > +#define TLS_IE(x) \
> >    ({ int *__l, __b;                                                        \
> >       asm ("call 1f\n\t"                                                            \
> >         ".subsection 1\n"                                                   \
> > @@ -27,18 +17,8 @@
> >         "subl " #x "@gottpoff(%%ebx),%0"                                    \
> >         : "=r" (__l), "=&b" (__b));                                         \
> >       __l; })
> > -#endif
> >
> > -#if defined PIC && !__GNUC_PREREQ (5,0)
> > -# define TLS_LD(x) \
> > -  ({ int *__l, __c, __d;                                                   \
> > -     asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"                                    \
> > -       "call ___tls_get_addr@plt\n\t"                                      \
> > -       "leal " #x "@dtpoff(%%eax), %%eax"                                  \
> > -       : "=a" (__l), "=&c" (__c), "=&d" (__d));                            \
> > -     __l; })
> > -#else
> > -# define TLS_LD(x) \
> > +#define TLS_LD(x) \
> >    ({ int *__l, __b, __c, __d;                                                      \
> >       asm ("call 1f\n\t"                                                            \
> >         ".subsection 1\n"                                                   \
> > @@ -51,18 +31,8 @@
> >         "leal " #x "@dtpoff(%%eax), %%eax"                                  \
> >         : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));               \
> >       __l; })
> > -#endif
> >
> > -#if defined PIC && !__GNUC_PREREQ (5,0)
> > -# define TLS_GD(x) \
> > -  ({ int *__l, __c, __d;                                                   \
> > -     asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"                                     \
> > -       "call ___tls_get_addr@plt\n\t"                                      \
> > -       "nop"                                                               \
> > -       : "=a" (__l), "=&c" (__c), "=&d" (__d));                            \
> > -     __l; })
> > -#else
> > -# define TLS_GD(x) \
> > +#define TLS_GD(x) \
> >    ({ int *__l, __b, __c, __d;                                                      \
> >       asm ("call 1f\n\t"                                                            \
> >         ".subsection 1\n"                                                   \
> > @@ -75,4 +45,3 @@
> >         "nop"                                                               \
> >         : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));               \
> >       __l; })
> > -#endif
>
> Ok.
>
> > diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
> > index 6671afe65e..f6847a67e3 100644
> > --- a/sysdeps/unix/sysv/linux/i386/sysdep.h
> > +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
> > @@ -48,7 +48,7 @@
> >     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
> > +#if !defined PROF && CAN_USE_REGISTER_ASM_EBP
> >  # define OPTIMIZE_FOR_GCC_5
> >  #endif
> >
>
> Should we use CAN_USE_REGISTER_ASM_EBP instead of OPTIMIZE_FOR_GCC_5 to
> describe better what the multiple syscall mechanism are doing?

There is also !defined PROF.

> > @@ -580,21 +580,6 @@ struct libc_do_syscall_args
> >  # define EXTRAVAR_5
> >  #endif
> >
> > -/* Consistency check for position-independent code.  Disabled for GCC 5
> > -   and above since there is no fixed PIC register in GCC 5 and above.  */
> > -#if defined __PIC__ && !__GNUC_PREREQ (5,0)
> > -# 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__ */
> >
>
> Ok. For gcc version where -Os / -fno-omit-frame-pointer still sets
> CAN_USE_REGISTER_ASM_EBP, is this check still worth?
>

No.  GCC 6 or above don't use EBX as the fixed PIC register.
  

Patch

diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index 6094af8fec..2f786a251b 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -18,8 +18,6 @@ 
 
 #include <sysdeps/x86/sysdep.h>
 
-#include <features.h> /* For __GNUC_PREREQ.  */
-
 /* It is desirable that the names of PIC thunks match those used by
    GCC so that multiple copies are eliminated by the linker.  Because
    GCC 4.6 and earlier use __i686 in the names, it is necessary to
diff --git a/sysdeps/i386/tls-macros.h b/sysdeps/i386/tls-macros.h
index 053cba05d1..9c1303dc45 100644
--- a/sysdeps/i386/tls-macros.h
+++ b/sysdeps/i386/tls-macros.h
@@ -1,5 +1,3 @@ 
-#include <features.h> /* For __GNUC_PREREQ.  */
-
 #define TLS_LE(x) \
   ({ int *__l;								      \
      asm ("movl %%gs:0,%0\n\t"						      \
@@ -7,15 +5,7 @@ 
 	  : "=r" (__l));						      \
      __l; })
 
-#if defined PIC && !__GNUC_PREREQ (5,0)
-# define TLS_IE(x) \
-  ({ int *__l;								      \
-     asm ("movl %%gs:0,%0\n\t"						      \
-	  "subl " #x "@gottpoff(%%ebx),%0"				      \
-	  : "=r" (__l));						      \
-     __l; })
-#else
-# define TLS_IE(x) \
+#define TLS_IE(x) \
   ({ int *__l, __b;							      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -27,18 +17,8 @@ 
 	  "subl " #x "@gottpoff(%%ebx),%0"				      \
 	  : "=r" (__l), "=&b" (__b));					      \
      __l; })
-#endif
 
-#if defined PIC && !__GNUC_PREREQ (5,0)
-# define TLS_LD(x) \
-  ({ int *__l, __c, __d;						      \
-     asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"				      \
-	  "call ___tls_get_addr@plt\n\t"				      \
-	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
-	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
-     __l; })
-#else
-# define TLS_LD(x) \
+#define TLS_LD(x) \
   ({ int *__l, __b, __c, __d;						      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -51,18 +31,8 @@ 
 	  "leal " #x "@dtpoff(%%eax), %%eax"				      \
 	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
      __l; })
-#endif
 
-#if defined PIC && !__GNUC_PREREQ (5,0)
-# define TLS_GD(x) \
-  ({ int *__l, __c, __d;						      \
-     asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"				      \
-	  "call ___tls_get_addr@plt\n\t"				      \
-	  "nop"								      \
-	  : "=a" (__l), "=&c" (__c), "=&d" (__d));			      \
-     __l; })
-#else
-# define TLS_GD(x) \
+#define TLS_GD(x) \
   ({ int *__l, __b, __c, __d;						      \
      asm ("call 1f\n\t"							      \
 	  ".subsection 1\n"						      \
@@ -75,4 +45,3 @@ 
 	  "nop"								      \
 	  : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d));		      \
      __l; })
-#endif
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 6671afe65e..cfa562ecb0 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -43,15 +43,6 @@ 
 # 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
-#endif
-
 #ifdef __ASSEMBLER__
 
 /* Linux uses a negative return value to indicate syscall errors,
@@ -239,48 +230,6 @@ 
 extern int __syscall_error (int)
   attribute_hidden __attribute__ ((__regparm__ (1)));
 
-#ifndef OPTIMIZE_FOR_GCC_5
-/* 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"
-     ".L__X'%ecx = 2\n\t"
-     ".L__X'%edx = 2\n\t"
-     ".L__X'%eax = 3\n\t"
-     ".L__X'%esi = 3\n\t"
-     ".L__X'%edi = 3\n\t"
-     ".L__X'%ebp = 3\n\t"
-     ".L__X'%esp = 3\n\t"
-     ".macro bpushl name reg\n\t"
-     ".if 1 - \\name\n\t"
-     ".if 2 - \\name\n\t"
-     "error\n\t"
-     ".else\n\t"
-     "xchgl \\reg, %ebx\n\t"
-     ".endif\n\t"
-     ".endif\n\t"
-     ".endm\n\t"
-     ".macro bpopl name reg\n\t"
-     ".if 1 - \\name\n\t"
-     ".if 2 - \\name\n\t"
-     "error\n\t"
-     ".else\n\t"
-     "xchgl \\reg, %ebx\n\t"
-     ".endif\n\t"
-     ".endif\n\t"
-     ".endm\n\t");
-
-/* Six-argument syscalls use an out-of-line helper, because an inline
-   asm using all registers apart from %esp cannot work reliably and
-   the assembler does not support describing an asm that saves and
-   restores %ebp itself as a separate stack frame.  This structure
-   stores the arguments not passed in registers; %edi is passed with a
-   pointer to this structure.  */
-struct libc_do_syscall_args
-{
-  int ebx, edi, ebp;
-};
-#endif
-
 # define VDSO_NAME  "LINUX_2.6"
 # define VDSO_HASH  61765110
 
@@ -313,41 +262,23 @@  struct libc_do_syscall_args
     INTERNAL_SYSCALL_MAIN_INLINE(name, 5, args)
 /* Each object using 6-argument inline syscalls must include a
    definition of __libc_do_syscall.  */
-#ifdef OPTIMIZE_FOR_GCC_5
-# define INTERNAL_SYSCALL_MAIN_6(name, args...) \
-    INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
-#else /* GCC 5  */
-# define INTERNAL_SYSCALL_MAIN_6(name, arg1, arg2, arg3,		\
-				 arg4, arg5, arg6)			\
-  struct libc_do_syscall_args _xv =					\
-    {									\
-      (int) (arg1),							\
-      (int) (arg5),							\
-      (int) (arg6)							\
-    };									\
-    asm volatile (							\
-    "movl %1, %%eax\n\t"						\
-    "call __libc_do_syscall"						\
-    : "=a" (resultvar)							\
-    : "i" (__NR_##name), "c" (arg2), "d" (arg3), "S" (arg4), "D" (&_xv) \
-    : "memory", "cc")
-#endif /* GCC 5  */
+#define INTERNAL_SYSCALL_MAIN_6(name, args...) \
+   INTERNAL_SYSCALL_MAIN_INLINE(name, 6, args)
 #define INTERNAL_SYSCALL(name, nr, args...) \
   ({									      \
     register unsigned int resultvar;					      \
     INTERNAL_SYSCALL_MAIN_##nr (name, args);			      	      \
     (int) resultvar; })
 #if I386_USE_SYSENTER
-# ifdef OPTIMIZE_FOR_GCC_5
-#  ifdef PIC
-#   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
+# ifdef PIC
+#  define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "call *%%gs:%P2"							\
     : "=a" (resultvar)							\
     : "a" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		\
       ASMARGS_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
   ({									\
     register unsigned int resultvar;					\
     LOADREGS_##nr(args)							\
@@ -357,14 +288,14 @@  struct libc_do_syscall_args
     : "a" (name), "i" (offsetof (tcbhead_t, sysinfo))			\
       ASMARGS_##nr(args) : "memory", "cc");				\
     (int) resultvar; })
-#  else
-#   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
+# else
+#  define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "call *_dl_sysinfo"							\
     : "=a" (resultvar)							\
     : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
   ({									\
     register unsigned int resultvar;					\
     LOADREGS_##nr(args)							\
@@ -373,63 +304,15 @@  struct libc_do_syscall_args
     : "=a" (resultvar)							\
     : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\
     (int) resultvar; })
-#  endif
-# else /* GCC 5  */
-#  ifdef PIC
-#   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "movl %1, %%eax\n\t"						      \
-    "call *%%gs:%P2\n\t"						      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "i" (__NR_##name), "i" (offsetof (tcbhead_t, sysinfo))		      \
-      ASMFMT_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "call *%%gs:%P2\n\t"						      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "0" (name), "i" (offsetof (tcbhead_t, sysinfo))			      \
-      ASMFMT_##nr(args) : "memory", "cc");				      \
-    (int) resultvar; })
-#  else
-#   define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "movl %1, %%eax\n\t"						      \
-    "call *_dl_sysinfo\n\t"						      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-#   define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "call *_dl_sysinfo\n\t"						      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			      \
-    (int) resultvar; })
-#  endif
-# endif /* GCC 5  */
+# endif
 #else
-# ifdef OPTIMIZE_FOR_GCC_5
-#  define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
+# define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
     LOADREGS_##nr(args)							\
     asm volatile (							\
     "int $0x80"								\
     : "=a" (resultvar)							\
     : "a" (__NR_##name) ASMARGS_##nr(args) : "memory", "cc")
-#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
+# define INTERNAL_SYSCALL_NCS(name, nr, args...) \
   ({									\
     register unsigned int resultvar;					\
     LOADREGS_##nr(args)							\
@@ -438,28 +321,6 @@  struct libc_do_syscall_args
     : "=a" (resultvar)							\
     : "a" (name) ASMARGS_##nr(args) : "memory", "cc");			\
     (int) resultvar; })
-# else /* GCC 5  */
-#  define INTERNAL_SYSCALL_MAIN_INLINE(name, nr, args...) \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "movl %1, %%eax\n\t"						      \
-    "int $0x80\n\t"							      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "i" (__NR_##name) ASMFMT_##nr(args) : "memory", "cc")
-#  define INTERNAL_SYSCALL_NCS(name, nr, args...) \
-  ({									      \
-    register unsigned int resultvar;					      \
-    EXTRAVAR_##nr							      \
-    asm volatile (							      \
-    LOADARGS_##nr							      \
-    "int $0x80\n\t"							      \
-    RESTOREARGS_##nr							      \
-    : "=a" (resultvar)							      \
-    : "0" (name) ASMFMT_##nr(args) : "memory", "cc");			      \
-    (int) resultvar; })
-# endif /* GCC 5  */
 #endif
 
 #define LOADARGS_0
@@ -514,35 +375,33 @@  struct libc_do_syscall_args
 # define RESTOREARGS_5
 #endif
 
-#ifdef OPTIMIZE_FOR_GCC_5
-# define LOADREGS_0()
-# define ASMARGS_0()
-# define LOADREGS_1(arg1) \
+#define LOADREGS_0()
+#define ASMARGS_0()
+#define LOADREGS_1(arg1) \
 	LOADREGS_0 ()
-# define ASMARGS_1(arg1) \
+#define ASMARGS_1(arg1) \
 	ASMARGS_0 (), "b" ((unsigned int) (arg1))
-# define LOADREGS_2(arg1, arg2) \
+#define LOADREGS_2(arg1, arg2) \
 	LOADREGS_1 (arg1)
-# define ASMARGS_2(arg1, arg2) \
+#define ASMARGS_2(arg1, arg2) \
 	ASMARGS_1 (arg1), "c" ((unsigned int) (arg2))
-# define LOADREGS_3(arg1, arg2, arg3) \
+#define LOADREGS_3(arg1, arg2, arg3) \
 	LOADREGS_2 (arg1, arg2)
-# define ASMARGS_3(arg1, arg2, arg3) \
+#define ASMARGS_3(arg1, arg2, arg3) \
 	ASMARGS_2 (arg1, arg2), "d" ((unsigned int) (arg3))
-# define LOADREGS_4(arg1, arg2, arg3, arg4) \
+#define LOADREGS_4(arg1, arg2, arg3, arg4) \
 	LOADREGS_3 (arg1, arg2, arg3)
-# define ASMARGS_4(arg1, arg2, arg3, arg4) \
+#define ASMARGS_4(arg1, arg2, arg3, arg4) \
 	ASMARGS_3 (arg1, arg2, arg3), "S" ((unsigned int) (arg4))
-# define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \
+#define LOADREGS_5(arg1, arg2, arg3, arg4, arg5) \
 	LOADREGS_4 (arg1, arg2, arg3, arg4)
-# define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \
+#define ASMARGS_5(arg1, arg2, arg3, arg4, arg5) \
 	ASMARGS_4 (arg1, arg2, arg3, arg4), "D" ((unsigned int) (arg5))
-# define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+#define LOADREGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
 	register unsigned int _a6 asm ("ebp") = (unsigned int) (arg6); \
 	LOADREGS_5 (arg1, arg2, arg3, arg4, arg5)
-# define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+#define ASMARGS_6(arg1, arg2, arg3, arg4, arg5, arg6) \
 	ASMARGS_5 (arg1, arg2, arg3, arg4, arg5), "r" (_a6)
-#endif /* GCC 5  */
 
 #define ASMFMT_0()
 #ifdef __PIC__
@@ -580,21 +439,6 @@  struct libc_do_syscall_args
 # define EXTRAVAR_5
 #endif
 
-/* Consistency check for position-independent code.  Disabled for GCC 5
-   and above since there is no fixed PIC register in GCC 5 and above.  */
-#if defined __PIC__ && !__GNUC_PREREQ (5,0)
-# 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__ */