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 10:43:43 +0100
- Cc: binutils at sources dot redhat dot com
- References: <200110260909.KAA26220@cam-mail2.cambridge.arm.com>
Hi Richard,
> > > arm-elf-strip -g -o os os.gdb
> > > BFD: netbsd: warning: allocated section `.text' not in segment
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:
PHDRS
{
headers PT_PHDR PHDRS ;
text PT_LOAD AT (0x10000) ;
data PT_LOAD ;
hightext PT_LOAD ;
}
SECTIONS
{
.lotext 0x10000 : { *(.lotext) } :text
.text (0xa0110000 + SIZEOF (.lotext)) :
AT ( LOADADDR(.lotext) + SIZEOF ( .lotext ) )
{
*(.text)
*(.glue_7t) *(.glue_7)
} :text :hightext =0
. = ALIGN(256) + (. & (256 - 1));
.data : AT ( LOADADDR(.text) + SIZEOF ( .text ) )
{
*(.data)
} :data
.bss :
{
*(.bss)
*(COMMON)
. = ALIGN(32 / 8);
}
. = ALIGN(32 / 8);
}
Cheers
Nick