summaryrefslogtreecommitdiff
path: root/gold/configure
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-06-29 08:37:30 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-29 08:37:42 -0700
commitad961eab9a010e79d17a4ea7e6bb977fe6dd86c2 (patch)
treea4e66fa49c5f2abc3328cceae2ab73cbf470ad0b /gold/configure
parent9bf74fb27dc6e2a9679403d66fe919215e3c2a45 (diff)
downloadbinutils-gdb-ad961eab9a010e79d17a4ea7e6bb977fe6dd86c2.tar.gz
gold: Support x86-64 TLS code sequences without PLT
There are extensions to x86-64 psABI: https://groups.google.com/forum/#!topic/x86-64-abi/de5_KnLHxtI to call tls_get_addr via GOT: call *__tls_get_addr@GOTPCREL(%rip) Since direct call is 4-byte long and indirect call, is 5-byte long, the extra one byte must be handled properly. For general dynamic model, one 0x66 prefix before call instruction is removed to make room for indirect call. For local dynamic model, we simply use 5-byte indirect call. TLS linker optimization is updated to recognize new instruction patterns. For local dynamic model to local exec model transition, we generate 4 0x66 prefixes, instead of 3, before mov instruction in 64-bit and generate a 5-byte nop, instead of 4-byte, before mov instruction in 32-bit. PR gold/20216 * configure.ac (DEFAULT_TARGET_X86_64_OR_X32): New AM_CONDITIONAL. * configure: Regenerated. * x86_64.cc (Target_x86_64<size>::Relocate::relocate): Allow R_X86_64_GOTPCRELX relocation against __tls_get_addr. (Target_x86_64<size>::Relocate::tls_gd_to_ie): Support indirect call to __tls_get_addr. (Target_x86_64<size>::Relocate::tls_gd_to_le): Likewise. (Target_x86_64<size>::Relocate::tls_ld_to_le): Likewise. * testsuite/Makefile.am (check_PROGRAMS): Add pr20216a_test, pr20216b_test, pr20216c_test, pr20216d_test, pr20216e_test. (pr20216a_test_SOURCES): New. (pr20216a_test_DEPENDENCIES): Likewise. (pr20216a_test_CFLAGS): Likewise. (pr20216a_test_LDFLAGS): Likewise. (pr20216a_test_LDADD): Likewise. (pr20216b_test_SOURCES): Likewise. (pr20216b_test_DEPENDENCIES): Likewise. (pr20216b_test_CFLAGS): Likewise. (pr20216b_test_LDFLAGS): Likewise. (pr20216b_test_LDADD): Likewise. (pr20216c_test_SOURCES): Likewise. (pr20216c_test_DEPENDENCIES): Likewise. (pr20216c_test_CFLAGS): Likewise. (pr20216c_test_LDFLAGS): Likewise. (pr20216c_test_LDADD): Likewise. (pr20216d_test_SOURCES): Likewise. (pr20216d_test_DEPENDENCIES): Likewise. (pr20216d_test_CFLAGS): Likewise. (pr20216d_test_LDFLAGS): Likewise. (pr20216d_test_LDADD): Likewise. (pr20216e_test_SOURCES): Likewise. (pr20216e_test_DEPENDENCIES): Likewise. (pr20216e_test_CFLAGS): Likewise. (pr20216e_test_LDFLAGS): Likewise. (pr20216e_test_LDADD): Likewise. (pr20216a.so): Likewise. (pr20216b.so): Likewise. (pr20216_gd.o): Likewise. (pr20216_ld.o): Likewise. (MOSTLYCLEANFILES): Add pr20216a.so pr20216b.so. * testsuite/Makefile.in: Regenerated. * testsuite/pr20216_def.c: New file. * testsuite/pr20216_gd.S: Likewise. * testsuite/pr20216_ld.S: Likewise. * testsuite/pr20216_main.c: Likewise.
Diffstat (limited to 'gold/configure')
-rwxr-xr-xgold/configure14
1 files changed, 14 insertions, 0 deletions
diff --git a/gold/configure b/gold/configure
index a40b2b542e1..8240c28a91e 100755
--- a/gold/configure
+++ b/gold/configure
@@ -690,6 +690,8 @@ DEFAULT_TARGET_MIPS_FALSE
DEFAULT_TARGET_MIPS_TRUE
DEFAULT_TARGET_TILEGX_FALSE
DEFAULT_TARGET_TILEGX_TRUE
+DEFAULT_TARGET_X86_64_OR_X32_FALSE
+DEFAULT_TARGET_X86_64_OR_X32_TRUE
DEFAULT_TARGET_X32_FALSE
DEFAULT_TARGET_X32_TRUE
DEFAULT_TARGET_X86_64_FALSE
@@ -3539,6 +3541,14 @@ else
DEFAULT_TARGET_X32_FALSE=
fi
+ if test "$target_x86_64" = "yes" -o "$target_x32" = "yes"; then
+ DEFAULT_TARGET_X86_64_OR_X32_TRUE=
+ DEFAULT_TARGET_X86_64_OR_X32_FALSE='#'
+else
+ DEFAULT_TARGET_X86_64_OR_X32_TRUE='#'
+ DEFAULT_TARGET_X86_64_OR_X32_FALSE=
+fi
+
if test "$targ_obj" = "tilegx"; then
DEFAULT_TARGET_TILEGX_TRUE=
DEFAULT_TARGET_TILEGX_FALSE='#'
@@ -7837,6 +7847,10 @@ if test -z "${DEFAULT_TARGET_X32_TRUE}" && test -z "${DEFAULT_TARGET_X32_FALSE}"
as_fn_error "conditional \"DEFAULT_TARGET_X32\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${DEFAULT_TARGET_X86_64_OR_X32_TRUE}" && test -z "${DEFAULT_TARGET_X86_64_OR_X32_FALSE}"; then
+ as_fn_error "conditional \"DEFAULT_TARGET_X86_64_OR_X32\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${DEFAULT_TARGET_TILEGX_TRUE}" && test -z "${DEFAULT_TARGET_TILEGX_FALSE}"; then
as_fn_error "conditional \"DEFAULT_TARGET_TILEGX\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5