This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Question concerning objcopy an elf file into a raw binary file
- From: Ian Lance Taylor <ian at airs dot com>
- To: Jie Zhang <zhangjie at magima dot com dot cn>
- Cc: binutils at sources dot redhat dot com
- Date: 02 Jul 2003 21:28:59 -0700
- Subject: Re: Question concerning objcopy an elf file into a raw binary file
- References: <3F03A34A.2000300@magima.com.cn>
Jie Zhang <zhangjie@magima.com.cn> writes:
> [ 3] .bss NOBITS 60003400 000074 000064 00 WA
> 0 0 4
> Program Headers:
> Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
> LOAD 0x000074 0x60003400 0x60003400 0x00000 0x00064 RW 0x4
> LOAD 0x000074 0x60003464 0x60003464 0x019e0 0x019e0 RWE 0x4
> I expect that the memory dump will start at 60003400, but actually it
> starts at 60003464. It seems that objcopy does not actually copy .bss
> section. But .bss section is in a LOAD type segment and should, I
> think, be part of the memory dump.
.bss has NOBITS, so there is no data to put into the binary file.
It's true that .bss is in a LOAD type segment, but the file size of
that segment is zero.
When not using an operating system loader, it's normal for a program
to have to zero out the BSS in the startup code. In most cases, this
is more efficient than copying a bunch of zeroes around.
Ian