aboutsummaryrefslogtreecommitdiff
path: root/ld/scripttempl/tic80coff.sc
blob: 0d52aaa7487cd287da179bbb5453e34f8b1c9b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Linker script for TI TMS320C80 (tic80) COFF.
#
# Besides the shell variables set by the emulparams script, and the LD_FLAG
# variable, the genscripts.sh script will set the following variables for each
# time this script is run to generate one of the linker scripts for ldscripts:
#
# RELOCATING: Set to a non-empty string when the linker is going to be doing
# a final relocation.
#
# CONSTRUCTING: Set to a non-empty string when the linker is going to be
# building global constructor and destructor tables.
#
# DATA_ALIGNMENT: Set to an ALIGN expression when the output should be page
# aligned, or to "." when generating the -N script.
#
# CREATE_SHLIB: Set to a non-empty string when generating a script for
# the -shared linker arg.

test -z "$TEXT_START_ADDR" && TEXT_START_ADDR="0x80000 + SIZEOF_HEADERS"
test -z "$ENTRY" && ENTRY=__start

cat <<EOF
OUTPUT_FORMAT("${OUTPUT_FORMAT}")
${LIB_SEARCH_DIRS}

ENTRY(${ENTRY})

SECTIONS
{
  .text ${RELOCATING+ $TEXT_START_ADDR} : {
    *(.init)
    *(.fini)
    *(.text)
    ${CONSTRUCTING+ . = ALIGN(4);}
    ${CONSTRUCTING+ ___CTOR_LIST__ = .;}
    ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)}
    ${CONSTRUCTING+ *(.ctors)}
    ${CONSTRUCTING+ LONG(0)}
    ${CONSTRUCTING+ ___CTOR_END__ = .;}
    ${CONSTRUCTING+ ___DTOR_LIST__ = .;}
    ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)}
    ${CONSTRUCTING+ *(.dtors)}
    ${CONSTRUCTING+ LONG(0)}
    ${CONSTRUCTING+ ___DTOR_END__ = .;}
    ${RELOCATING+ etext  =  .;}
  }
  .data : {
    *(.data)
    ${RELOCATING+ __edata  =  .};
  }
  .bss : { 					
    ${RELOCATING+ __bss_start = .};
    *(.bss)
    *(COMMON)
     ${RELOCATING+ _end = ALIGN(0x8)};
     ${RELOCATING+ __end = ALIGN(0x8)};
  }
  .stab  0 ${RELOCATING+(NOLOAD)} : 
  {
    [ .stab ]
  }
  .stabstr  0 ${RELOCATING+(NOLOAD)} :
  {
    [ .stabstr ]
  }
}
EOF