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