This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: Question about the differences between objdump and objcopy
- From: "XU SHENG" <Sheng dot Xu at alcatel-lucent dot com>
- To: "Alan Modra" <amodra at bigpond dot net dot au>
- Cc: <binutils at sources dot redhat dot com>
- Date: Tue, 27 May 2008 13:15:09 +0800
- Subject: RE: Question about the differences between objdump and objcopy
Hi Alan,
In fact, my doubt is how to translate an ELF file to raw binary file without the usage of bfd library. My work failed because of the unexpected zeroed bytes padded in binary file output using bfd library (just like the output of objcopy).I have looked up some SPECs relative to ELF, but no detail information about this topic found.
Best Regards,
Edison
-----Original Message-----
From: Alan Modra [mailto:amodra@bigpond.net.au]
Sent: 2008年5月26日 14:30
To: XU SHENG
Cc: binutils@sources.redhat.com
Subject: Re: Question about the differences between objdump and objcopy
On Mon, May 26, 2008 at 11:01:27AM +0800, XU SHENG wrote:
> Program Headers:
> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> LOAD 0x000000 0x08000000 0x08000000 0x00000 0x0815c RW 0x10000
> LOAD 0x010000 0xfe000000 0xfe000000 0x24000 0x24050 RWE 0x10000
> LOAD 0x040000 0xfe040000 0xfe040000 0x3ac000 0x3ac000 R 0x10000
> GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
>
> The Vir/Phy addr of all loadable segment are the same, but there is still many many pad bytes in binary output.
Well, you would expect some padding, wouldn't you? You must have gaps between loaded sections to get these program headers. Please see bfd/binary.c:binary_set_section_contents if you need more details.
--
Alan Modra
Australia Development Lab, IBM