There are template<int size, bool big_endian, typename Target_type, typename Relocate> void apply_relocation(const Relocate_info<size, big_endian>* relinfo, Target_type* target, typename elfcpp::Elf_types<size>::Elf_Addr r_offset, unsigned int r_type, typename elfcpp::Elf_types<size>::Elf_Swxword r_addend, const Symbol* gsym, unsigned char* view, typename elfcpp::Elf_types<size>::Elf_Addr address, section_size_type view_size) { // Construct the ELF relocation in a temporary buffer. const int reloc_size = elfcpp::Elf_sizes<64>::rela_size; unsigned char relbuf[reloc_size]; elfcpp::Rela<64, false> rel(relbuf); elfcpp::Rela_write<64, false> orel(relbuf); orel.put_r_offset(r_offset); orel.put_r_info(elfcpp::elf_r_info<64>(0, r_type)); orel.put_r_addend(r_addend); ... in target-reloc.h. It always uses Rela<64, false> even for 32bit or big endian target.
A patch is posted at http://sourceware.org/ml/binutils/2011-12/msg00224.html
CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2011-12-15 23:29:24 Modified files: gold : ChangeLog target-reloc.h Log message: Replace <64, false> with <size, big_endian> 2011-12-15 H.J. Lu <hongjiu.lu@intel.com> PR gold/13505 * target-reloc.h (apply_relocation): Replace <64, false> with <size, big_endian>. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/ChangeLog.diff?cvsroot=src&r1=1.857&r2=1.858 http://sourceware.org/cgi-bin/cvsweb.cgi/src/gold/target-reloc.h.diff?cvsroot=src&r1=1.51&r2=1.52
Fixed.