1 | /* |
---|
2 | * This file contains GNU linker directives for a generic MC68360 board. |
---|
3 | * Variations in memory size and allocation can be made by |
---|
4 | * overriding some values with linker command-line arguments. |
---|
5 | * |
---|
6 | * Saskatchewan Accelerator Laboratory |
---|
7 | * University of Saskatchewan |
---|
8 | * Saskatoon, Saskatchewan, CANADA |
---|
9 | * eric@skatter.usask.ca |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | /* |
---|
15 | * Declare some sizes. |
---|
16 | */ |
---|
17 | HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000; |
---|
18 | StackSize = DEFINED(StackSize) ? StackSize : 0x1000; |
---|
19 | |
---|
20 | /* |
---|
21 | * Declare on-board memory. |
---|
22 | */ |
---|
23 | MEMORY { |
---|
24 | ram : ORIGIN = 0x00000000, LENGTH = 64M |
---|
25 | rom : ORIGIN = 0x0F000000, LENGTH = 1M |
---|
26 | dpram : ORIGIN = 0x0E000000, LENGTH = 8k |
---|
27 | } |
---|
28 | |
---|
29 | /* |
---|
30 | * Load objects |
---|
31 | */ |
---|
32 | SECTIONS { |
---|
33 | /* |
---|
34 | * Boot PROM |
---|
35 | */ |
---|
36 | rom : { |
---|
37 | _RomBase = .; |
---|
38 | } >rom |
---|
39 | |
---|
40 | /* |
---|
41 | * Dynamic RAM |
---|
42 | */ |
---|
43 | ram : { |
---|
44 | _RamBase = .; |
---|
45 | } >ram |
---|
46 | |
---|
47 | /* |
---|
48 | * Text, data and bss segments |
---|
49 | */ |
---|
50 | .text : { |
---|
51 | *(.text) |
---|
52 | |
---|
53 | /* |
---|
54 | * C++ constructors/destructors |
---|
55 | */ |
---|
56 | *(.gnu.linkonce.t.*) |
---|
57 | |
---|
58 | /* |
---|
59 | * Initialization and finalization code. |
---|
60 | * |
---|
61 | * Various files can provide initialization and finalization |
---|
62 | * functions. crtbegin.o and crtend.o are two instances. The |
---|
63 | * body of these functions are in .init and .fini sections. We |
---|
64 | * accumulate the bodies here, and prepend function prologues |
---|
65 | * from crti.o and function epilogues from crtn.o. crti.o must |
---|
66 | * be linked first; crtn.o must be linked last. Because these |
---|
67 | * are wildcards, it doesn't matter if the user does not |
---|
68 | * actually link against crti.o and crtn.o; the linker won't |
---|
69 | * look for a file to match a wildcard. The wildcard also |
---|
70 | * means that it doesn't matter which directory crti.o and |
---|
71 | * crtn.o are in. |
---|
72 | */ |
---|
73 | PROVIDE (_init = .); |
---|
74 | *crti.o(.init) |
---|
75 | *(.init) |
---|
76 | *crtn.o(.init) |
---|
77 | PROVIDE (_fini = .); |
---|
78 | *crti.o(.fini) |
---|
79 | *(.fini) |
---|
80 | *crtn.o(.fini) |
---|
81 | |
---|
82 | /* |
---|
83 | * C++ constructors/destructors |
---|
84 | * |
---|
85 | * gcc uses crtbegin.o to find the start of the constructors |
---|
86 | * and destructors so we make sure it is first. Because this |
---|
87 | * is a wildcard, it doesn't matter if the user does not |
---|
88 | * actually link against crtbegin.o; the linker won't look for |
---|
89 | * a file to match a wildcard. The wildcard also means that |
---|
90 | * it doesn't matter which directory crtbegin.o is in. The |
---|
91 | * constructor and destructor list are terminated in |
---|
92 | * crtend.o. The same comments apply to it. |
---|
93 | */ |
---|
94 | . = ALIGN (16); |
---|
95 | *crtbegin.o(.ctors) |
---|
96 | *(.ctors) |
---|
97 | *crtend.o(.ctors) |
---|
98 | *crtbegin.o(.dtors) |
---|
99 | *(.dtors) |
---|
100 | *crtend.o(.dtors) |
---|
101 | |
---|
102 | /* |
---|
103 | * Exception frame info |
---|
104 | */ |
---|
105 | . = ALIGN (16); |
---|
106 | *(.eh_frame) |
---|
107 | |
---|
108 | /* |
---|
109 | * Read-only data |
---|
110 | */ |
---|
111 | . = ALIGN (16); |
---|
112 | _rodata_start = . ; |
---|
113 | *(.rodata) |
---|
114 | *(.gnu.linkonce.r*) |
---|
115 | |
---|
116 | . = ALIGN (16); |
---|
117 | PROVIDE (etext = .); |
---|
118 | } >ram |
---|
119 | .data : { |
---|
120 | copy_start = .; |
---|
121 | *(.data) |
---|
122 | *(.gnu.linkonce.d*) |
---|
123 | *(.gcc_except_table) |
---|
124 | . = ALIGN (16); |
---|
125 | PROVIDE (_edata = .); |
---|
126 | copy_end = .; |
---|
127 | } >ram |
---|
128 | .bss : { |
---|
129 | M68Kvec = .; |
---|
130 | _M68Kvec = .; |
---|
131 | . += (256 * 4); |
---|
132 | clear_start = .; |
---|
133 | *(.bss) |
---|
134 | *(COMMON) |
---|
135 | . = ALIGN (16); |
---|
136 | PROVIDE (end = .); |
---|
137 | |
---|
138 | . += StackSize; |
---|
139 | PROVIDE (_stack_init = .); |
---|
140 | |
---|
141 | . = ALIGN (16); |
---|
142 | PROVIDE (_HeapStart = .); |
---|
143 | . += HeapSize; |
---|
144 | PROVIDE (_HeapEnd = .); |
---|
145 | |
---|
146 | PROVIDE (_clear_end = .); |
---|
147 | |
---|
148 | _WorkspaceBase = .; |
---|
149 | } >ram |
---|
150 | |
---|
151 | /* |
---|
152 | * On-chip memory/peripherals |
---|
153 | */ |
---|
154 | dpram : { |
---|
155 | m360 = .; |
---|
156 | _m360 = .; |
---|
157 | . += (8 * 1024); |
---|
158 | |
---|
159 | } >dpram |
---|
160 | } |
---|