Gold: Don't fail on R_386_GOT32X relocation
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 22 Oct 2015 11:54:42 +0000 (04:54 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 22 Oct 2015 11:56:49 +0000 (04:56 -0700)
This patch updates gold to treat the R_386_GOT32X relocation proposed in

https://groups.google.com/forum/#!topic/ia32-abi/GbJJskkid4I

the same as R_386_GOT32.  FIXME: Gold should perform the transformations
as suggested.

elfcpp/

* i386.h (R_386_GOT32X): New.

gold/

* i386.cc (Target_i386::Scan::get_reference_flags(): Treat
R_386_GOT32X the same as R_386_GOT32.
(Target_i386::Scan::local): Likewise.
(Target_i386::Scan::possible_function_pointer_reloc): Likewise.
(Target_i386::Scan::global): Likewise.
(Target_i386::Relocate::relocate): Likewise.
(Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
Likewise.

elfcpp/ChangeLog
elfcpp/i386.h
gold/ChangeLog
gold/i386.cc

index 18c1d5a1f2886a433ced78a229c284816d2eba28..c0f1698d0b4c8f66c6ef4e71ae6d6190e0cb5c4f 100644 (file)
@@ -1,3 +1,7 @@
+2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * i386.h (R_386_GOT32X): New.
+
 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR gold/19118
index 16fdef8266ceab5e0acdb1d847ebd362461bf010..9d57a0f10c462f9683b4c84528bf05848b7afaca 100644 (file)
@@ -86,6 +86,7 @@ enum
   R_386_TLS_DESC = 41,      // TLS descriptor containing pointer to code and
                             // to argument, returning TLS offset for symbol
   R_386_IRELATIVE = 42,     // Adjust indirectly by program base
+  R_386_GOT32X = 43,        // 32 bit GOT entry, relaxable
   // Used by Intel.
   R_386_USED_BY_INTEL_200 = 200,
   // GNU vtable garbage collection extensions.
index a3d0571dcdbf2cb528a0282e6d3e13a1dd496833..c0af0291d0e65512e094000d3e46311989dd0d3e 100644 (file)
@@ -1,3 +1,14 @@
+2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
+       R_386_GOT32X the same as R_386_GOT32.
+       (Target_i386::Scan::local): Likewise.
+       (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
+       (Target_i386::Scan::global): Likewise.
+       (Target_i386::Relocate::relocate): Likewise.
+       (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
+       Likewise.
+
 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
index 202f518c3560a3cef613c1ec9f1a604d100237e1..36c57241ef9f4f64654e6561fb7606a37608ba99 100644 (file)
@@ -1690,6 +1690,7 @@ Target_i386::Scan::get_reference_flags(unsigned int r_type)
       return Symbol::FUNCTION_CALL | Symbol::RELATIVE_REF;
 
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
       // Absolute in GOT.
       return Symbol::ABSOLUTE_REF;
 
@@ -1854,6 +1855,7 @@ Target_i386::Scan::local(Symbol_table* symtab,
       break;
 
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
       {
        // We need GOT section.
        Output_data_got<32, false>* got = target->got_section(symtab, layout);
@@ -2105,6 +2107,7 @@ Target_i386::Scan::possible_function_pointer_reloc(unsigned int r_type)
     case elfcpp::R_386_8:
     case elfcpp::R_386_GOTOFF:
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
       {
        return true;
       }
@@ -2266,6 +2269,7 @@ Target_i386::Scan::global(Symbol_table* symtab,
       break;
 
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
       {
        // The symbol requires a GOT section.
        Output_data_got<32, false>* got = target->got_section(symtab, layout);
@@ -2834,6 +2838,7 @@ Target_i386::Relocate::relocate(const Relocate_info<32, false>* relinfo,
       break;
 
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
       // Convert
       // mov foo@GOT(%reg), %reg
       // to
@@ -3617,6 +3622,7 @@ Target_i386::Relocatable_size_for_reloc::get_size_for_reloc(
     case elfcpp::R_386_32:
     case elfcpp::R_386_PC32:
     case elfcpp::R_386_GOT32:
+    case elfcpp::R_386_GOT32X:
     case elfcpp::R_386_PLT32:
     case elfcpp::R_386_GOTOFF:
     case elfcpp::R_386_GOTPC: