/*
 *uncomment this if you want the linker to output srecords.
OUTPUT_FORMAT(srec)
 *
 */
ENTRY(trap_table)
OUTPUT_ARCH(sparc)
SEARCH_DIR(.)
__DYNAMIC  =  0;        

/*
 * The memory map looks like this:
 * +--------------------+ <- low memory
 * | .text              |
 * |        _stext      |
 * |        _etext      |
 * |        ctor list   | the ctor and dtor lists are for
 * |        dtor list   | C++ support
 * |        _end_text   |
 * +--------------------+
 * | .data              | initialized data goes here
 * |        _sdata      |
 * |        _edata      |
 * +--------------------+
 * | .bss               |
 * |        __bss_start | start of bss, cleared by crt0
 * |        _end        | start of heap, used by sbrk()
 * +--------------------+
 * |    heap space      |
 * |        _ENDHEAP    |
 * |    stack space     | 
 * |        __stack     | top of stack
 * +--------------------+ <- high memory
 */

ISR_STACK_SIZE = (16 * 1024);
RAM_SIZE = 256M;
RAM_START = 0x40000000;
RAM_END = RAM_START + RAM_SIZE;

/*
 * Setup the memory map of the Soclib test system (system.cpp)
 * Stack grows down towards low memory. 
 */

__trap_stack = RAM_END - 4 * 16;
__stack      = __trap_stack - ISR_STACK_SIZE;

SECTIONS
{
  . = 0x40000000;
  .text : {
        _stext = .;
        CREATE_OBJECT_SYMBOLS
        trap.o(.text)
        *(.text)

        __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__ = .;

        *(.lit)
        *(.shdata)
        _etext  =  .;
  }  
  . = 0x40100000;
  .data  : {
        _sdata  =  .;
        *(.data)
        *(.rodata) *(.rodata*)
        _edata  =  .;
  } 

  .bss SIZEOF(.data) + ADDR(.data) : {
        . = ALIGN(4);
        _bss_start = .;
        *(.bss)
        *(COMMON)
        . = ALIGN(4);
        _end = ALIGN(0x8);
        _heap = .;
  }

  .mstack  : { }  
  .rstack  : { }  
  .stab  0 (NOLOAD) : {
    [ .stab ]
  }

  .stabstr  0 (NOLOAD) :
  {
    [ .stabstr ]
  }
}
