Commit | Line | Data |
---|---|---|
2571583a | 1 | # Copyright (C) 2014-2017 Free Software Foundation, Inc. |
985743c7 NC |
2 | # |
3 | # Copying and distribution of this file, with or without modification, | |
4 | # are permitted in any medium without royalty provided the copyright | |
5 | # notice and this notice are preserved. | |
6 | ||
252b5132 RH |
7 | test -z "$ENTRY" && ENTRY=_start |
8 | test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
9 | test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} | |
10 | if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi | |
11 | test "$LD_FLAG" = "N" && DATA_ADDR=. | |
ec2d9b29 AM |
12 | INTERP=".interp ${RELOCATING-0} : { *(.interp) }" |
13 | PLT=".plt ${RELOCATING-0} : { *(.plt) }" | |
252b5132 RH |
14 | |
15 | ||
ec2d9b29 | 16 | CTOR=".ctors ${CONSTRUCTING-0} : |
252b5132 RH |
17 | { |
18 | ${CONSTRUCTING+${CTOR_START}} | |
19 | /* gcc uses crtbegin.o to find the start of | |
20 | the constructors, so we make sure it is | |
21 | first. Because this is a wildcard, it | |
22 | doesn't matter if the user does not | |
23 | actually link against crtbegin.o; the | |
24 | linker won't look for a file to match a | |
25 | wildcard. The wildcard also means that it | |
26 | doesn't matter which directory crtbegin.o | |
27 | is in. */ | |
28 | ||
40cf2291 AM |
29 | KEEP (*crtbegin.o(.ctors)) |
30 | KEEP (*crtbegin?.o(.ctors)) | |
252b5132 RH |
31 | |
32 | /* We don't want to include the .ctor section from | |
bd6791bc | 33 | the crtend.o file until after the sorted ctors. |
252b5132 RH |
34 | The .ctor section from the crtend file contains the |
35 | end of ctors marker and it must be last */ | |
36 | ||
40cf2291 | 37 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors)) |
252b5132 RH |
38 | KEEP (*(SORT(.ctors.*))) |
39 | KEEP (*(.ctors)) | |
40 | ${CONSTRUCTING+${CTOR_END}} | |
41 | }" | |
42 | ||
ec2d9b29 | 43 | DTOR=" .dtors ${CONSTRUCTING-0} : |
252b5132 RH |
44 | { |
45 | ${CONSTRUCTING+${DTOR_START}} | |
40cf2291 AM |
46 | KEEP (*crtbegin.o(.dtors)) |
47 | KEEP (*crtbegin?.o(.dtors)) | |
48 | KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors)) | |
252b5132 RH |
49 | KEEP (*(SORT(.dtors.*))) |
50 | KEEP (*(.dtors)) | |
51 | ${CONSTRUCTING+${DTOR_END}} | |
52 | }" | |
53 | ||
eaba1dd3 | 54 | STACK=" .stack : { _stack = .; *(.stack) } >STACK " |
252b5132 RH |
55 | |
56 | # if this is for an embedded system, don't add SIZEOF_HEADERS. | |
57 | if [ -z "$EMBEDDED" ]; then | |
58 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS" | |
59 | else | |
60 | test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}" | |
61 | fi | |
62 | ||
63 | cat <<EOF | |
2571583a | 64 | /* Copyright (C) 2014-2017 Free Software Foundation, Inc. |
985743c7 NC |
65 | |
66 | Copying and distribution of this script, with or without modification, | |
67 | are permitted in any medium without royalty provided the copyright | |
68 | notice and this notice are preserved. */ | |
69 | ||
252b5132 RH |
70 | OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", |
71 | "${LITTLE_OUTPUT_FORMAT}") | |
72 | OUTPUT_ARCH(${OUTPUT_ARCH}) | |
b34c1498 | 73 | ${RELOCATING+ENTRY(${ENTRY})} |
252b5132 RH |
74 | |
75 | ${RELOCATING+${LIB_SEARCH_DIRS}} | |
76 | ${RELOCATING+/* Do we need any of these for elf? | |
77 | __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */} | |
78 | ${RELOCATING+${EXECUTABLE_SYMBOLS}} | |
eaba1dd3 RH |
79 | |
80 | MEMORY | |
81 | { | |
5435462c NC |
82 | /* These are the values for the D10V-TS3 board. |
83 | There are other memory regions available on | |
84 | the TS3 (eg ROM, FLASH, etc) but these are not | |
85 | used by this script. */ | |
86 | ||
87 | INSN : org = 0x01000000, len = 256K | |
88 | DATA : org = 0x02000000, len = 48K | |
89 | ||
90 | /* This is a fake memory region at the top of the | |
91 | on-chip RAM, used as the start of the | |
92 | (descending) stack. */ | |
93 | ||
94 | STACK : org = 0x0200BFFC, len = 4 | |
eaba1dd3 RH |
95 | } |
96 | ||
252b5132 RH |
97 | SECTIONS |
98 | { | |
82434356 | 99 | .text ${RELOCATING+${TEXT_START_ADDR}} : |
eaba1dd3 RH |
100 | { |
101 | ${RELOCATING+${TEXT_START_SYMBOLS}} | |
b2e4da5a L |
102 | KEEP (*(SORT_NONE(.init))) |
103 | KEEP (*(SORT_NONE(.init.*))) | |
104 | KEEP (*(SORT_NONE(.fini))) | |
105 | KEEP (*(SORT_NONE(.fini.*))) | |
eaba1dd3 RH |
106 | *(.text) |
107 | *(.text.*) | |
108 | /* .gnu.warning sections are handled specially by elf32.em. */ | |
109 | *(.gnu.warning) | |
110 | *(.gnu.linkonce.t*) | |
111 | ${RELOCATING+_etext = .;} | |
112 | ${RELOCATING+PROVIDE (etext = .);} | |
113 | } ${RELOCATING+ >INSN} =${NOP-0} | |
114 | ||
5435462c | 115 | .rodata ${RELOCATING+${READONLY_START_ADDR}} : { |
788fca5a MM |
116 | *(.rodata) |
117 | *(.gnu.linkonce.r*) | |
118 | *(.rodata.*) | |
eaba1dd3 | 119 | } ${RELOCATING+ >DATA} |
788fca5a | 120 | |
ec2d9b29 | 121 | .rodata1 ${RELOCATING-0} : { |
788fca5a MM |
122 | *(.rodata1) |
123 | *(.rodata1.*) | |
124 | } ${RELOCATING+ >DATA} | |
252b5132 | 125 | |
ec2d9b29 | 126 | .data ${RELOCATING-0} : |
252b5132 RH |
127 | { |
128 | ${RELOCATING+${DATA_START_SYMBOLS}} | |
129 | *(.data) | |
130 | *(.data.*) | |
131 | *(.gnu.linkonce.d*) | |
132 | ${CONSTRUCTING+CONSTRUCTORS} | |
eaba1dd3 | 133 | } ${RELOCATING+ >DATA} |
f9faad58 | 134 | |
ec2d9b29 | 135 | .data1 ${RELOCATING-0} : { |
f9faad58 MM |
136 | *(.data1) |
137 | *(.data1.*) | |
138 | } ${RELOCATING+ >DATA} | |
139 | ||
eaba1dd3 RH |
140 | ${RELOCATING+${CTOR} >DATA} |
141 | ${RELOCATING+${DTOR} >DATA} | |
142 | ||
252b5132 RH |
143 | /* We want the small data sections together, so single-instruction offsets |
144 | can access them all, and initialized data all before uninitialized, so | |
145 | we can shorten the on-disk segment size. */ | |
ec2d9b29 | 146 | .sdata ${RELOCATING-0} : { |
788fca5a MM |
147 | *(.sdata) |
148 | *(.sdata.*) | |
149 | } ${RELOCATING+ >DATA} | |
150 | ||
eaba1dd3 | 151 | ${RELOCATING+_edata = .;} |
252b5132 RH |
152 | ${RELOCATING+PROVIDE (edata = .);} |
153 | ${RELOCATING+__bss_start = .;} | |
ec2d9b29 AM |
154 | .sbss ${RELOCATING-0} : { *(.sbss) *(.scommon) } ${RELOCATING+ >DATA} |
155 | .bss ${RELOCATING-0} : | |
252b5132 RH |
156 | { |
157 | *(.dynbss) | |
788fca5a | 158 | *(.dynbss.*) |
252b5132 | 159 | *(.bss) |
788fca5a | 160 | *(.bss.*) |
252b5132 | 161 | *(COMMON) |
eaba1dd3 | 162 | } ${RELOCATING+ >DATA} |
788fca5a | 163 | |
252b5132 RH |
164 | ${RELOCATING+_end = . ;} |
165 | ${RELOCATING+PROVIDE (end = .);} | |
166 | ||
eaba1dd3 RH |
167 | ${RELOCATING+$STACK} |
168 | ||
252b5132 RH |
169 | /* Stabs debugging sections. */ |
170 | .stab 0 : { *(.stab) } | |
171 | .stabstr 0 : { *(.stabstr) } | |
172 | .stab.excl 0 : { *(.stab.excl) } | |
173 | .stab.exclstr 0 : { *(.stab.exclstr) } | |
174 | .stab.index 0 : { *(.stab.index) } | |
175 | .stab.indexstr 0 : { *(.stab.indexstr) } | |
176 | ||
177 | .comment 0 : { *(.comment) } | |
178 | ||
ceb0a680 NC |
179 | EOF |
180 | ||
d061dfac | 181 | . $srcdir/scripttempl/DWARF.sc |
ceb0a680 NC |
182 | |
183 | cat <<EOF | |
252b5132 RH |
184 | } |
185 | EOF |