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,

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


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