This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Add updelfhdr
On Mon, Jan 4, 2010 at 6:57 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Jan 4, 2010 at 6:47 AM, Tristan Gingold <gingold@adacore.com> wrote:
>>>
>>> Well, we do have 2 ELF specific programs in binutils: readelf and gold.
>>>
>>> I only want to update ELF header, nothing else. ?objcopy basically will
>>> rewrite the whole ELF file. Sometimes it fails, especially when the input isn't
>>> generated by the GNU linker. updelfhdr doesn't have such a problem.
>>
>> Well, that's a point or a bug ;-)
>>
>
> Sometimes that won't get things done :-). That is one reason why I wrote
> updelfhdr. It works on all ELF input files no matter who generated them.
>
BTW, objcopy doesn't work at all:
[hjl@gnu-6 binutils]$ objcopy -O elf64-l1om /bin/ls ls
objcopy: Warning: Output file cannot represent architecture `i386:x86-64'
[hjl@gnu-6 binutils]$ cp /bin/ls /tmp/
[hjl@gnu-6 binutils]$ ./updelfhdr --output-mach L1OM /tmp/ls
[hjl@gnu-6 binutils]$ readelf -h /tmp/ls
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel L1OM
Version: 0x1
Entry point address: 0x4026b0
Start of program headers: 64 (bytes into file)
Start of section headers: 111976 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 8
Size of section headers: 64 (bytes)
Number of section headers: 32
Section header string table index: 31
[hjl@gnu-6 binutils]$
--
H.J.