Bug 13505 - apply_relocation always use 64bit little endian relocation
Summary: apply_relocation always use 64bit little endian relocation
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.24
: P2 normal
Target Milestone: ---
Assignee: Ian Lance Taylor
URL: http://sourceware.org/ml/binutils/201...
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-15 19:43 UTC by H.J. Lu
Modified: 2011-12-16 04:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.