Bug 13505

Summary: apply_relocation always use 64bit little endian relocation
Product: binutils Reporter: H.J. Lu <hjl.tools>
Component: goldAssignee: Ian Lance Taylor <ian>
Status: RESOLVED FIXED    
Severity: normal CC: ccoutant
Priority: P2    
Version: 2.24   
Target Milestone: ---   
URL: http://sourceware.org/ml/binutils/2011-12/msg00224.html
Host: Target:
Build: Last reconfirmed:

Description H.J. Lu 2011-12-15 19:43:21 UTC
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.
Comment 1 H.J. Lu 2011-12-15 19:57:44 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2011-12/msg00224.html
Comment 2 Sourceware Commits 2011-12-15 23:29:27 UTC
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
Comment 3 Ian Lance Taylor 2011-12-16 04:53:43 UTC
Fixed.