* powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
authorAndreas Schwab <schwab@linux-m68k.org>
Tue, 20 Jan 2009 16:12:00 +0000 (16:12 +0000)
committerAndreas Schwab <schwab@linux-m68k.org>
Tue, 20 Jan 2009 16:12:00 +0000 (16:12 +0000)
read the value in the contents, since we don't use it.  Use the
template endianness when writing.
(Relocate::relocate): Use it for R_PPC_REL16_HA.

gold/ChangeLog
gold/powerpc.cc

index 8c9a97eef4dd4a134d6441e16f3d9520bd167174..ddfe7b3f9384179c676d14527a2b3664bcdf5f19 100644 (file)
@@ -1,3 +1,10 @@
+2009-01-20  Andreas Schwab  <schwab@suse.de>
+
+       * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
+       read the value in the contents, since we don't use it.  Use the
+       template endianness when writing.
+       (Relocate::relocate): Use it for R_PPC_REL16_HA.
+
 2009-01-19  Andreas Schwab  <schwab@suse.de>
 
        * configure.tgt (powerpc64-*): Fix targ_obj.
index 05ce4fcc1ecfe60b3c97f2f07cd9e9456a5c8218..2d1d9844ca7b92517f462673961959354f7cff46 100644 (file)
@@ -663,9 +663,6 @@ public:
           typename elfcpp::Elf_types<size>::Elf_Addr addend,
           typename elfcpp::Elf_types<size>::Elf_Addr address)
   {
-    typedef typename elfcpp::Swap<16, true>::Valtype Valtype;
-    Valtype* wv = reinterpret_cast<Valtype*>(view);
-    Valtype val = elfcpp::Swap<16, true>::readval(wv);
     typename elfcpp::Elf_types<size>::Elf_Addr reloc;
 
     reloc = (psymval->value(object, addend) - address);
@@ -673,10 +670,7 @@ public:
       reloc += 0x10000;
     reloc >>= 16;
 
-    val &= ~static_cast<Valtype>(0xffff);
-    reloc &= static_cast<Valtype>(0xffff);
-
-    elfcpp::Swap<16, true>::writeval(wv, val | reloc);
+    elfcpp::Swap<16, big_endian>::writeval(view, reloc);
   }
 };
 
@@ -1681,7 +1675,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
       break;
 
     case elfcpp::R_PPC_REL16_HA:
-      Reloc::rel16_lo(view, object, psymval, addend, address);
+      Reloc::rel16_ha(view, object, psymval, addend, address);
       break;
 
     case elfcpp::R_POWERPC_GOT16: