bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 32bits specific code in do_adjust_elf_header()


From: Ian Lance Taylor
Subject: Re: 32bits specific code in do_adjust_elf_header()
Date: Wed, 01 Jul 2009 09:21:50 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Roman Divacky <address@hidden> 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  <address@hidden>

        * 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);
     }
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]