1 | /* |
---|
2 | * Simulator Link script for Lattice Mico32. |
---|
3 | * Contributed by Jon Beniston <jon@beniston.com> |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions |
---|
7 | * are met: |
---|
8 | * 1. Redistributions of source code must retain the above copyright |
---|
9 | * notice, this list of conditions and the following disclaimer. |
---|
10 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
11 | * notice, this list of conditions and the following disclaimer in the |
---|
12 | * documentation and/or other materials provided with the distribution. |
---|
13 | * |
---|
14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
24 | * SUCH DAMAGE. |
---|
25 | */ |
---|
26 | |
---|
27 | OUTPUT_FORMAT("elf32-lm32") |
---|
28 | ENTRY(_start) |
---|
29 | INPUT(crti.o crtbegin.o crt0.o crtend.o crtn.o) |
---|
30 | GROUP(-lgloss -lnosys -lc -lgcc) |
---|
31 | |
---|
32 | MEMORY |
---|
33 | { |
---|
34 | ram : ORIGIN = 0x00000000, LENGTH = 0x100000 |
---|
35 | } |
---|
36 | |
---|
37 | SECTIONS |
---|
38 | { |
---|
39 | |
---|
40 | .boot : { *(.boot) } > ram |
---|
41 | |
---|
42 | /* Code */ |
---|
43 | .text : |
---|
44 | { |
---|
45 | . = ALIGN(4); |
---|
46 | _ftext = .; |
---|
47 | _ftext_rom = LOADADDR(.text); |
---|
48 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
49 | *(.gnu.warning) |
---|
50 | KEEP (*(.init)) |
---|
51 | KEEP (*(.fini)) |
---|
52 | /* Constructors and destructors */ |
---|
53 | KEEP (*crtbegin*.o(.ctors)) |
---|
54 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
---|
55 | KEEP (*(SORT(.ctors.*))) |
---|
56 | KEEP (*(.ctors)) |
---|
57 | KEEP (*crtbegin*.o(.dtors)) |
---|
58 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
---|
59 | KEEP (*(SORT(.dtors.*))) |
---|
60 | KEEP (*(.dtors)) |
---|
61 | KEEP (*(.jcr)) |
---|
62 | _etext = .; |
---|
63 | } > ram =0 |
---|
64 | |
---|
65 | /* Exception handlers */ |
---|
66 | .eh_frame_hdr : { *(.eh_frame_hdr) } > ram |
---|
67 | .eh_frame : { KEEP (*(.eh_frame)) } > ram |
---|
68 | .gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } > ram |
---|
69 | |
---|
70 | /* Read-only data */ |
---|
71 | .rodata : |
---|
72 | { |
---|
73 | . = ALIGN(4); |
---|
74 | _frodata = .; |
---|
75 | _frodata_rom = LOADADDR(.rodata); |
---|
76 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
---|
77 | *(.rodata1) |
---|
78 | _erodata = .; |
---|
79 | } > ram |
---|
80 | |
---|
81 | /* Data */ |
---|
82 | .data : |
---|
83 | { |
---|
84 | . = ALIGN(4); |
---|
85 | _fdata = .; |
---|
86 | _fdata_rom = LOADADDR(.data); |
---|
87 | *(.data .data.* .gnu.linkonce.d.*) |
---|
88 | *(.data1) |
---|
89 | SORT(CONSTRUCTORS) |
---|
90 | _gp = ALIGN(16) + 0x7ff0; |
---|
91 | *(.sdata .sdata.* .gnu.linkonce.s.*) |
---|
92 | _edata = .; |
---|
93 | } > ram |
---|
94 | |
---|
95 | /* BSS */ |
---|
96 | .bss : |
---|
97 | { |
---|
98 | . = ALIGN(4); |
---|
99 | _fbss = .; |
---|
100 | *(.dynsbss) |
---|
101 | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
---|
102 | *(.scommon) |
---|
103 | *(.dynbss) |
---|
104 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
105 | *(COMMON) |
---|
106 | . = ALIGN(4); |
---|
107 | _ebss = .; |
---|
108 | _end = .; |
---|
109 | PROVIDE (end = .); |
---|
110 | } > ram |
---|
111 | |
---|
112 | /* First location in stack is highest address in RAM */ |
---|
113 | PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4); |
---|
114 | |
---|
115 | /* Stabs debugging sections. */ |
---|
116 | .stab 0 : { *(.stab) } |
---|
117 | .stabstr 0 : { *(.stabstr) } |
---|
118 | .stab.excl 0 : { *(.stab.excl) } |
---|
119 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
120 | .stab.index 0 : { *(.stab.index) } |
---|
121 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
122 | .comment 0 : { *(.comment) } |
---|
123 | |
---|
124 | /* DWARF debug sections. |
---|
125 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
126 | of the section so we begin them at 0. */ |
---|
127 | /* DWARF 1 */ |
---|
128 | .debug 0 : { *(.debug) } |
---|
129 | .line 0 : { *(.line) } |
---|
130 | /* GNU DWARF 1 extensions */ |
---|
131 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
132 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
133 | /* DWARF 1.1 and DWARF 2 */ |
---|
134 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
135 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
136 | /* DWARF 2 */ |
---|
137 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
138 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
139 | .debug_line 0 : { *(.debug_line) } |
---|
140 | .debug_frame 0 : { *(.debug_frame) } |
---|
141 | .debug_str 0 : { *(.debug_str) } |
---|
142 | .debug_loc 0 : { *(.debug_loc) } |
---|
143 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
144 | /* SGI/MIPS DWARF 2 extensions */ |
---|
145 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
146 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
147 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
148 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
149 | } |
---|