1# Copyright (C) 2014-2016 Free Software Foundation, Inc.
2#
3# Copying and distribution of this file, with or without modification,
4# are permitted in any medium without royalty provided the copyright
5# notice and this notice are preserved.
6
7TORS=".tors :
8	{
9	  ___ctors = . ;
10	  *(.ctors)
11	  ___ctors_end = . ;
12	  ___dtors = . ;
13	  *(.dtors)
14	  ___dtors_end = . ;
15	} > ram"
16
17cat <<EOF
18/* Copyright (C) 2014-2016 Free Software Foundation, Inc.
19
20   Copying and distribution of this script, with or without modification,
21   are permitted in any medium without royalty provided the copyright
22   notice and this notice are preserved.  */
23
24OUTPUT_FORMAT("${OUTPUT_FORMAT}")
25OUTPUT_ARCH(${ARCH})
26${RELOCATING+ENTRY ("_start")}
27
28MEMORY
29{
30	/* 0xc4 is a magic entry.  We should have the linker just
31	   skip over it one day...  */
32	vectors : o = 0x0000, l = 0xc4
33	magicvectors : o = 0xc4, l = 0x3c
34	ram    : o = 0x0100, l = 0xfdfc
35	/* The stack starts at the top of main ram.  */
36	topram : o = 0xfefc, l = 0x4
37	/* At the very top of the address space is the 8-bit area.  */
38	eight : o = 0xff00, l = 0x100
39}
40
41SECTIONS
42{
43.vectors :
44	{
45	  /* Use something like this to place a specific
46	     function's address into the vector table.
47
48	     SHORT (ABSOLUTE (_foobar)).  */
49
50	  *(.vectors)
51	} ${RELOCATING+ > vectors}
52
53.init :
54	{
55	  *(.init)
56	} ${RELOCATING+ > ram}
57
58.text :
59	{
60	  *(.rodata)
61	  *(.text)
62	  *(.text.*)
63	  *(.strings)
64   	  ${RELOCATING+ _etext = . ; }
65	} ${RELOCATING+ > ram}
66
67${CONSTRUCTING+${TORS}}
68
69.data :
70	{
71	  *(.data)
72	  *(.data.*)
73	  *(.tiny)
74	  ${RELOCATING+ _edata = . ; }
75	} ${RELOCATING+ > ram}
76
77.bss :
78	{
79	  ${RELOCATING+ _bss_start = . ;}
80	  *(.bss)
81	  *(COMMON)
82	  ${RELOCATING+ _end = . ;  }
83	} ${RELOCATING+ >ram}
84
85.stack :
86	{
87	  ${RELOCATING+ _stack = . ; }
88	  *(.stack)
89	} ${RELOCATING+ > topram}
90
91.eight :
92	{
93	  *(.eight)
94	} ${RELOCATING+ > eight}
95
96.stab 0 ${RELOCATING+(NOLOAD)} :
97	{
98	  [ .stab ]
99	}
100
101.stabstr 0 ${RELOCATING+(NOLOAD)} :
102	{
103	  [ .stabstr ]
104	}
105}
106EOF
107