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