This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix GOTPCREL for x86_64


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

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]