1# Linker script for Sparc COFF.
2# Based on i386coff.sc by Ian Taylor <ian@cygnus.com>.
3#
4# Copyright (C) 2014-2016 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10test -z "$ENTRY" && ENTRY=_start
11
12cat <<EOF
13/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
14
15   Copying and distribution of this script, with or without modification,
16   are permitted in any medium without royalty provided the copyright
17   notice and this notice are preserved.  */
18
19OUTPUT_FORMAT("${OUTPUT_FORMAT}")
20${LIB_SEARCH_DIRS}
21
22${RELOCATING+ENTRY (${ENTRY})}
23
24SECTIONS
25{
26  .text ${RELOCATING+ SIZEOF_HEADERS} : {
27    *(.init)
28    *(.text)
29    ${RELOCATING+ etext  =  .;}
30    ${CONSTRUCTING+ ___CTOR_LIST__ = .;}
31    ${CONSTRUCTING+ LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2)}
32    ${CONSTRUCTING+ *(.ctors)}
33    ${CONSTRUCTING+ LONG(0)}
34    ${CONSTRUCTING+ ___CTOR_END__ = .;}
35    ${CONSTRUCTING+ ___DTOR_LIST__ = .;}
36    ${CONSTRUCTING+ LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2)}
37    ${CONSTRUCTING+ *(.dtors)}
38    ${CONSTRUCTING+ LONG(0)}
39    ${CONSTRUCTING+ ___DTOR_END__ = .;}
40    *(.fini)
41    ${RELOCATING+ etext  =  .};
42  }
43  .data ${RELOCATING+ 0x400000 + (. & 0xffc00fff)} : {
44    *(.data)
45    ${RELOCATING+ edata  =  .};
46  }
47  .bss ${RELOCATING+ SIZEOF(.data) + ADDR(.data)} :
48  {
49    *(.bss)
50    *(COMMON)
51    ${RELOCATING+ end = .};
52  }
53  .stab  0 ${RELOCATING+(NOLOAD)} :
54  {
55    [ .stab ]
56  }
57  .stabstr  0 ${RELOCATING+(NOLOAD)} :
58  {
59    [ .stabstr ]
60  }
61}
62EOF
63