1 | /* |
---|
2 | * This file contains GNU linker directives for an general SH4 |
---|
3 | * board. |
---|
4 | * |
---|
5 | * Variations in memory size and allocation can be made by |
---|
6 | * overriding some values with linker command-line arguments. |
---|
7 | * |
---|
8 | * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia |
---|
9 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * |
---|
14 | * http://www.OARcorp.com/rtems/license.html. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | |
---|
20 | OUTPUT_FORMAT("elf32-shl", "elf32-shl", |
---|
21 | "elf32-shl") |
---|
22 | OUTPUT_ARCH(sh) |
---|
23 | ENTRY(_start) |
---|
24 | /* Do we need any of these for elf? |
---|
25 | __DYNAMIC = 0; */ |
---|
26 | |
---|
27 | _HeapSize = DEFINED(_HeapSize) ? _HeapSize : (2 * 1024 * 1024); |
---|
28 | _WorkspaceSize = DEFINED(_WorkspaceSize) ? _WorkspaceSize : (1024 * 1024); |
---|
29 | |
---|
30 | /* |
---|
31 | * Area assignments: |
---|
32 | * Area 0: Flash memory, SRAM interface |
---|
33 | * Area 1: GDC |
---|
34 | * Area 2: SDRAM |
---|
35 | * Area 3-6: unused |
---|
36 | */ |
---|
37 | MEMORY |
---|
38 | { |
---|
39 | /* |
---|
40 | * Real values |
---|
41 | */ |
---|
42 | ram : o = 0x88000000, l = 8M |
---|
43 | rom : o = 0x80000000, l = 4M |
---|
44 | /* |
---|
45 | * Fake values to test from gdb |
---|
46 | */ |
---|
47 | /* |
---|
48 | ram : o = 0x88100000, l = 4M |
---|
49 | rom : o = 0x88500000, l = 3M |
---|
50 | */ |
---|
51 | } |
---|
52 | |
---|
53 | SECTIONS |
---|
54 | { |
---|
55 | /* Read-only sections, merged into text segment: */ |
---|
56 | .init : |
---|
57 | { |
---|
58 | KEEP (*(.init)) |
---|
59 | } =0 |
---|
60 | .text : |
---|
61 | { |
---|
62 | *(.text) |
---|
63 | *(.text.*) |
---|
64 | |
---|
65 | /* |
---|
66 | * Special FreeBSD sysctl sections. |
---|
67 | */ |
---|
68 | . = ALIGN (16); |
---|
69 | ___start_set_sysctl_set = .; |
---|
70 | *(set_sysc*); /* set_sysctl_* but name is truncated by SH-coff */ |
---|
71 | ___stop_set_sysctl_set = ABSOLUTE(.); |
---|
72 | *(set_doma*); /* set_domain_* but name is truncated by SH-coff */ |
---|
73 | *(set_pseudo_*); |
---|
74 | |
---|
75 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
76 | *(.gnu.warning) |
---|
77 | *(.gnu.linkonce.t*) |
---|
78 | } > rom |
---|
79 | _etext = .; |
---|
80 | PROVIDE (etext = .); |
---|
81 | .fini : |
---|
82 | { |
---|
83 | KEEP (*(.fini)) |
---|
84 | } =0 |
---|
85 | .rodata : |
---|
86 | { |
---|
87 | *(.rodata) |
---|
88 | *(.rodata.*) |
---|
89 | *(.gnu.linkonce.r*) |
---|
90 | . = ALIGN(32); |
---|
91 | } > rom |
---|
92 | .ctors : |
---|
93 | { |
---|
94 | ___ctors = .; |
---|
95 | /* gcc uses crtbegin.o to find the start of |
---|
96 | the constructors, so we make sure it is |
---|
97 | first. Because this is a wildcard, it |
---|
98 | doesn't matter if the user does not |
---|
99 | actually link against crtbegin.o; the |
---|
100 | linker won't look for a file to match a |
---|
101 | wildcard. The wildcard also means that it |
---|
102 | doesn't matter which directory crtbegin.o |
---|
103 | is in. */ |
---|
104 | KEEP (*crtbegin.o(.ctors)) |
---|
105 | /* We don't want to include the .ctor section from |
---|
106 | from the crtend.o file until after the sorted ctors. |
---|
107 | The .ctor section from the crtend file contains the |
---|
108 | end of ctors marker and it must be last */ |
---|
109 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
---|
110 | KEEP (*(SORT(.ctors.*))) |
---|
111 | KEEP (*(.ctors)) |
---|
112 | ___ctors_end = .; |
---|
113 | } > rom |
---|
114 | .dtors : |
---|
115 | { |
---|
116 | ___dtors = .; |
---|
117 | KEEP (*crtbegin.o(.dtors)) |
---|
118 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
---|
119 | KEEP (*(SORT(.dtors.*))) |
---|
120 | KEEP (*(.dtors)) |
---|
121 | ___dtors_end = .; |
---|
122 | copy_start_in_rom = .; |
---|
123 | } > rom |
---|
124 | |
---|
125 | /* Adjust the address for the data segment. We want to adjust up to |
---|
126 | the same address within the page on the next page up. */ |
---|
127 | . = ALIGN(128) + (. & (128 - 1)); |
---|
128 | .data : AT(LOADADDR(.dtors) + SIZEOF(.dtors)) |
---|
129 | { |
---|
130 | copy_start = .; |
---|
131 | *(.data) |
---|
132 | *(.data.*) |
---|
133 | *(.gnu.linkonce.d*) |
---|
134 | SORT(CONSTRUCTORS) |
---|
135 | copy_end = .; |
---|
136 | } > ram |
---|
137 | .eh_frame : { *(.eh_frame) } > ram |
---|
138 | /* We want the small data sections together, so single-instruction offsets |
---|
139 | can access them all, and initialized data all before uninitialized, so |
---|
140 | we can shorten the on-disk segment size. */ |
---|
141 | .bss : |
---|
142 | { |
---|
143 | __bss_start = .; |
---|
144 | *(.dynbss) |
---|
145 | *(.bss) |
---|
146 | *(.bss.*) |
---|
147 | *(COMMON) |
---|
148 | /* Align here to ensure that the .bss section occupies space up to |
---|
149 | _end. Align after .bss to ensure correct alignment even if the |
---|
150 | .bss section disappears because there are no input sections. */ |
---|
151 | . = ALIGN(32 / 8); |
---|
152 | __bss_end = .; |
---|
153 | } > ram |
---|
154 | |
---|
155 | . = ALIGN(16); |
---|
156 | _HeapStart = . ; |
---|
157 | . = . + _HeapSize ; |
---|
158 | PROVIDE( _HeapEnd = . ); |
---|
159 | |
---|
160 | . = ALIGN(16); |
---|
161 | _WorkSpaceStart = . ; |
---|
162 | . = . + _WorkspaceSize ; |
---|
163 | PROVIDE(_WorkSpaceEnd = .); |
---|
164 | |
---|
165 | . = ALIGN(16); |
---|
166 | .stack . : { |
---|
167 | stack_start = .; |
---|
168 | . = . + 4096; |
---|
169 | stack_end = .; |
---|
170 | } |
---|
171 | |
---|
172 | . = ALIGN(16); |
---|
173 | _CPU_Interrupt_stack_low = . ; |
---|
174 | _CPU_Interrupt_stack_high = _CPU_Interrupt_stack_low + 4096 ; |
---|
175 | |
---|
176 | /* Stabs debugging sections. */ |
---|
177 | .stab 0 : { *(.stab) } |
---|
178 | .stabstr 0 : { *(.stabstr) } |
---|
179 | .stab.excl 0 : { *(.stab.excl) } |
---|
180 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
181 | .stab.index 0 : { *(.stab.index) } |
---|
182 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
183 | .comment 0 : { *(.comment) } |
---|
184 | /* DWARF debug sections. |
---|
185 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
186 | of the section so we begin them at 0. */ |
---|
187 | /* DWARF 1 */ |
---|
188 | .debug 0 : { *(.debug) } |
---|
189 | .line 0 : { *(.line) } |
---|
190 | /* GNU DWARF 1 extensions */ |
---|
191 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
192 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
193 | /* DWARF 1.1 and DWARF 2 */ |
---|
194 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
195 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
196 | /* DWARF 2 */ |
---|
197 | .debug_info 0 : { *(.debug_info) } |
---|
198 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
199 | .debug_line 0 : { *(.debug_line) } |
---|
200 | .debug_frame 0 : { *(.debug_frame) } |
---|
201 | .debug_str 0 : { *(.debug_str) } |
---|
202 | .debug_loc 0 : { *(.debug_loc) } |
---|
203 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
204 | /* SGI/MIPS DWARF 2 extensions */ |
---|
205 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
206 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
207 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
208 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
209 | .stack : { _stack = .; *(.stack) } |
---|
210 | /* These must appear regardless of . */ |
---|
211 | } |
---|