This is the mail archive of the
mailing list for the binutils project.
Re: extract ELF load address with binutils?
- From: Erik Christiansen <dvalin at internode dot on dot net>
- To: binutils at sourceware dot org
- Date: Thu, 20 Mar 2014 00:24:04 +1100
- Subject: Re: extract ELF load address with binutils?
- Authentication-results: sourceware.org; auth=none
- References: <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> <20140318234418 dot GC9145 at bubble dot grove dot modra dot org> <7ADBB2DB4DC7CF4CB641E9ADA826E5E2E1FC30E1 at hq-mbx-02 dot wardrobe dot irobot dot com>
- Reply-to: dvalin at internode dot on dot net
On 19.03.14 12:04, Radouch, Zdenek wrote:
> 1. Hard-code the memory load address in the linker script
> 2. Build and link (often with back-box environment - forget ld -n -N)
> or as in my case don't link, get an already linked file from someone
> 3. Run objcopy -O binary to extract the memory image
> 4. Load the memory image using the hard-coded address from the step #1
> I am simply questioning whether or not I could, with some moderate
> effort (i.e., shell/python) fix the very fragile last step (4) that
> requires the load address to be "carried along" with the object file.
> I do know that all of the necessary info is in the ELF file, objcopy
> knows that, too, and successfully extracts the data, the only problem
> is that objcopy is silent about what it did. So my question is:
Since you can run a script at the programming site, is there any reason
not to just send the elf file, so the script can extract address(es),
(E.g. from "objdump -h xxx.elf" and a line or two of awk, or
nm xxx.elf | grep <Your_start_address_symbol>),
as well as run the "objcopy -O binary"?
For myself, I've always just sent intel or motorola hex files for
loading to the platform - then the load address is also included,
though not so easily human-readable. (But the programming tools handle
it without human intervention, since that's what these formats are for.)
"No one, however smart, however well-educated, however experienced, is the
suppository of all wisdom." - Tony Abbott, then Australian opposition leader, now PM.