« Return to Thread: 32bits specific code in do_adjust_elf_header()

Re: 32bits specific code in do_adjust_elf_header()

by Bugzilla from ian@airs.com :: Rate this Message:

Reply to Author | View in Thread

Roman Divacky <rdivacky@...> writes:

> Target_freebsd<size, big_endian>::do_adjust_elf_header()
>
> there is 32specific code that does not work on 64bit platforms
>
> this:
>
>      gold_assert(len == elfcpp::Elf_sizes<32>::ehdr_size);
>
>      elfcpp::Ehdr<32, false> ehdr(view);
>
>
> the 32 does not work on 64bit platform (ie. amd64), I believe
> it should be either 32 or 64. When I manually enter 64 there
> on amd64 gold works for me just fine.
Thanks for the report.  I think it was just dumb coding on my part.  I
committed this patch to fix it.

Ian


2009-07-01  Ian Lance Taylor  <ian@...>

        * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
        instead of 32.



Index: freebsd.h
===================================================================
RCS file: /cvs/src/src/gold/freebsd.h,v
retrieving revision 1.1
diff -p -u -r1.1 freebsd.h
--- freebsd.h 24 Mar 2009 00:31:28 -0000 1.1
+++ freebsd.h 1 Jul 2009 16:20:44 -0000
@@ -68,15 +68,15 @@ Target_freebsd<size, big_endian>::do_adj
 {
   if (this->osabi_ != elfcpp::ELFOSABI_NONE)
     {
-      gold_assert(len == elfcpp::Elf_sizes<32>::ehdr_size);
+      gold_assert(len == elfcpp::Elf_sizes<size>::ehdr_size);
 
-      elfcpp::Ehdr<32, false> ehdr(view);
+      elfcpp::Ehdr<size, false> ehdr(view);
       unsigned char e_ident[elfcpp::EI_NIDENT];
       memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT);
 
       e_ident[elfcpp::EI_OSABI] = this->osabi_;
 
-      elfcpp::Ehdr_write<32, false> oehdr(view);
+      elfcpp::Ehdr_write<size, false> oehdr(view);
       oehdr.put_e_ident(e_ident);
     }
 }

_______________________________________________
bug-binutils mailing list
bug-binutils@...
http://lists.gnu.org/mailman/listinfo/bug-binutils

 « Return to Thread: 32bits specific code in do_adjust_elf_header()