diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-06-24 17:32:52 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-06-25 17:18:15 -0700 |
commit | d42e07e4f96d36e46d1538e3f2effeef2cc1595b (patch) | |
tree | 2f4a525ae89f7c2cd0575519830818fa211e0141 /gcc/config/i386/i386.h | |
parent | 08ef2fe8a3290ede10d6827bc57ebc2488d5db7a (diff) | |
download | gcc-d42e07e4f96d36e46d1538e3f2effeef2cc1595b.tar.gz |
Call tls_get_addr via GOT for GNU TLS if possiblehjl/no-plt/gcc-6-branch
There are extensions to x86-64 psABI:
https://groups.google.com/forum/#!topic/x86-64-abi/de5_KnLHxtI
and i386 psABI:
https://groups.google.com/forum/#!topic/ia32-abi/awsRSvJOJfs
to call tls_get_addr via GOT. X86 assembler and linker in binutils 2.27
implemented
call *__tls_get_addr@GOTPCREL(%rip)
in 64-bit and
call *___tls_get_addr@GOT(%reg)
in 32-bit to access global and local thread loal variables in shared
library. We check if 32-bit x86 assembler and linker work with
call *___tls_get_addr@GOT(%reg)
as 32-bit and 64-bit assembler and linker are enabled togther.
In 32-bit, since any integer register except EAX, which is used to pass
parameter to ___tls_get_addr, and ESP, can be used as GOT base, a new
register class, TLS_GOTBASE_REGS, along with a new constraint, Yb, are
added. They are used to improve register allocation for 32-bit dynamic
TLS patterns.
gcc/
* configure.ac (calling ___tls_get_addr via GOT): New
assembler/linker check.
(HAVE_AS_IX86_TLS_GET_ADDR_GOT): New. Defined to 1 if 32-bit
assembler and linker supports calling ___tls_get_addr via GOT.
Otherise, defined to 0.
* config.in: Regenerated.
* configure: Likewise.
* config/i386/constraints.md (Yb): New constraint.
* config/i386/i386.h (reg_class): Add TLS_GOTBASE_REGS.
(REG_CLASS_NAMES): Likewise.
(REG_CLASS_CONTENTS): Likewise.
* config/i386/i386.md (*tls_global_dynamic_32_gnu): Replace
the b constraint with the Yb constraint. Call ___tls_get_addr
via GOT for GNU TLS with -fno-plt if HAVE_AS_IX86_TLS_GET_ADDR_GOT
is 1.
(*tls_local_dynamic_base_32_gnu): Likewise.
(*tls_global_dynamic_64_<mode>): Call _tls_get_addr via GOT for
GNU TLS with -fno-plt if HAVE_AS_IX86_TLS_GET_ADDR_GOT is 1.
(*tls_local_dynamic_base_64_<mode>): Likewise.
gcc/testsuite/
* gcc.target/i386/noplt-gd-1.c: New test.
* gcc.target/i386/noplt-gd-2.c: Likewise.
* gcc.target/i386/noplt-gd-3.c: Likewise.
* gcc.target/i386/noplt-ld-1.c: Likewise.
* gcc.target/i386/noplt-ld-2.c: Likewise.
* gcc.target/i386/noplt-ld-3.c: Likewise.
* lib/target-supports.exp
(check_effective_target_tls_get_addr_via_got): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237765 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/i386.h')
-rw-r--r-- | gcc/config/i386/i386.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index ec306f37d3b..d54831239a0 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1346,6 +1346,7 @@ enum reg_class CLOBBERED_REGS, /* call-clobbered integer registers */ Q_REGS, /* %eax %ebx %ecx %edx */ NON_Q_REGS, /* %esi %edi %ebp %esp */ + TLS_GOTBASE_REGS, /* %ebx %ecx %edx %esi %edi %ebp */ INDEX_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp */ LEGACY_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp */ GENERAL_REGS, /* %eax %ebx %ecx %edx %esi %edi %ebp %esp @@ -1406,6 +1407,7 @@ enum reg_class "AD_REGS", \ "CLOBBERED_REGS", \ "Q_REGS", "NON_Q_REGS", \ + "TLS_GOTBASE_REGS", \ "INDEX_REGS", \ "LEGACY_REGS", \ "GENERAL_REGS", \ @@ -1446,6 +1448,7 @@ enum reg_class { 0x07, 0x0, 0x0 }, /* CLOBBERED_REGS */ \ { 0x0f, 0x0, 0x0 }, /* Q_REGS */ \ { 0x1100f0, 0x1fe0, 0x0 }, /* NON_Q_REGS */ \ + { 0x7e, 0x1fe0, 0x0 }, /* TLS_GOTBASE_REGS */ \ { 0x7f, 0x1fe0, 0x0 }, /* INDEX_REGS */ \ { 0x1100ff, 0x0, 0x0 }, /* LEGACY_REGS */ \ { 0x1100ff, 0x1fe0, 0x0 }, /* GENERAL_REGS */ \ |