summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-23 10:51:15 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-10-27 07:56:45 -0700
commitf2ecf5f5f0c1a9c94b1bc0a779731793c062afc8 (patch)
tree72ddb38a12452b18af874f73be13f67be7919874
parentf9bbf43f58e59ddf741ec94d5426907dcc78a99e (diff)
downloadgcc-f2ecf5f5f0c1a9c94b1bc0a779731793c062afc8.tar.gz
Check if x86 binutils supports R_386_GOT32X/R_X86_64_GOTPCRELX
Define HAVE_LD_R_386_GOT32X to 1 if 32-bit x86 assembler generates R_386_GOT32X for "jmp *foo@GOT". Define HAVE_LD_R_X86_64_GOTPCRELX to 1 if 64-bit x86 assembler generates R_X86_64_GOTPCRELX for "jmp *foo@GOTPCREL(%rip)". * configure.ac (HAVE_LD_R_386_GOT32X): New. Defined to 1 if 32-bit assembler generates R_386_GOT32X for "jmp *foo@GOT". Otherise, defined to 0. (HAVE_LD_R_X86_64_GOTPCRELX): New. Defined to 1 if 64-bit x86 assembler generates R_X86_64_GOTPCRELX for "jmp *foo@GOTPCREL(%rip)". * config.in: Regenerated. * configure: Likewise.
-rw-r--r--gcc/config.in13
-rwxr-xr-xgcc/configure61
-rw-r--r--gcc/configure.ac45
3 files changed, 119 insertions, 0 deletions
diff --git a/gcc/config.in b/gcc/config.in
index 77b386269ac..d32906d52cf 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1507,6 +1507,19 @@
#endif
+/* Define 0/1 if Define if your linker supports R_386_GOT32X relocation. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_R_386_GOT32X
+#endif
+
+
+/* Define 0/1 if Define if your linker supports R_X86_64_GOTPCRELX relocation.
+ */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_R_X86_64_GOTPCRELX
+#endif
+
+
/* Define if your linker supports the *_sol2 emulations. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_SOL2_EMULATION
diff --git a/gcc/configure b/gcc/configure
index e3883184461..0ce7d65a832 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -25779,6 +25779,67 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker for R_386_GOT32X relocation" >&5
+$as_echo_n "checking linker for R_386_GOT32X relocation... " >&6; }
+if test "${gcc_cv_ld_r_386_got32x+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_ld_r_386_got32x=no
+ if test $in_tree_ld = yes ; then
+ if grep R_386_GOT32X $srcdir/../include/elf/i386.h > /dev/null 2>&1; then
+ gcc_cv_ld_r_386_got32x=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_readelf != x; then
+ cat > conftest.s <<EOF
+ jmp *foo@GOT
+EOF
+ if $gcc_cv_as --32 -o conftest.o conftest.s > /dev/null 2>&1; then
+ if $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
+ | grep R_386_GOT32X > /dev/null 2>&1; then
+ gcc_cv_ld_r_386_got32x=yes
+ fi
+ fi
+ fi
+ rm -f conftest.s conftest.o
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_r_386_got32x" >&5
+$as_echo "$gcc_cv_ld_r_386_got32x" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LD_R_386_GOT32X `if test x"$gcc_cv_ld_r_386_got32x" = xyes; then echo 1; else echo 0; fi`
+_ACEOF
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking linker for R_X86_64_GOTPCRELX relocation" >&5
+$as_echo_n "checking linker for R_X86_64_GOTPCRELX relocation... " >&6; }
+if test "${gcc_cv_ld_r_x86_64_gotpcrelx+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_ld_r_x86_64_gotpcrelx=no
+ if test $in_tree_ld = yes ; then
+ if grep R_X86_64_GOTPCRELX $srcdir/../include/elf/i386.h > /dev/null 2>&1; then
+ gcc_cv_ld_r_x86_64_gotpcrelx=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_readelf != x; then
+ cat > conftest.s <<EOF
+ jmp *foo@GOTPCREL(%rip)
+EOF
+ if $gcc_cv_as --64 -o conftest.o conftest.s > /dev/null 2>&1; then
+ if $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
+ | grep R_X86_64_GOTPCRELX > /dev/null 2>&1; then
+ gcc_cv_ld_r_x86_64_gotpcrelx=yes
+ fi
+ fi
+ fi
+ rm -f conftest.s conftest.o
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_ld_r_x86_64_gotpcrelx" >&5
+$as_echo "$gcc_cv_ld_r_x86_64_gotpcrelx" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LD_R_X86_64_GOTPCRELX `if test x"$gcc_cv_ld_r_x86_64_gotpcrelx" = xyes; then echo 1; else echo 0; fi`
+_ACEOF
+
;;
ia64*-*-*)
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 7d5cc9a14a7..afada9214ea 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4137,6 +4137,51 @@ value:'
[`if test $gcc_cv_as_ix86_tlsldm = yes; then echo 1; else echo 0; fi`],
[Define to 1 if your assembler and linker support @tlsldm.])
+ AC_CACHE_CHECK([linker for R_386_GOT32X relocation],
+ [gcc_cv_ld_r_386_got32x],
+ [gcc_cv_ld_r_386_got32x=no
+ if test $in_tree_ld = yes ; then
+ if grep R_386_GOT32X $srcdir/../include/elf/i386.h > /dev/null 2>&1; then
+ gcc_cv_ld_r_386_got32x=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_readelf != x; then
+ cat > conftest.s <<EOF
+ jmp *foo@GOT
+EOF
+ if $gcc_cv_as --32 -o conftest.o conftest.s > /dev/null 2>&1; then
+ if $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
+ | grep R_386_GOT32X > /dev/null 2>&1; then
+ gcc_cv_ld_r_386_got32x=yes
+ fi
+ fi
+ fi
+ rm -f conftest.s conftest.o])
+ AC_DEFINE_UNQUOTED(HAVE_LD_R_386_GOT32X,
+ [`if test x"$gcc_cv_ld_r_386_got32x" = xyes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if Define if your linker supports R_386_GOT32X relocation.])
+
+ AC_CACHE_CHECK([linker for R_X86_64_GOTPCRELX relocation],
+ [gcc_cv_ld_r_x86_64_gotpcrelx],
+ [gcc_cv_ld_r_x86_64_gotpcrelx=no
+ if test $in_tree_ld = yes ; then
+ if grep R_X86_64_GOTPCRELX $srcdir/../include/elf/i386.h > /dev/null 2>&1; then
+ gcc_cv_ld_r_x86_64_gotpcrelx=yes
+ fi
+ elif test x$gcc_cv_as != x -a x$gcc_cv_readelf != x; then
+ cat > conftest.s <<EOF
+ jmp *foo@GOTPCREL(%rip)
+EOF
+ if $gcc_cv_as --64 -o conftest.o conftest.s > /dev/null 2>&1; then
+ if $gcc_cv_readelf --relocs --wide conftest.o 2>&1 \
+ | grep R_X86_64_GOTPCRELX > /dev/null 2>&1; then
+ gcc_cv_ld_r_x86_64_gotpcrelx=yes
+ fi
+ fi
+ fi
+ rm -f conftest.s conftest.o])
+ AC_DEFINE_UNQUOTED(HAVE_LD_R_X86_64_GOTPCRELX,
+ [`if test x"$gcc_cv_ld_r_x86_64_gotpcrelx" = xyes; then echo 1; else echo 0; fi`],
+ [Define 0/1 if Define if your linker supports R_X86_64_GOTPCRELX relocation.])
;;
ia64*-*-*)