mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 23:10:06 +00:00
07256e183e
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.
79 lines
2.5 KiB
C
79 lines
2.5 KiB
C
#include <features.h> /* For __GNUC_PREREQ. */
|
|
|
|
#define TLS_LE(x) \
|
|
({ int *__l; \
|
|
asm ("movl %%gs:0,%0\n\t" \
|
|
"subl $" #x "@tpoff,%0" \
|
|
: "=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) \
|
|
({ int *__l, __b; \
|
|
asm ("call 1f\n\t" \
|
|
".subsection 1\n" \
|
|
"1:\tmovl (%%esp), %%ebx\n\t" \
|
|
"ret\n\t" \
|
|
".previous\n\t" \
|
|
"addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
|
|
"movl %%gs:0,%0\n\t" \
|
|
"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) \
|
|
({ int *__l, __b, __c, __d; \
|
|
asm ("call 1f\n\t" \
|
|
".subsection 1\n" \
|
|
"1:\tmovl (%%esp), %%ebx\n\t" \
|
|
"ret\n\t" \
|
|
".previous\n\t" \
|
|
"addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
|
|
"leal " #x "@tlsldm(%%ebx),%%eax\n\t" \
|
|
"call ___tls_get_addr@plt\n\t" \
|
|
"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) \
|
|
({ int *__l, __b, __c, __d; \
|
|
asm ("call 1f\n\t" \
|
|
".subsection 1\n" \
|
|
"1:\tmovl (%%esp), %%ebx\n\t" \
|
|
"ret\n\t" \
|
|
".previous\n\t" \
|
|
"addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \
|
|
"leal " #x "@tlsgd(%%ebx),%%eax\n\t" \
|
|
"call ___tls_get_addr@plt\n\t" \
|
|
"nop" \
|
|
: "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \
|
|
__l; })
|
|
#endif
|