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 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.)

Erik

-- 
"No one, however smart, however well-educated, however experienced, is the
suppository of all wisdom." - Tony Abbott, then Australian opposition leader, now PM.


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