This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Bloated binaries following the use of AT(...) linker script command
On Mon, Jun 15, 2009 at 9:01 PM, John Reiser<jreiser@bitwagon.com> wrote:
> Somewhere there is a confusion between physical address and virtual address.
> The bloat amount is about (0xc0000000 - 0x84000000) bytes, which is the
> difference between VirtAddr and PhysAddr.
Hi John,
You are spot on. I built the binary with and without the AT(...)
command and the size difference of the two binaries is exactly the
difference between virtual address (p_vaddr) and load address
(p_paddr).
truncated readelf output:
Start of section headers: 1018763256 (bytes into file) /* with AT(...) */
Start of section headers: 12130296 (bytes into file) /*
without AT(...) */
(gdb) p/x 1018763256 - 12130296 = 0x3c000000
(gdb) p/x 0xc0000000 - 0x84000000 = 0x3c000000
For the case without the AT(...) command:
PHDRS {
/* text PT_LOAD AT(0x84000000) FLAGS(7); */ /* RWX */
text PT_LOAD FLAGS(7); /* RWX */
...
}
Corresponding program headers:
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x002000 0xc0000000 0xc0000000 0xb8b8a0 0xbf5f50 RWE 0x2000
thanks,
Prasad.