This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Linking images at one address, but loading them at another.
- To: Richard dot Earnshaw at arm dot com
- Subject: Re: Linking images at one address, but loading them at another.
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 26 Oct 2001 12:38:53 +0100
- Cc: binutils at sources dot redhat dot com
- References: <200110261040.LAA01753@cam-mail2.cambridge.arm.com>
Hi Richard,
> > Right - the reason for this is that segments are mapped to
> > sections via their VMA address not their LMA address. The
> > solution however, is simple. Provide a second segment to hold the
> > relocated .text segment, like this:
>
> Except that then, surely this will create a segment that the loader
> will try to download to the virtual address, which is exactly what
> I'm trying to prevent -- I want it to download it to the low memory
> region, even though it is intended for execution at the high
> addresses.
Shouldn't the loader be loading the segment to is physical address
(aka LMA) rather than its virtual address (aka VMA) ?
Basically I think that you are hosed. Segments are mapped to sections
based on their VMA addresses, and the BFD library when it has to
rebuild the program headers after strip has run, will inspect this
mapping to determine if there are orphaned sections. (The BFD library
does not have access to a linker map to allow it to customise the
program header creation).
Cheers
Nick