From: "H.J. Lu" <hjl.tools@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 4/5] Check if x86 binutils supports R_386_GOT32X/R_X86_64_GOTPCRELX
Date: Thu, 22 Oct 2015 17:09:00 -0000 [thread overview]
Message-ID: <1445533745-19016-5-git-send-email-hjl.tools@gmail.com> (raw)
In-Reply-To: <1445533745-19016-1-git-send-email-hjl.tools@gmail.com>
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.
---
gcc/config.in | 13 ++++++++++++
gcc/configure | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
gcc/configure.ac | 45 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 119 insertions(+)
diff --git a/gcc/config.in b/gcc/config.in
index 77b3862..d32906d 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 e388318..0ce7d65 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 7d5cc9a..afada92 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*-*-*)
--
2.4.3
next prev parent reply other threads:[~2015-10-22 17:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 17:09 [PATCH 0/5] Improve x86 Position-Independent codegen H.J. Lu
2015-10-22 17:09 ` [PATCH 5/5] Generate R_386_GOT32x relocation for -fno-plt -fno-pic H.J. Lu
2015-10-22 17:09 ` [PATCH 1/5] X86: Optimize access to globals in PIE with copy reloc H.J. Lu
2015-10-22 17:09 ` [PATCH 3/5] Properly handle -fno-plt in ix86_expand_call H.J. Lu
2015-10-22 17:09 ` H.J. Lu [this message]
2015-10-22 17:13 ` [PATCH 2/5] Enable -fsymbolic in LTO if -Bsymbolic is used H.J. Lu
2015-10-23 8:57 ` Richard Biener
2015-10-23 17:36 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445533745-19016-5-git-send-email-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).