[PING] i686: Fix test suite fails on build by gcc 5.0
diff mbox

Message ID CAMXFM3sUZH-SF=q_JnjTF6VpJa2f=WVX5-Q8LGLKx=Nqqc5r0A@mail.gmail.com
State New
Headers show

Commit Message

Andrew Senkevich Nov. 27, 2014, 7:11 p.m. UTC
2014-11-27 20:23 GMT+03:00 H.J. Lu <hjl.tools@gmail.com>:
> We should also undef SETUP_PIC_REG_STR and
> LOAD_PIC_REG_STR in sysdeps/i386/sysdep.h
> for GCC 5, which are defined for C sources and will
> be wrong for GCC 5.

Fixed.

ChangeLog

2014-11-27  Andrew Senkevich  <andrew.n.senkevich@gmail.com>

        * sysdeps/i386/tls-macros.h (TLS_IE, TLS_LD, TLS_GD): Keep define in
        PIC mode only if gcc version < 5.0
        * sysdeps/i386/sysdep.h (SETUP_PIC_REG_STR, LOAD_PIC_REG_STR): Keep
        define only if gcc version < 5.0
        * sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Likewise.



--
WBR,
Andrew

Comments

Senkevich, Andrew Dec. 29, 2014, 1:45 p.m. UTC | #1
2014-11-27 20:23 GMT+03:00 H.J. Lu <hjl.tools@gmail.com>:
> We should also undef SETUP_PIC_REG_STR and LOAD_PIC_REG_STR in 

> sysdeps/i386/sysdep.h for GCC 5, which are defined for C sources and 

> will be wrong for GCC 5.


Attached patch formatted for git am. 

ChangeLog:

2014-12-29  Andrew Senkevich  <andrew.senkevich@intel.com>

        * sysdeps/i386/tls-macros.h (TLS_IE, TLS_LD, TLS_GD): Keep define in
        PIC mode only if gcc version < 5.0
        * sysdeps/i386/sysdep.h (SETUP_PIC_REG_STR, LOAD_PIC_REG_STR): Keep
        define only if gcc version < 5.0
        * sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Likewise.

Is it Ok?


--
Andrew
H.J. Lu Dec. 30, 2014, 6:31 p.m. UTC | #2
On Mon, Dec 29, 2014 at 5:45 AM, Senkevich, Andrew
<andrew.senkevich@intel.com> wrote:
> 2014-11-27 20:23 GMT+03:00 H.J. Lu <hjl.tools@gmail.com>:
>> We should also undef SETUP_PIC_REG_STR and LOAD_PIC_REG_STR in
>> sysdeps/i386/sysdep.h for GCC 5, which are defined for C sources and
>> will be wrong for GCC 5.
>
> Attached patch formatted for git am.
>
> ChangeLog:
>
> 2014-12-29  Andrew Senkevich  <andrew.senkevich@intel.com>
>
>         * sysdeps/i386/tls-macros.h (TLS_IE, TLS_LD, TLS_GD): Keep define in
>         PIC mode only if gcc version < 5.0
>         * sysdeps/i386/sysdep.h (SETUP_PIC_REG_STR, LOAD_PIC_REG_STR): Keep
>         define only if gcc version < 5.0

Do we really need to change SETUP_PIC_REG_STR and
LOAD_PIC_REG_STR? SETUP_PIC_REG_STR is only used
in LOAD_PIC_REG_STR and LOAD_PIC_REG_STR is only used
in check_consistency.  I think check_consistency change is
sufficient.

>         * sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Likewise.
>
> Is it Ok?
>
>
> --
> Andrew

Patch
diff mbox

diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index 217e746..5bebc13 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -146,22 +146,24 @@  GET_PC_THUNK(reg):      \

 #else /* __ASSEMBLER__ */

