* testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
[deliverable/binutils-gdb.git] / ld / scripttempl / elf32crx.sc
CommitLineData
1fe1f39c 1# Linker Script for National Semiconductor's CRX-ELF32.
df381c72 2test -z "$RELOCATING" && exit 0
1fe1f39c
NC
3
4# The next line should be uncommented if it is desired to link
5# without libstart.o and directly enter main.
6
7# ENTRY=_main
8
9test -z "$ENTRY" && ENTRY=_start
10cat <<EOF
11
12/* Example Linker Script for linking NS CRX elf32 files. */
13
1fe1f39c
NC
14OUTPUT_FORMAT("${OUTPUT_FORMAT}")
15OUTPUT_ARCH(${ARCH})
df381c72 16ENTRY(${ENTRY})
1fe1f39c
NC
17
18/* Define memory regions. */
19MEMORY
20{
21 rom : ORIGIN = 0x2, LENGTH = 3M
22 ram : ORIGIN = 4M, LENGTH = 10M
23}
24
42851540
NC
25/* Many sections come in three flavours. There is the 'real' section,
26 like ".data". Then there are the per-procedure or per-variable
27 sections, generated by -ffunction-sections and -fdata-sections in GCC,
28 and useful for --gc-sections, which for a variable "foo" might be
29 ".data.foo". Then there are the linkonce sections, for which the linker
30 eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
31 The exact correspondences are:
32
33 Section Linkonce section
34 .text .gnu.linkonce.t.foo
35 .rdata .gnu.linkonce.r.foo
36 .data .gnu.linkonce.d.foo
37 .bss .gnu.linkonce.b.foo
38 .debug_info .gnu.linkonce.wi.foo */
39
1fe1f39c
NC
40SECTIONS
41{
42851540
NC
42 .init :
43 {
44 __INIT_START = .;
1fa32646 45 KEEP (*(.init))
42851540
NC
46 __INIT_END = .;
47 } > rom
48
49 .fini :
50 {
51 __FINI_START = .;
1fa32646 52 KEEP (*(.fini))
42851540
NC
53 __FINI_END = .;
54 } > rom
55
56 .jcr :
57 {
1fa32646 58 KEEP (*(.jcr))
42851540
NC
59 } > rom
60
61 .text :
62 {
63 __TEXT_START = .;
64 *(.text) *(.text.*) *(.gnu.linkonce.t.*)
65 __TEXT_END = .;
66 } > rom
67
68 .rdata :
69 {
70 __RDATA_START = .;
b7309ada 71 *(.rdata_4) *(.rdata_2) *(.rdata_1) *(.rdata.*) *(.gnu.linkonce.r.*) *(.rodata.*)
42851540
NC
72 __RDATA_END = .;
73 } > rom
74
75 .ctor ALIGN(4) :
76 {
77 __CTOR_START = .;
78 /* The compiler uses crtbegin.o to find the start
79 of the constructors, so we make sure it is
80 first. Because this is a wildcard, it
81 doesn't matter if the user does not
82 actually link against crtbegin.o; the
83 linker won't look for a file to match a
84 wildcard. The wildcard also means that it
85 doesn't matter which directory crtbegin.o
86 is in. */
87
40cf2291
AM
88 KEEP (*crtbegin.o(.ctors))
89 KEEP (*crtbegin?.o(.ctors))
90
42851540
NC
91 /* We don't want to include the .ctor section from
92 the crtend.o file until after the sorted ctors.
93 The .ctor section from the crtend file contains the
94 end of ctors marker and it must be last */
95
40cf2291 96 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))
42851540
NC
97 KEEP (*(SORT(.ctors.*)))
98 KEEP (*(.ctors))
99 __CTOR_END = .;
100 } > rom
101
102 .dtor ALIGN(4) :
103 {
104 __DTOR_START = .;
40cf2291
AM
105 KEEP (*crtbegin.o(.dtors))
106 KEEP (*crtbegin?.o(.dtors))
107 KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))
42851540
NC
108 KEEP (*(SORT(.dtors.*)))
109 KEEP (*(.dtors))
110 __DTOR_END = .;
111 } > rom
112
113 .data :
114 {
115 __DATA_START = .;
116 *(.data_4) *(.data_2) *(.data_1) *(.data) *(.data.*) *(.gnu.linkonce.d.*)
117 __DATA_END = .;
118 } > ram AT > rom
119
120 .bss (NOLOAD) :
121 {
122 __BSS_START = .;
123 *(.bss_4) *(.bss_2) *(.bss_1) *(.bss) *(COMMON) *(.bss.*) *(.gnu.linkonce.b.*)
124 __BSS_END = .;
125 } > ram
1fe1f39c
NC
126
127/* You may change the sizes of the following sections to fit the actual
128 size your program requires.
129
130 The heap and stack are aligned to the bus width, as a speed optimization
131 for accessing data located there. */
132
7ba29e2a 133 .heap (NOLOAD) :
42851540
NC
134 {
135 . = ALIGN(4);
136 __HEAP_START = .;
137 . += 0x2000; __HEAP_MAX = .;
138 } > ram
139
7ba29e2a 140 .stack (NOLOAD) :
42851540
NC
141 {
142 . = ALIGN(4);
143 . += 0x6000;
144 __STACK_START = .;
145 } > ram
146
7ba29e2a 147 .istack (NOLOAD) :
42851540
NC
148 {
149 . = ALIGN(4);
150 . += 0x100;
151 __ISTACK_START = .;
152 } > ram
153
154 .comment 0 : { *(.comment) }
155
156 /* DWARF debug sections.
157 Symbols in the DWARF debugging sections are relative to the beginning
158 of the section so we begin them at 0. */
159
160 .debug_aranges 0 : { *(.debug_aranges) }
161 .debug_pubnames 0 : { *(.debug_pubnames) }
162 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
163 .debug_abbrev 0 : { *(.debug_abbrev) }
164 .debug_line 0 : { *(.debug_line) }
165 .debug_frame 0 : { *(.debug_frame) }
166 .debug_str 0 : { *(.debug_str) }
167 .debug_loc 0 : { *(.debug_loc) }
168 .debug_macinfo 0 : { *(.debug_macinfo) }
1fe1f39c
NC
169}
170
171__DATA_IMAGE_START = LOADADDR(.data);
172EOF
This page took 0.294509 seconds and 4 git commands to generate.