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