Fix for PR gold/19987.
authorHan Shen <shenhan@google.com>
Fri, 6 May 2016 22:07:13 +0000 (15:07 -0700)
committerHan Shen <shenhan@google.com>
Mon, 9 May 2016 21:22:15 +0000 (14:22 -0700)
gold/ChangeLog
gold/aarch64-reloc.def
gold/aarch64.cc

index fb276638775077d948930c621986d5e66135e696..0bc160aaa8618646ef584fe7e20adfdc8562dc32 100644 (file)
@@ -1,3 +1,13 @@
+2016-05-06  Han Shen  <shenhan@google.com>
+
+       PR gold/19987.
+
+       * aarch64-reloc.def: New relocation type.
+       * aarch64.cc (AArch64_relocate_functions::Page): Changed to public.
+       (Target_aarch64::Scan::local): Add R_AARCH64_LD64_GOTPAGE_LO15.
+       (Target_aarch64::Scan::global): Add R_AARCH64_LD64_GOTPAGE_LO15.
+       (Target_aarch64::Relocate::relocate): Implement R_AARCH64_LD64_GOTPAGE_LO15.
+
 2016-04-28  Nick Clifton  <nickc@redhat.com>
 
        * po/zh_CN.po: Updated Chinese (simplified) translation.
index 93c465d191b6423f201f1b40aef1b5c6b1a4f2e7..f33929b4e8570f0bfbca5d4732b0edc9ad189f09 100644 (file)
@@ -54,6 +54,7 @@ ARD(LDST128_ABS_LO12_NC          , STATIC ,  AARCH64    ,   Y,  -1,    0,RL_CHEC
 
 ARD(ADR_GOT_PAGE                 , STATIC ,  AARCH64    ,   Y,  -1,   32,32               ,   12,32 , Symbol::RELATIVE_REF ,                         ADRP  )
 ARD(LD64_GOT_LO12_NC             , STATIC ,  AARCH64    ,   Y,  -1,    0,RL_CHECK_ALIGN8  ,    3,11 , Symbol::ABSOLUTE_REF ,                         LDST  )
+ARD(LD64_GOTPAGE_LO15            , STATIC ,  AARCH64    ,   Y,  -1,    0,15               ,    3,14 , Symbol::RELATIVE_REF ,                         LDST  )
 // Above 2 relocs are from Table 4-14, GOT-relative instruction relocations. (Some relocs in the table are not implemented yet.)
 
 ARD(TSTBR14                      , STATIC ,  CFLOW      ,   N,  -1,   15,15               ,    2,15 , (Symbol::FUNCTION_CALL|Symbol::ABSOLUTE_REF) , TBZNZ )
index 01868c7cc9fe0685207fb24e2c3456c1d04e63db..75e4177c7e935cdc1a4ea9d027e0874bb546ecc8 100644 (file)
@@ -5106,6 +5106,8 @@ class AArch64_relocate_functions
       static_cast<Valtype>(val | (immed << doffset)));
   }
 
+ public:
+
   // Update selected bits in text.
 
   template<int valsize>
@@ -5133,8 +5135,6 @@ class AArch64_relocate_functions
            : This::STATUS_OVERFLOW);
   }
 
- public:
-
   // Construct a B insn. Note, although we group it here with other relocation
   // operation, there is actually no 'relocation' involved here.
   static inline void
@@ -6001,7 +6001,8 @@ Target_aarch64<size, big_endian>::Scan::local(
 
     case elfcpp::R_AARCH64_ADR_GOT_PAGE:
     case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
-      // This pair of relocations is used to access a specific GOT entry.
+    case elfcpp::R_AARCH64_LD64_GOTPAGE_LO15:
+      // The above relocations are used to access GOT entries.
       {
        bool is_new = false;
        // This symbol requires a GOT entry.
@@ -6326,8 +6327,9 @@ Target_aarch64<size, big_endian>::Scan::global(
 
     case elfcpp::R_AARCH64_ADR_GOT_PAGE:
     case elfcpp::R_AARCH64_LD64_GOT_LO12_NC:
+    case elfcpp::R_AARCH64_LD64_GOTPAGE_LO15:
       {
-       // This pair of relocations is used to access a specific GOT entry.
+       // The above relocations are used to access GOT entries.
        // Note a GOT entry is an *address* to a symbol.
        // The symbol requires a GOT entry
        Output_data_got_aarch64<size, big_endian>* got =
@@ -7045,6 +7047,19 @@ Target_aarch64<size, big_endian>::Relocate::relocate(
        view, value, addend, reloc_property);
       break;
 
+    case elfcpp::R_AARCH64_LD64_GOTPAGE_LO15:
+      {
+       gold_assert(have_got_offset);
+       value = target->got_->address() + got_base + got_offset + addend -
+         Reloc::Page(target->got_->address() + got_base);
+       if ((value & 7) != 0)
+         reloc_status = Reloc::STATUS_OVERFLOW;
+       else
+         reloc_status = Reloc::template reloc_common<32>(
+           view, value, reloc_property);
+       break;
+      }
+
     case elfcpp::R_AARCH64_TLSGD_ADR_PAGE21:
     case elfcpp::R_AARCH64_TLSGD_ADD_LO12_NC:
     case elfcpp::R_AARCH64_TLSLD_ADR_PAGE21:
This page took 0.028393 seconds and 4 git commands to generate.