public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: PR gold/13505: apply_relocation always use 64bit little endian relocation
@ 2011-12-15 19:57 H.J. Lu
  2011-12-15 21:18 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2011-12-15 19:57 UTC (permalink / raw)
  To: binutils; +Cc: Ian Lance Taylor

Hi Ian,

This patch replaces <64, false> with <size, big_endian> in
apply_relocation.  Tested on Linux/x86-64 and Linux/ia32.  OK to install?

Thanks.


H.J.
---
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>.

diff --git a/gold/target-reloc.h b/gold/target-reloc.h
index 464a3fa..6efcdf4 100644
--- a/gold/target-reloc.h
+++ b/gold/target-reloc.h
@@ -423,17 +423,17 @@ apply_relocation(const Relocate_info<size, big_endian>* relinfo,
 		 section_size_type view_size)
 {
   // Construct the ELF relocation in a temporary buffer.
-  const int reloc_size = elfcpp::Elf_sizes<64>::rela_size;
+  const int reloc_size = elfcpp::Elf_sizes<size>::rela_size;
   unsigned char relbuf[reloc_size];
-  elfcpp::Rela<64, false> rel(relbuf);
-  elfcpp::Rela_write<64, false> orel(relbuf);
+  elfcpp::Rela<size, big_endian> rel(relbuf);
+  elfcpp::Rela_write<size, big_endian> orel(relbuf);
   orel.put_r_offset(r_offset);
-  orel.put_r_info(elfcpp::elf_r_info<64>(0, r_type));
+  orel.put_r_info(elfcpp::elf_r_info<size>(0, r_type));
   orel.put_r_addend(r_addend);
 
   // Setup a Symbol_value for the global symbol.
-  const Sized_symbol<64>* sym = static_cast<const Sized_symbol<64>*>(gsym);
-  Symbol_value<64> symval;
+  const Sized_symbol<size>* sym = static_cast<const Sized_symbol<size>*>(gsym);
+  Symbol_value<size> symval;
   gold_assert(sym->has_symtab_index() && sym->symtab_index() != -1U);
   symval.set_output_symtab_index(sym->symtab_index());
   symval.set_output_value(sym->value());

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: PR gold/13505: apply_relocation always use 64bit little endian relocation
  2011-12-15 19:57 PATCH: PR gold/13505: apply_relocation always use 64bit little endian relocation H.J. Lu
@ 2011-12-15 21:18 ` Ian Lance Taylor
  2011-12-15 23:22   ` Cary Coutant
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-12-15 21:18 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils, ccoutant

"H.J. Lu" <hongjiu.lu@intel.com> writes:

> This patch replaces <64, false> with <size, big_endian> in
> apply_relocation.  Tested on Linux/x86-64 and Linux/ia32.  OK to install?

Cary, this is approved if it looks OK to you.

Ian

> 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>.
>
> diff --git a/gold/target-reloc.h b/gold/target-reloc.h
> index 464a3fa..6efcdf4 100644
> --- a/gold/target-reloc.h
> +++ b/gold/target-reloc.h
> @@ -423,17 +423,17 @@ apply_relocation(const Relocate_info<size, big_endian>* relinfo,
>  		 section_size_type view_size)
>  {
>    // Construct the ELF relocation in a temporary buffer.
> -  const int reloc_size = elfcpp::Elf_sizes<64>::rela_size;
> +  const int reloc_size = elfcpp::Elf_sizes<size>::rela_size;
>    unsigned char relbuf[reloc_size];
> -  elfcpp::Rela<64, false> rel(relbuf);
> -  elfcpp::Rela_write<64, false> orel(relbuf);
> +  elfcpp::Rela<size, big_endian> rel(relbuf);
> +  elfcpp::Rela_write<size, big_endian> orel(relbuf);
>    orel.put_r_offset(r_offset);
> -  orel.put_r_info(elfcpp::elf_r_info<64>(0, r_type));
> +  orel.put_r_info(elfcpp::elf_r_info<size>(0, r_type));
>    orel.put_r_addend(r_addend);
>  
>    // Setup a Symbol_value for the global symbol.
> -  const Sized_symbol<64>* sym = static_cast<const Sized_symbol<64>*>(gsym);
> -  Symbol_value<64> symval;
> +  const Sized_symbol<size>* sym = static_cast<const Sized_symbol<size>*>(gsym);
> +  Symbol_value<size> symval;
>    gold_assert(sym->has_symtab_index() && sym->symtab_index() != -1U);
>    symval.set_output_symtab_index(sym->symtab_index());
>    symval.set_output_value(sym->value());

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: PR gold/13505: apply_relocation always use 64bit little endian relocation
  2011-12-15 21:18 ` Ian Lance Taylor
@ 2011-12-15 23:22   ` Cary Coutant
  0 siblings, 0 replies; 3+ messages in thread
From: Cary Coutant @ 2011-12-15 23:22 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: H.J. Lu, binutils

>> This patch replaces <64, false> with <size, big_endian> in
>> apply_relocation.  Tested on Linux/x86-64 and Linux/ia32.  OK to install?
>
> Cary, this is approved if it looks OK to you.

Looks OK to me. Now if I could only remember why I wrote that in the
first place -- I suppose the code started out in x86_64.cc, but got
moved into generic code and I simply neglected to fully genericize it.

Thanks, HJ!

-cary

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-15 23:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-15 19:57 PATCH: PR gold/13505: apply_relocation always use 64bit little endian relocation H.J. Lu
2011-12-15 21:18 ` Ian Lance Taylor
2011-12-15 23:22   ` Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).