Fix GOTPCREL for x86_64

Andreas Jaeger aj@suse.de
Mon Nov 10 14:25:00 GMT 2003


We have the appended patch in our binutils already for quite some time
but unfortunatly the original testcase was lost.  I'm not sure whether
we forgot to send it - or to commit it, I can't find anything on it:-(

Brief explanation:
This fixes generation of GOTPCREL relocations, they had sometimes the
wrong offset.

This version should be safe even for non-ELF targets.

Ok to commit?

Andreas

2003-11-10  Jan Hubicka  <jh@suse.cz>

	* config/tc-i386.c (tc_i386_fix_adjustable): Recognize
	GOTPCREL properly.

============================================================
Index: gas/config/tc-i386.c
--- gas/config/tc-i386.c	14 Aug 2003 08:05:44 -0000	1.146
+++ gas/config/tc-i386.c	10 Nov 2003 14:22:44 -0000
@@ -1225,7 +1225,13 @@ tc_i386_fix_adjustable (fixP)
       && fixP->fx_pcrel)
     return 0;
 
-  /* adjust_reloc_syms doesn't know about the GOT.  */
+  /* The x86_64 GOTPCREL are represented as 32bit PCrel relocations
+     and changed later by validate_fix.  */
+  if (GOT_symbol && fixP->fx_subsy == GOT_symbol
+      && fixP->fx_r_type == BFD_RELOC_32_PCREL)
+    return 0;
+
+/* adjust_reloc_syms doesn't know about the GOT.  */
   if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF
       || fixP->fx_r_type == BFD_RELOC_386_PLT32
       || fixP->fx_r_type == BFD_RELOC_386_GOT32

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20031110/087fbea2/attachment.sig>


More information about the Binutils mailing list