This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold: Fix R_PPC_REL16_HA
- From: Andreas Schwab <schwab at suse dot de>
- To: binutils at sourceware dot org
- Date: Tue, 20 Jan 2009 14:59:44 +0100
- Subject: gold: Fix R_PPC_REL16_HA
This fixes the handling of R_PPC_REL16_HA, which was using the wrong
relocation function due to a typo.
Andreas.
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.
--- gold/powerpc.cc 17 Sep 2008 10:25:39 +0200 1.7
+++ gold/powerpc.cc 20 Jan 2009 14:53:44 +0100
@@ -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>::Reloca
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:
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."