MIPS startup code and linker script (fwd)

S Sathyanarayanan sathyas@sankhya.com
Mon May 13 23:19:00 GMT 2002


Hi,

 I had successfully built a mips-gcc compiler with newlib. I'm able
 to load and execute simple helloworld program in the mips malta board
 with a simple startup code and linker script provided my MIPS. 

 But for complex applications i'm not able to execute the program on the
 target. Please advise where can i get info on writing startup codes and
 linker scripts for particular targets.

 I need to know the semantics of 
 *(.gnu.linkonce.t*)
 *(.gnu.linkonce.d)
 *(.mips16.fn.*)
 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }

 etc,,

 During link, i have 2 object files and one application library along 
 with the newlib libraries.

 I have also attached my modified linker script which enables me to load
the complex application to the target.

Thanks,
sathya
-------------- next part --------------
/* The following TEXT start address leaves space for the monitor
   workspace. i.e. the NEC VR4300 (IDT) first free address is actually
   0xa001af20. */

ENTRY(_start)
OUTPUT_ARCH("mips")
OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips")
SEARCH_DIR(/mnt/engr224/sankhya/gnu/release/sathyas/cross/mips/lib/gcc-lib/mips-elf/2.95);
GROUP(-lstdc++ -lgcc -lidt -lc)
 __DYNAMIC  =  0; 

/*
 * Allocate the stack to be at the top of memory, since the stack
 * grows down
 */
PROVIDE (__stack = 0);
PROVIDE (__global = 0); 

/*
 * Initalize some symbols to be zero so we can reference them in the
 * crt0 without core dumping. These functions are all optional, but
 * we do this so we can have our crt0 always use them if they exist. 
 * This is so BSPs work better when using the crt0 installed with gcc.
 * We have to initalize them twice, so we multiple object file
 * formats, as some prepend an underscore.
 */
PROVIDE (hardware_init_hook = 0);
PROVIDE (software_init_hook = 0); 
MEMORY
{
  ram : ORIGIN = 0x80200000 , LENGTH = 2M
}
SECTIONS
{	
  .text : {
     _ftext = . ;
    *(.init)
     eprol  =  .;  
    *(.text)
    *(.text.*) 
    *(.gnu.linkonce.t*)
    *(.mips16.fn.*)
    *(.mips16.call.*)
    PROVIDE (__runtime_reloc_start = .);
    *(.rel.sdata)
    PROVIDE (__runtime_reloc_stop = .);
    *(.fini)  
     etext  =  .;
     _etext  =  .;
  } > ram
  
  .ctors    :
  {
    /* gcc uses crtbegin.o to find the start of
       the constructors, so we make sure it is
       first.  Because this is a wildcard, it
       doesn't matter if the user does not
       actually link against crtbegin.o; the
       linker won't look for a file to match a
       wildcard.  The wildcard also means that it
       doesn't matter which directory crtbegin.o
       is in.  */

    KEEP (*crtbegin.o(.ctors))

    /* We don't want to include the .ctor section from
       from the crtend.o file until after the sorted ctors.
       The .ctor section from the crtend file contains the
       end of ctors marker and it must be last */

    KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
    KEEP (*(SORT(.ctors.*)))
    KEEP (*(.ctors))
  } > ram

  .dtors    :
  {
    KEEP (*crtbegin.o(.dtors))
    KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
    KEEP (*(SORT(.dtors.*)))
    KEEP (*(.dtors))
  } > ram

  . = .;
  .rodata : {
    *(.rdata)
    *(.rodata)
    *(.rodata.*)
    *(.gnu.linkonce.r*)
  } > ram
   _fdata = ALIGN(16);
  .data : {
    *(.data)
    *(.data.*)
    *(.gnu.linkonce.d*)
    *(.gcc_except_table*)
  
    . = ALIGN(8);
    _gp = . + 0x7ff0;
    __global = _gp;
    *(.lit8)
    *(.lit4)
  } > ram
  .sdata : {
    *(.sdata)
    *(.sdata.*)
    *(.gnu.linkonce.s*)
  } > ram
  . = ALIGN(4);
   edata  =  .;
   _edata  =  .;
  
   _fbss = .;
  .sbss : {
    *(.sbss)
    *(.scommon)
  } > ram
  .bss : {
    _bss_start = . ;
    *(.bss)
    *(COMMON)
    /* Allocate room for stack */
    .   =  ALIGN(8) ;
    .   += 0x5000 ;
    _sp =  . - 16;
  } > ram

   end = .;
   _end = .;

  .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
  .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }

  /DISCARD/ :
  {
    *(.reginfo)
  } 

  PROVIDE(etext = _etext);
  PROVIDE (edata = .);
  PROVIDE (end = .);
}
-------------- next part --------------
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


More information about the crossgcc mailing list