This is the mail archive of the
mailing list for the binutils project.
Re: extract ELF load address with binutils?
- From: Alan Modra <amodra at gmail dot com>
- To: "Radouch, Zdenek" <zradouch at irobot dot com>
- Cc: "Paul_Koning at Dell dot com" <Paul_Koning at Dell dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 19 Mar 2014 10:14:19 +1030
- Subject: Re: extract ELF load address with binutils?
- Authentication-results: sourceware.org; auth=none
- References: <7ADBB2DB4DC7CF4CB641E9ADA826E5E2AAC571BC at HQ-MBX-01 dot wardrobe dot irobot dot com> <m3a9i3s8s1 dot fsf at pepe dot airs dot com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FBDF7F at hq-mbx-02 dot wardrobe dot irobot dot com> <m3siqgw32g dot fsf at pepe dot airs dot com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC0FF6 at hq-mbx-02 dot wardrobe dot irobot dot com> <m3k3brwvew dot fsf at pepe dot airs dot com> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC2052 at hq-mbx-02 dot wardrobe dot irobot dot com> <C75A84166056C94F84D238A44AF9F6AD16C83E5D at AUSX10MPC103 dot AMER dot DELL dot COM> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC207A at hq-mbx-02 dot wardrobe dot irobot dot com>
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
Australia Development Lab, IBM