| 1 | TORS=".tors : |
| 2 | { |
| 3 | ___ctors = . ; |
| 4 | *(.ctors) |
| 5 | ___ctors_end = . ; |
| 6 | ___dtors = . ; |
| 7 | *(.dtors) |
| 8 | ___dtors_end = . ; |
| 9 | . = ALIGN(4); |
| 10 | } ${RELOCATING+ > ram}" |
| 11 | |
| 12 | cat <<EOF |
| 13 | OUTPUT_FORMAT("${OUTPUT_FORMAT}") |
| 14 | OUTPUT_ARCH(${ARCH}) |
| 15 | ${LIB_SEARCH_DIRS} |
| 16 | EOF |
| 17 | |
| 18 | test -n "${RELOCATING}" && cat <<EOF |
| 19 | /* Allow the command line to override the memory region sizes. */ |
| 20 | __PMSIZE = DEFINED(__PMSIZE) ? __PMSIZE : 256K; |
| 21 | __RAMSIZE = DEFINED(__RAMSIZE) ? __RAMSIZE : 64K; |
| 22 | |
| 23 | MEMORY |
| 24 | { |
| 25 | flash (rx) : ORIGIN = 0, LENGTH = __PMSIZE |
| 26 | ram (rw!x) : ORIGIN = 0x800000, LENGTH = __RAMSIZE |
| 27 | } |
| 28 | EOF |
| 29 | |
| 30 | cat <<EOF |
| 31 | SECTIONS |
| 32 | { |
| 33 | .text : |
| 34 | { |
| 35 | *(.text${RELOCATING+*}) |
| 36 | ${RELOCATING+*(.strings) |
| 37 | *(._pm*) |
| 38 | KEEP (*(SORT_NONE(.init))) |
| 39 | KEEP (*(SORT_NONE(.fini))) |
| 40 | _etext = .; |
| 41 | . = ALIGN(4);} |
| 42 | } ${RELOCATING+ > flash} |
| 43 | ${CONSTRUCTING+${TORS}} |
| 44 | .data : ${RELOCATING+ AT (ADDR (.text) + SIZEOF (.text))} |
| 45 | { |
| 46 | *(.data) |
| 47 | ${RELOCATING+*(.rodata) |
| 48 | *(.rodata*) |
| 49 | _edata = .; |
| 50 | . = ALIGN(4);} |
| 51 | } ${RELOCATING+ > ram} |
| 52 | .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} : |
| 53 | { |
| 54 | ${RELOCATING+ _bss_start = . ; } |
| 55 | *(.bss) |
| 56 | ${RELOCATING+*(COMMON) |
| 57 | _end = .; |
| 58 | . = ALIGN(4);} |
| 59 | } ${RELOCATING+ > ram} |
| 60 | |
| 61 | ${RELOCATING+ __data_load_start = LOADADDR(.data); } |
| 62 | ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); } |
| 63 | |
| 64 | .stab 0 ${RELOCATING+(NOLOAD)} : |
| 65 | { |
| 66 | *(.stab) |
| 67 | } |
| 68 | .stabstr 0 ${RELOCATING+(NOLOAD)} : |
| 69 | { |
| 70 | *(.stabstr) |
| 71 | } |
| 72 | EOF |
| 73 | |
| 74 | . $srcdir/scripttempl/DWARF.sc |
| 75 | |
| 76 | cat <<EOF |
| 77 | } |
| 78 | EOF |