-# define SETUP_PIC_REG_STR(reg) \
-  ".ifndef " GET_PC_THUNK_STR (reg) "\n" \
-  ".section .gnu.linkonce.t." GET_PC_THUNK_STR (reg) ",\"ax\",@progbits\n" \
-  ".globl " GET_PC_THUNK_STR (reg) "\n" \
-  ".hidden " GET_PC_THUNK_STR (reg) "\n" \
-  ".p2align 4\n" \
-  ".type " GET_PC_THUNK_STR (reg) ",@function\n" \
+# if !__GNUC_PREREQ (5, 0)
+#  define SETUP_PIC_REG_STR(reg) \
+   ".ifndef " GET_PC_THUNK_STR (reg) "\n" \
+   ".section .gnu.linkonce.t." GET_PC_THUNK_STR (reg) ",\"ax\",@progbits\n" \
+   ".globl " GET_PC_THUNK_STR (reg) "\n" \
+   ".hidden " GET_PC_THUNK_STR (reg) "\n" \
+   ".p2align 4\n" \
+   ".type " GET_PC_THUNK_STR (reg) ",@function\n" \
 GET_PC_THUNK_STR (reg) ":" \
-  "movl (%%esp), %%e" #reg "\n" \
-  "ret\n" \
-  ".size " GET_PC_THUNK_STR (reg) ", . - " GET_PC_THUNK_STR (reg) "\n" \
-  ".previous\n" \
-  ".endif\n" \
-  "call " GET_PC_THUNK_STR (reg)
-
-# define LOAD_PIC_REG_STR(reg) \
-  SETUP_PIC_REG_STR (reg) "\naddl $_GLOBAL_OFFSET_TABLE_, %%e" #reg
+   "movl (%%esp), %%e" #reg "\n" \
+   "ret\n" \
+   ".size " GET_PC_THUNK_STR (reg) ", . - " GET_PC_THUNK_STR (reg) "\n" \
+   ".previous\n" \
+   ".endif\n" \
+   "call " GET_PC_THUNK_STR (reg)
+
+#  define LOAD_PIC_REG_STR(reg) \
+   SETUP_PIC_REG_STR (reg) "\naddl $_GLOBAL_OFFSET_TABLE_, %%e" #reg
+# endif

 #endif /* __ASSEMBLER__ */
diff --git a/sysdeps/i386/tls-macros.h b/sysdeps/i386/tls-macros.h
index 0b85738..053cba0 100644
--- a/sysdeps/i386/tls-macros.h
+++ b/sysdeps/i386/tls-macros.h
@@ -1,3 +1,5 @@ 
+#include <features.h> /* For __GNUC_PREREQ.  */
+
 #define TLS_LE(x) \
   ({ int *__l;      \
      asm ("movl %%gs:0,%0\n\t"      \
@@ -5,7 +7,7 @@ 
   : "=r" (__l));      \
      __l; })

-#ifdef PIC
+#if defined PIC && !__GNUC_PREREQ (5,0)
 # define TLS_IE(x) \
   ({ int *__l;      \
      asm ("movl %%gs:0,%0\n\t"      \
@@ -27,7 +29,7 @@ 
      __l; })
 #endif

-#ifdef PIC
+#if defined PIC && !__GNUC_PREREQ (5,0)
 # define TLS_LD(x) \
   ({ int *__l, __c, __d;      \
      asm ("leal " #x "@tlsldm(%%ebx),%%eax\n\t"      \
@@ -51,7 +53,7 @@ 
      __l; })
 #endif

-#ifdef PIC
+#if defined PIC && !__GNUC_PREREQ (5,0)
 # define TLS_GD(x) \
   ({ int *__l, __c, __d;      \
      asm ("leal " #x "@tlsgd(%%ebx),%%eax\n\t"      \
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h
b/sysdeps/unix/sysv/linux/i386/sysdep.h
index d751c58..b574418 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -502,7 +502,7 @@  asm (".L__X'%ebx = 1\n\t"
 #endif

 /* Consistency check for position-independent code.  */
-#ifdef __PIC__
+#if defined __PIC__ && !__GNUC_PREREQ (5,0)
 # define check_consistency()      \
   ({ int __res;      \
      __asm__ __volatile__      \