This is the mail archive of the binutils@sources.redhat.com 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]

Re: Linking images at one address, but loading them at another.


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


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