This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extract ELF load address with binutils?


On Tue, Mar 18, 2014 at 05:44:11PM +0000, Radouch, Zdenek wrote:
> But as I (and objcopy) have illustrated:
> 1. Not all LOAD types get loaded

Correct, only those with p_filsiz (readelf -l FileSize column)
non-zero.  p_memsiz specifies a bss type area that is usually cleared
to zero by a program loader.

> 2. The address where the segment is loaded can be "wrong", when the loaded segment
>    has been padded.

The address you showed isn't due to padding.  You're seeing 0x158000
when .text starts at 0x15f000 because you linked the object for
dynamic paging with a page size of 0x8000.  That imposes constraints
on p_vaddr.  You will also be loading the ELF file header and program
headers, which may not be what you want..  See ld -n and ld -N
options.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]