1 | # a linker script template. |
---|
2 | # RAM - start of board's ram |
---|
3 | # RAM_SIZE - size of board's ram |
---|
4 | # ROM - start of board's rom |
---|
5 | # ROM_SIZE - size of board's rom |
---|
6 | # IO - io library name |
---|
7 | |
---|
8 | test -z "${ROM:+1}" && NOROM=1 |
---|
9 | |
---|
10 | cat <<EOF |
---|
11 | STARTUP(cf-${IO}-crt0.o) |
---|
12 | OUTPUT_ARCH(m68k) |
---|
13 | ENTRY(__start) |
---|
14 | SEARCH_DIR(.) |
---|
15 | GROUP(-lc -l${IO} -lcf) |
---|
16 | __DYNAMIC = 0; |
---|
17 | |
---|
18 | MEMORY |
---|
19 | { |
---|
20 | ${ROM:+rom (rx) : ORIGIN = ${ROM}, LENGTH = ${ROM_SIZE}} |
---|
21 | ram (rwx) : ORIGIN = ${RAM}, LENGTH = ${RAM_SIZE} |
---|
22 | } |
---|
23 | |
---|
24 | /* Place the stack at the end of memory, unless specified otherwise. */ |
---|
25 | PROVIDE (__stack = ${RAM} + ${RAM_SIZE}); |
---|
26 | |
---|
27 | SECTIONS |
---|
28 | { |
---|
29 | .text : |
---|
30 | { |
---|
31 | CREATE_OBJECT_SYMBOLS |
---|
32 | *(.interrupt_vector) |
---|
33 | |
---|
34 | cf-${IO}-crt0.o(.text) |
---|
35 | *(.text .text.*) |
---|
36 | *(.gnu.linkonce.t.*) |
---|
37 | |
---|
38 | . = ALIGN(0x4); |
---|
39 | /* These are for running static constructors and destructors under ELF. */ |
---|
40 | KEEP (*crtbegin.o(.ctors)) |
---|
41 | KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) |
---|
42 | KEEP (*(SORT(.ctors.*))) |
---|
43 | KEEP (*crtend.o(.ctors)) |
---|
44 | KEEP (*crtbegin.o(.dtors)) |
---|
45 | KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) |
---|
46 | KEEP (*(SORT(.dtors.*))) |
---|
47 | KEEP (*crtend.o(.dtors)) |
---|
48 | |
---|
49 | . = ALIGN(0x4); |
---|
50 | KEEP (*crtbegin.o(.jcr)) |
---|
51 | KEEP (*(EXCLUDE_FILE (*crtend.o) .jcr)) |
---|
52 | KEEP (*crtend.o(.jcr)) |
---|
53 | |
---|
54 | *(.rodata .rodata.*) |
---|
55 | *(.gnu.linkonce.r.*) |
---|
56 | |
---|
57 | . = ALIGN(0x4); |
---|
58 | *(.gcc_except_table) |
---|
59 | |
---|
60 | . = ALIGN(0x4); |
---|
61 | *(.eh_frame) |
---|
62 | |
---|
63 | . = ALIGN(0x4); |
---|
64 | _init = . ; |
---|
65 | LONG (0x4e560000) /* linkw %fp,#0 */ |
---|
66 | *(.init) |
---|
67 | SHORT (0x4e5e) /* unlk %fp */ |
---|
68 | SHORT (0x4e75) /* rts */ |
---|
69 | |
---|
70 | . = ALIGN(0x4); |
---|
71 | _fini = . ; |
---|
72 | LONG (0x4e560000) /* linkw %fp,#0 */ |
---|
73 | *(.fini) |
---|
74 | SHORT (0x4e5e) /* unlk %fp */ |
---|
75 | SHORT (0x4e75) /* rts */ |
---|
76 | |
---|
77 | *(.lit) |
---|
78 | |
---|
79 | . = ALIGN(4); |
---|
80 | _etext = .; |
---|
81 | } >${ROM:+rom}${NOROM:+ram} |
---|
82 | |
---|
83 | .data : |
---|
84 | { |
---|
85 | __data_load = LOADADDR (.data); |
---|
86 | __data_start = .; |
---|
87 | *(.got.plt) *(.got) |
---|
88 | *(.shdata) |
---|
89 | *(.data .data.*) |
---|
90 | *(.gnu.linkonce.d.*) |
---|
91 | . = ALIGN (4); |
---|
92 | _edata = .; |
---|
93 | } >ram ${ROM:+AT>rom} |
---|
94 | |
---|
95 | .bss : |
---|
96 | { |
---|
97 | __bss_start = . ; |
---|
98 | *(.shbss) |
---|
99 | *(.bss .bss.*) |
---|
100 | *(.gnu.linkonce.b.*) |
---|
101 | *(COMMON) |
---|
102 | . = ALIGN (8); |
---|
103 | _end = .; |
---|
104 | __end = _end; |
---|
105 | } >ram ${ROM:+AT>rom} |
---|
106 | |
---|
107 | .stab 0 (NOLOAD) : |
---|
108 | { |
---|
109 | *(.stab) |
---|
110 | } |
---|
111 | |
---|
112 | .stabstr 0 (NOLOAD) : |
---|
113 | { |
---|
114 | *(.stabstr) |
---|
115 | } |
---|
116 | |
---|
117 | /* DWARF debug sections. |
---|
118 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
119 | of the section so we begin them at 0. */ |
---|
120 | /* DWARF 1 */ |
---|
121 | .debug 0 : { *(.debug) } |
---|
122 | .line 0 : { *(.line) } |
---|
123 | /* GNU DWARF 1 extensions */ |
---|
124 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
125 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
126 | /* DWARF 1.1 and DWARF 2 */ |
---|
127 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
128 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
129 | /* DWARF 2 */ |
---|
130 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
131 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
132 | .debug_line 0 : { *(.debug_line) } |
---|
133 | .debug_frame 0 : { *(.debug_frame) } |
---|
134 | .debug_str 0 : { *(.debug_str) } |
---|
135 | .debug_loc 0 : { *(.debug_loc) } |
---|
136 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
137 | |
---|
138 | } |
---|
139 | EOF |
---|