| 1 | # Linker script for TI TMS320C80 (tic80) COFF. |
| 2 | # |
| 3 | # Besides the shell variables set by the emulparams script, and the LD_FLAG |
| 4 | # variable, the genscripts.sh script will set the following variables for each |
| 5 | # time this script is run to generate one of the linker scripts for ldscripts: |
| 6 | # |
| 7 | # RELOCATING: Set to a non-empty string when the linker is going to be doing |
| 8 | # a final relocation. |
| 9 | # |
| 10 | # CONSTRUCTING: Set to a non-empty string when the linker is going to be |
| 11 | # building global constructor and destructor tables. |
| 12 | # |
| 13 | # DATA_ALIGNMENT: Set to an ALIGN expression when the output should be page |
| 14 | # aligned, or to "." when generating the -N script. |
| 15 | # |
| 16 | # CREATE_SHLIB: Set to a non-empty string when generating a script for |
| 17 | # the -shared linker arg. |
| 18 | |
| 19 | test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x80000 + SIZEOF_HEADERS" |
| 20 | test -z "$ENTRY" && ENTRY=__start |
| 21 | |
| 22 | cat <<EOF |
| 23 | OUTPUT_FORMAT("${OUTPUT_FORMAT}") |
| 24 | ${LIB_SEARCH_DIRS} |
| 25 | |
| 26 | ${RELOCATING+ENTRY (${ENTRY})} |
| 27 | |
| 28 | SECTIONS |
| 29 | { |
| 30 | .text ${RELOCATING+ $TEXT_START_ADDR} : { |
| 31 | *(.init) |
| 32 | *(.fini) |
| 33 | *(.text) |
| 34 | } |
| 35 | .const ALIGN(4) : { |
| 36 | *(.const) |
| 37 | } |
| 38 | .ctors ALIGN(4) : { |
| 39 | ${CONSTRUCTING+ . = ALIGN(4);} |
| 40 | ${CONSTRUCTING+ ___CTOR_LIST__ = .;} |
| 41 | ${CONSTRUCTING+ LONG(-1)} |
| 42 | *(.ctors) |
| 43 | ${CONSTRUCTING+ ___CTOR_END__ = .;} |
| 44 | ${CONSTRUCTING+ LONG(0)} |
| 45 | } |
| 46 | .dtors ALIGN(4) : { |
| 47 | ${CONSTRUCTING+ ___DTOR_LIST__ = .;} |
| 48 | ${CONSTRUCTING+ LONG(-1)} |
| 49 | ${CONSTRUCTING+ *(.dtors)} |
| 50 | ${CONSTRUCTING+ ___DTOR_END__ = .;} |
| 51 | ${CONSTRUCTING+ LONG(0)} |
| 52 | } |
| 53 | ${RELOCATING+ etext = .;} |
| 54 | .data : { |
| 55 | *(.data) |
| 56 | ${RELOCATING+ __edata = .}; |
| 57 | } |
| 58 | .bss : { |
| 59 | ${RELOCATING+ __bss_start = .}; |
| 60 | *(.bss) |
| 61 | *(COMMON) |
| 62 | ${RELOCATING+ _end = ALIGN(0x8)}; |
| 63 | ${RELOCATING+ __end = ALIGN(0x8)}; |
| 64 | } |
| 65 | .stab 0 ${RELOCATING+(NOLOAD)} : |
| 66 | { |
| 67 | [ .stab ] |
| 68 | } |
| 69 | .stabstr 0 ${RELOCATING+(NOLOAD)} : |
| 70 | { |
| 71 | [ .stabstr ] |
| 72 | } |
| 73 | } |
| 74 | EOF |