linkcmds file

Teng Chee Wan Philip tcheewan at ntu.edu.sg
Wed Oct 7 03:31:00 UTC 2009


Hi,

I need some help here.  I am thinking of locating my application .text section to a different location from the operating system .text. Currently, in the linkcmds file, all the .text sections are located together because of the *(.text*) input section description.  The envisaged memory map goes like this:

.text (operating system)		0x02000000
.text (applications, xx.o, yy.o)	0x02080000
.data (os + apps)		following .text 
.bss				0x02100000

Does anyone know how I can modify the linkcmds file to achieve that?  Any help will be greatly appreciated. Thanks.

Regards,
Philip

=====================================================

MEMORY
{
  rom     : ORIGIN = 0x00000000, LENGTH = 16
  ram     : ORIGIN = 0x02000000, LENGTH = 32M
  ram2    : ORIGIN = 0x02100000, LENGTH = 32M
}

/*
 * stick everything in ram (of course)
 */
SECTIONS
{
  .text :
  {
    CREATE_OBJECT_SYMBOLS
    text_start = .;
    _text_start = .;
    *(.text*)
    . = ALIGN (16);


    /*
     * Special FreeBSD sysctl sections.
     */
    . = ALIGN (16);
    __start_set_sysctl_set = .;
    *(set_sysctl_*);
    __stop_set_sysctl_set = ABSOLUTE(.);
    *(set_domain_*);
    *(set_pseudo_*);

    *(.eh_frame)
    . = ALIGN (16);

    *(.gnu.linkonce.t*)

    /*
     * C++ constructors
     */
    __CTOR_LIST__ = .;
    LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
    *(.ctors)
    LONG(0)
    __CTOR_END__ = .;
    __DTOR_LIST__ = .;
    LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
    *(.dtors)
    LONG(0)
    __DTOR_END__ = .;

    _rodata_start = . ;
    *(.rodata*)
    *(.gnu.linkonce.r*)
    _erodata = ALIGN( 0x10 ) ;

    etext = ALIGN(0x10);
    _etext = .;
    *(.init)
    *(.fini)
    *(.lit)
    *(.shdata)
    . = ALIGN (16);
    _endtext = .;
  } > ram
  .rela.dyn       :
    {
      *(.rela.init)
      *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
      *(.rela.fini)
      *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
      *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
      *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
      *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
      *(.rela.ctors)
      *(.rela.dtors)
      *(.rela.got)
      *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
    } >ram
  .data :
  {
    data_start = .;
    _data_start = .;
    _sdata = . ;
    *(.data*)
    *(.gnu.linkonce.d*)
    *(.gcc_except_table)
    . = ALIGN(0x10);
    edata = .;
    _edata = .;
  } > ram
  .dynamic	  : { *(.dynamic) 	} >ram
  .jcr		  : { *(.jcr) 		} >ram
  .got		  : { *(.got) 		} >ram
  .plt   	  : { *(.plt) 		} >ram
  .hash		  : { *(.hash)		} >ram
  .dynrel	  : { *(.dynrel)	} >ram
  .dynsym	  : { *(.dynsym)	} >ram
  .dynstr	  : { *(.dynstr)	} >ram
  .hash		  : { *(.hash)		} >ram
  .shbss :
  {
    *(.shbss)
  } > ram2
  .bss :
  {
    __bss_start = ALIGN(0x8);
    _bss_start = .;
    bss_start = .;
    *(.bss .bss* .gnu.linkonce.b*)
    *(COMMON)
    end = .;
    _end = ALIGN(0x8);
    __end = ALIGN(0x8);
  } > ram2
  .stab . (NOLOAD) :
  {
    [ .stab ]
  }
  .stabstr . (NOLOAD) :
  {
    [ .stabstr ]
  }
} 



More information about the users mailing list