1/******************************************************************
2*******************************************************************
3***                                                             ***
4***     Linker script for xstormy16-elf-gcc                     ***
5***           For SID   RAM=0x7E00                              ***
6***                     ROM=0x78000                             ***
7***                                                             ***
8*******************************************************************
9******************************************************************/
10
11OUTPUT_FORMAT("elf32-xstormy16", "elf32-xstormy16", "elf32-xstormy16")
12OUTPUT_ARCH(xstormy16)
13ENTRY(_start)
14SEARCH_DIR( . )
15GROUP(-lc -lsim -lgcc)
16PROVIDE( __target_package = 0xff);
17
18__malloc_start = 0x7E00;
19
20MEMORY
21{
22	RAM (w)    : ORIGIN = 0x00000, LENGTH = 0x07E00
23	CHIP (r)   : ORIGIN = 0x07f00, LENGTH = 0x00100
24	ROM (!w)   : ORIGIN = 0x08000, LENGTH = 0x78000
25}
26
27SECTIONS
28{
29	/* Zero initialized data with the below100 attribute.  */
30	.bss_below100 : {
31		SHORT(0)
32		__bss_start = .;
33		*(.bss_below100)
34		*(.bss_below100.*)
35		. = ALIGN(2);
36	} > RAM
37
38	/* Non-zero initialized data with the below100 attribute.  */
39	.data_below100 : AT ( __rdata ) {
40		__data_start = . ;
41	        *(.data_0)
42		*(.data_below100)
43		*(.data_below100.*)
44		. = ALIGN(2);
45	} > RAM = 0
46
47        /* Normal non-zero initialized data.  */
48       .data : AT ( __rdata + SIZEOF(.data_below100) ) {
49		*(.data)
50		*(.data.*)
51		*(.gnu.linkonce.d.*)
52		SORT(CONSTRUCTORS)
53		. = ALIGN(2);
54		__data_end = . ;
55	} > RAM =0
56
57        /* Normal zero initialized data.  */
58	.bss : AT (LOADADDR(.data) + SIZEOF(.data)) {
59        	*(.dynbss)
60		*(.bss)
61		*(.bss.*)
62		*(.gnu.linkonce.b.*)
63		*(COMMON)
64		. = ALIGN(2);
65		__bss_end = .;
66	} > RAM
67
68        /* The top of stack.  */
69	__stack = .;
70
71        /* Target chip info.  */
72	.chip_info : {
73		KEEP(*(.chip_info))
74	} > CHIP =0
75
76        /* Reset and interrupt vectors at 8000.  */
77	.int_vec : {
78	        KEEP(*(.int_vec))
79	} > ROM =0
80
81        /* Read only data.  */
82	.rodata : {
83        	*(.rodata)
84		*(.rodata.*)
85		*(.gnu.linkonce.r.*)
86	} > ROM =0
87
88        /* C++ Construcrtors and destructors.  */
89	.ctors : {
90		KEEP (*crtbegin.o(.ctors))
91		KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
92		KEEP (*(SORT(.ctors.*)))
93		KEEP (*(.ctors))
94	} > ROM =0
95
96	.dtors : {
97        	KEEP (*crtbegin.o(.dtors))
98		KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
99		KEEP (*(SORT(.dtors.*)))
100		KEEP (*(.dtors))
101	} > ROM =0
102
103        /* Pointer lookup table.. */
104	.plt : {
105	        *(.plt)
106	} > ROM =0
107
108        /* Other information.  */
109	.jcr : {
110	        KEEP (*(.jcr))
111	} > ROM =0
112
113	.eh_frame : {
114	        KEEP (*(.eh_frame))
115	} > ROM =0
116
117	.gcc_except_table : {
118	        KEEP (*(.gcc_except_table))
119	} > ROM =0
120
121        /* Initialization values for data.  */
122	.data_init (NOLOAD) : {
123		__rdata = .;
124		. += SIZEOF(.data_below100);
125		. += SIZEOF(.data);
126		. += SIZEOF(.bss);
127	} > ROM
128
129        /* Executable code.  */
130	.text : {
131		*(.text)
132		*(.text.*)
133		*(.stub)
134		*(.gnu.warning)
135		*(.gnu.linkonce.t.*)
136	} > ROM =0
137
138        /* Startup/finish code.  */
139	.init : {
140        	KEEP (*crti.o(.init))
141		KEEP (*(EXCLUDE_FILE (*crtn.o ) .init))
142		KEEP (*(SORT(.init.*)))
143		KEEP (*(.init))
144	} > ROM =0
145
146	.fini : {
147        	KEEP (*crti.o(.fini))
148		KEEP (*(EXCLUDE_FILE (*crtn.o ) .fini))
149		KEEP (*(SORT(.fini.*)))
150		KEEP (*(.fini))
151	} > ROM =0
152
153        /* Stab debugging sections.  */
154	.stab          0 : { *(.stab) }
155	.stabstr       0 : { *(.stabstr) }
156	.stab.excl     0 : { *(.stab.excl) }
157	.stab.exclstr  0 : { *(.stab.exclstr) }
158	.stab.index    0 : { *(.stab.index) }
159	.stab.indexstr 0 : { *(.stab.indexstr) }
160	.comment       0 : { *(.comment) }
161
162        /* DWARF debug sections.  */
163	/* Symbols in the DWARF debugging sections are relative to
164	   the beginning of the section so we begin them at 0.  */
165
166   	/* DWARF 1.  */
167	.debug 0 : { *(.debug) }
168	.line 0 : { *(.line) }
169
170	/* GNU DWARF 1 extensions.  */
171	.debug_srcinfo 0 : { *(.debug_srcinfo) }
172	.debug_sfnames 0 : { *(.debug_sfnames) }
173
174	/* DWARF 1.1 and DWARF 2.  */
175	.debug_aranges  0 : { *(.debug_aranges) }
176	.debug_pubnames 0 : { *(.debug_pubnames) }
177
178	/* DWARF 2.  */
179	.debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
180	.debug_abbrev   0 : { *(.debug_abbrev) }
181	.debug_line     0 : { *(.debug_line) }
182	.debug_frame    0 : { *(.debug_frame) }
183	.debug_str      0 : { *(.debug_str) }
184	.debug_loc      0 : { *(.debug_loc) }
185	.debug_macinfo  0 : { *(.debug_macinfo) }
186
187        /* SGI/MIPS DWARF 2 extensions.  */
188	.debug_weaknames 0 : { *(.debug_weaknames) }
189	.debug_funcnames 0 : { *(.debug_funcnames) }
190	.debug_typenames 0 : { *(.debug_typenames) }
191	.debug_varnames  0 : { *(.debug_varnames) }
192}
193