public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
@ 2014-11-27 15:12 Andrew Senkevich
  2014-11-27 17:23 ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Senkevich @ 2014-11-27 15:12 UTC (permalink / raw)
  To: libc-alpha

2014-10-30 19:06 GMT+03:00 Andrew Senkevich <andrew.n.senkevich@gmail.com>:
> 2014-10-29 20:57 GMT+03:00 Andrew Senkevich <andrew.n.senkevich@gmail.com>:
>
>> Hi,
>>
>> this patch fixes 3 make check fails on glibc 32bit built by gcc 5.0
>> due to EBX was enabled for allocation
>> (https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html).
>>
>> Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
>> failed because EBX was used as PIC register.
>
> Here is the patch corrected accordingly comments in
> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03203.html
>
> ChangeLog:
>
> 2014-10-30  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/unix/sysv/linux/i386/sysdep.h (check_consistency):
> Keep define only if gcc version < 5.0
>
> 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 57d5ea0..bce5697 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__                                                    \

It is fixes not only test suite fail but build itself now.

Is it OK for trunk?


--
WBR,
Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
  2014-11-27 15:12 [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0 Andrew Senkevich
@ 2014-11-27 17:23 ` H.J. Lu
  2014-11-27 19:11   ` Andrew Senkevich
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2014-11-27 17:23 UTC (permalink / raw)
  To: Andrew Senkevich; +Cc: libc-alpha

On Thu, Nov 27, 2014 at 7:11 AM, Andrew Senkevich
<andrew.n.senkevich@gmail.com> wrote:
> 2014-10-30 19:06 GMT+03:00 Andrew Senkevich <andrew.n.senkevich@gmail.com>:
>> 2014-10-29 20:57 GMT+03:00 Andrew Senkevich <andrew.n.senkevich@gmail.com>:
>>
>>> Hi,
>>>
>>> this patch fixes 3 make check fails on glibc 32bit built by gcc 5.0
>>> due to EBX was enabled for allocation
>>> (https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html).
>>>
>>> Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
>>> failed because EBX was used as PIC register.
>>
>> Here is the patch corrected accordingly comments in
>> https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03203.html
>>
>> ChangeLog:
>>
>> 2014-10-30  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/unix/sysv/linux/i386/sysdep.h (check_consistency):
>> Keep define only if gcc version < 5.0
>>
>> 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 57d5ea0..bce5697 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__                                                    \
>
> It is fixes not only test suite fail but build itself now.
>
> Is it OK for trunk?
>
>

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.



-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
  2014-11-27 17:23 ` H.J. Lu
@ 2014-11-27 19:11   ` Andrew Senkevich
  2014-12-29 14:39     ` Senkevich, Andrew
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Senkevich @ 2014-11-27 19:11 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 3586 bytes --]

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.

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__      \


--
WBR,
Andrew

[-- Attachment #2: ebx_glibc_v2.patch --]
[-- Type: application/octet-stream, Size: 3139 bytes --]

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__						      \

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
  2014-11-27 19:11   ` Andrew Senkevich
@ 2014-12-29 14:39     ` Senkevich, Andrew
  2014-12-30 19:13       ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: Senkevich, Andrew @ 2014-12-29 14:39 UTC (permalink / raw)
  To: H.J. Lu; +Cc: libc-alpha, Andrew Senkevich

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

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

[-- Attachment #2: ebx_glibc_v2_git_am.patch --]
[-- Type: application/octet-stream, Size: 4259 bytes --]

From 65fb46597e73d9070a9aa2d5040e16c33de0bc3f Mon Sep 17 00:00:00 2001
From: Andrew Senkevich <andrew.senkevich@intel.com>
Date: Mon, 29 Dec 2014 16:32:31 +0300
Subject: [PATCH] i386: Fixed build by GCC 5.0.

Fixed 3 make check fails on glibc 32bit built by gcc 5.0 due to EBX was
enabled for allocation (https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html).
Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
was failed because EBX was used as PIC register.

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.
---
 sysdeps/i386/sysdep.h                 | 34 ++++++++++++++++++----------------
 sysdeps/i386/tls-macros.h             |  8 +++++---
 sysdeps/unix/sysv/linux/i386/sysdep.h |  2 +-
 3 files changed, 24 insertions(+), 20 deletions(-)

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__						      \
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
  2014-12-29 14:39     ` Senkevich, Andrew
@ 2014-12-30 19:13       ` H.J. Lu
  2014-12-30 19:46         ` H.J. Lu
  0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2014-12-30 19:13 UTC (permalink / raw)
  To: Senkevich, Andrew; +Cc: libc-alpha, Andrew Senkevich

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



-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0
  2014-12-30 19:13       ` H.J. Lu
@ 2014-12-30 19:46         ` H.J. Lu
  0 siblings, 0 replies; 6+ messages in thread
From: H.J. Lu @ 2014-12-30 19:46 UTC (permalink / raw)
  To: Senkevich, Andrew; +Cc: libc-alpha, Andrew Senkevich

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

On Tue, Dec 30, 2014 at 10:31 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 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?
>>

This is the patch I checked in.

Thanks.

-- 
H.J.
---
2014-12-30  Andrew Senkevich  <andrew.senkevich@intel.com>

* sysdeps/i386/tls-macros.h: Include <features.h>.
(TLS_LE): Use non-PIC version for GCC >= 5.0.
(TLS_IE): Likewise.
(TLS_LD): Likewise.
(TLS_GD): Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Don't
define for GCC >= 5.0.

[-- Attachment #2: 0001-i386-Fix-build-by-GCC-5.0.patch --]
[-- Type: text/x-patch, Size: 2939 bytes --]

From f3a36d9328f5c32945cbda64375df237a359dcd9 Mon Sep 17 00:00:00 2001
From: Andrew Senkevich <andrew.senkevich@intel.com>
Date: Tue, 30 Dec 2014 11:34:53 -0800
Subject: [PATCH] i386: Fix build by GCC 5.0

Fixed 3 "make check" failures on glibc 32bit built by gcc 5.0 due to EBX
was enabled for allocation:

https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00892.html

Tests elf/tst-tls3, elf/tst-execstack-needed, elf/tst-execstack-prog
were failed because EBX was used as PIC register.

	* sysdeps/i386/tls-macros.h: Include <features.h>.
	(TLS_LE): Use non-PIC version for GCC >= 5.0.
	(TLS_IE): Likewise.
	(TLS_LD): Likewise.
	(TLS_GD): Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Don't
	define for GCC >= 5.0.
---
 ChangeLog                             | 10 ++++++++++
 sysdeps/i386/tls-macros.h             |  8 +++++---
 sysdeps/unix/sysv/linux/i386/sysdep.h |  2 +-
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5780c3a..ac8bbf3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2014-12-30  Andrew Senkevich  <andrew.senkevich@intel.com>
+
+	* sysdeps/i386/tls-macros.h: Include <features.h>.
+	(TLS_LE): Use non-PIC version for GCC >= 5.0.
+	(TLS_IE): Likewise.
+	(TLS_LD): Likewise.
+	(TLS_GD): Likewise.
+	* sysdeps/unix/sysv/linux/i386/sysdep.h (check_consistency): Don't
+	define for GCC >= 5.0.
+
 2014-12-30  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #17723]
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__						      \
-- 
1.9.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-30 19:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 15:12 [PING] [PATCH] i686: Fix test suite fails on build by gcc 5.0 Andrew Senkevich
2014-11-27 17:23 ` H.J. Lu
2014-11-27 19:11   ` Andrew Senkevich
2014-12-29 14:39     ` Senkevich, Andrew
2014-12-30 19:13       ` H.J. Lu
2014-12-30 19:46         ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).