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]

Fix GOTPCREL for x86-64



GOTPCREL was broken for x86-64, I've committed the appended patch that
just changes the order of the comparisons,

Andreas

2001-01-08  Bo Thorsen  <bo@suse.de>

        * config/tc-i386.c (i386_immediate, i386_displacement):
        GOTPCREL check fix.

Index: config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.77
diff -u -r1.77 tc-i386.c
--- tc-i386.c	2001/01/06 12:36:03	1.77
+++ tc-i386.c	2001/01/08 09:34:35
@@ -1,5 +1,5 @@
 /* i386.c -- Assemble code for the Intel 80386
-   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -3132,20 +3132,20 @@
 	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
 	    len = 6;
 	  }
-	else if (strncmp (cp + 1, "GOT", 3) == 0)
+	else if (strncmp (cp + 1, "GOTPCREL", 8) == 0)
 	  {
 	    if (flag_code == CODE_64BIT)
-	      i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOT32;
+	      i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOTPCREL;
 	    else
-	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
-	    len = 3;
+	      as_bad ("GOTPCREL relocations are supported only in 64bit mode.");
+	    len = 8;
 	  }
-	else if (strncmp (cp + 1, "GOTPCREL", 3) == 0)
+	else if (strncmp (cp + 1, "GOT", 3) == 0)
 	  {
 	    if (flag_code == CODE_64BIT)
-	      i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOTPCREL;
+	      i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOT32;
 	    else
-	      as_bad ("GOTPCREL relocations are supported only in 64bit mode.");
+	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
 	    len = 3;
 	  }
 	else
@@ -3370,19 +3370,19 @@
 	    i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
 	    len = 6;
 	  }
+	else if (strncmp (cp + 1, "GOTPCREL", 8) == 0)
+	  {
+	    if (flag_code != CODE_64BIT)
+	      as_bad ("GOTPCREL relocation is supported only in 64bit mode.");
+	    i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOTPCREL;
+	    len = 8;
+	  }
 	else if (strncmp (cp + 1, "GOT", 3) == 0)
 	  {
 	    if (flag_code == CODE_64BIT)
 	      i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOT32;
 	    else
 	      i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
-	    len = 3;
-	  }
-	else if (strncmp (cp + 1, "GOTPCREL", 3) == 0)
-	  {
-	    if (flag_code != CODE_64BIT)
-	      as_bad ("GOTPCREL relocation is supported only in 64bit mode.");
-	    i.disp_reloc[this_operand] = BFD_RELOC_X86_64_GOTPCREL;
 	    len = 3;
 	  }
 	else

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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