]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/scripttempl/elfd10v.sc
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / ld / scripttempl / elfd10v.sc
CommitLineData
250d07de 1# Copyright (C) 2014-2021 Free Software Foundation, Inc.
6c19b93b 2#
985743c7
NC
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
7test -z "$ENTRY" && ENTRY=_start
8test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
9test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
10if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
11test "$LD_FLAG" = "N" && DATA_ADDR=.
6c19b93b
AM
12INTERP=".interp ${RELOCATING-0} : { *(.interp) }"
13PLT=".plt ${RELOCATING-0} : { *(.plt) }"
252b5132
RH
14
15
6c19b93b 16CTOR=".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 43DTOR=" .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 54STACK=" .stack : { _stack = .; *(.stack) } >STACK "
252b5132
RH
55
56# if this is for an embedded system, don't add SIZEOF_HEADERS.
57if [ -z "$EMBEDDED" ]; then
58 test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR} + SIZEOF_HEADERS"
59else
60 test -z "${READONLY_BASE_ADDRESS}" && READONLY_BASE_ADDRESS="${READONLY_START_ADDR}"
61fi
62
63cat <<EOF
250d07de 64/* Copyright (C) 2014-2021 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
70OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
71 "${LITTLE_OUTPUT_FORMAT}")
72OUTPUT_ARCH(${OUTPUT_ARCH})
2bf2bf23
AM
73EOF
74
75test -n "${RELOCATING}" && cat <<EOF
76ENTRY(${ENTRY})
252b5132 77
2bf2bf23
AM
78${LIB_SEARCH_DIRS}
79/* Do we need any of these for elf?
80 __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}} */
81${EXECUTABLE_SYMBOLS}
eaba1dd3
RH
82
83MEMORY
84{
5435462c
NC
85 /* These are the values for the D10V-TS3 board.
86 There are other memory regions available on
87 the TS3 (eg ROM, FLASH, etc) but these are not
88 used by this script. */
6c19b93b 89
5435462c
NC
90 INSN : org = 0x01000000, len = 256K
91 DATA : org = 0x02000000, len = 48K
92
93 /* This is a fake memory region at the top of the
94 on-chip RAM, used as the start of the
95 (descending) stack. */
6c19b93b 96
5435462c 97 STACK : org = 0x0200BFFC, len = 4
eaba1dd3
RH
98}
99
2bf2bf23
AM
100EOF
101
102cat <<EOF
252b5132
RH
103SECTIONS
104{
82434356 105 .text ${RELOCATING+${TEXT_START_ADDR}} :
eaba1dd3 106 {
2bf2bf23 107 ${RELOCATING+${TEXT_START_SYMBOLS}
b2e4da5a
L
108 KEEP (*(SORT_NONE(.init)))
109 KEEP (*(SORT_NONE(.init.*)))
110 KEEP (*(SORT_NONE(.fini)))
2bf2bf23 111 KEEP (*(SORT_NONE(.fini.*)))}
eaba1dd3 112 *(.text)
2bf2bf23 113 ${RELOCATING+*(.text.*)}
075a2b89 114 /* .gnu.warning sections are handled specially by elf.em. */
eaba1dd3 115 *(.gnu.warning)
2bf2bf23
AM
116 ${RELOCATING+*(.gnu.linkonce.t*)
117 _etext = .;
118 PROVIDE (etext = .);}
eaba1dd3
RH
119 } ${RELOCATING+ >INSN} =${NOP-0}
120
5435462c 121 .rodata ${RELOCATING+${READONLY_START_ADDR}} : {
788fca5a 122 *(.rodata)
2bf2bf23
AM
123 ${RELOCATING+*(.gnu.linkonce.r*)
124 *(.rodata.*)}
eaba1dd3 125 } ${RELOCATING+ >DATA}
788fca5a 126
ec2d9b29 127 .rodata1 ${RELOCATING-0} : {
788fca5a 128 *(.rodata1)
2bf2bf23 129 ${RELOCATING+*(.rodata1.*)}
788fca5a 130 } ${RELOCATING+ >DATA}
252b5132 131
ec2d9b29 132 .data ${RELOCATING-0} :
252b5132
RH
133 {
134 ${RELOCATING+${DATA_START_SYMBOLS}}
135 *(.data)
2bf2bf23
AM
136 ${RELOCATING+*(.data.*)
137 *(.gnu.linkonce.d*)}
252b5132 138 ${CONSTRUCTING+CONSTRUCTORS}
eaba1dd3 139 } ${RELOCATING+ >DATA}
f9faad58 140
ec2d9b29 141 .data1 ${RELOCATING-0} : {
f9faad58 142 *(.data1)
2bf2bf23 143 ${RELOCATING+*(.data1.*)}
f9faad58
MM
144 } ${RELOCATING+ >DATA}
145
eaba1dd3
RH
146 ${RELOCATING+${CTOR} >DATA}
147 ${RELOCATING+${DTOR} >DATA}
148
252b5132
RH
149 /* We want the small data sections together, so single-instruction offsets
150 can access them all, and initialized data all before uninitialized, so
151 we can shorten the on-disk segment size. */
ec2d9b29 152 .sdata ${RELOCATING-0} : {
788fca5a 153 *(.sdata)
2bf2bf23 154 ${RELOCATING+*(.sdata.*)}
788fca5a
MM
155 } ${RELOCATING+ >DATA}
156
eaba1dd3 157 ${RELOCATING+_edata = .;}
252b5132
RH
158 ${RELOCATING+PROVIDE (edata = .);}
159 ${RELOCATING+__bss_start = .;}
2bf2bf23 160 .sbss ${RELOCATING-0} : { *(.sbss)${RELOCATING+ *(.scommon)} } ${RELOCATING+ >DATA}
ec2d9b29 161 .bss ${RELOCATING-0} :
252b5132 162 {
2bf2bf23
AM
163 ${RELOCATING+*(.dynbss)
164 *(.dynbss.*)}
252b5132 165 *(.bss)
2bf2bf23
AM
166 ${RELOCATING+*(.bss.*)
167 *(COMMON)}
eaba1dd3 168 } ${RELOCATING+ >DATA}
788fca5a 169
252b5132
RH
170 ${RELOCATING+_end = . ;}
171 ${RELOCATING+PROVIDE (end = .);}
172
eaba1dd3
RH
173 ${RELOCATING+$STACK}
174
252b5132
RH
175 /* Stabs debugging sections. */
176 .stab 0 : { *(.stab) }
177 .stabstr 0 : { *(.stabstr) }
178 .stab.excl 0 : { *(.stab.excl) }
179 .stab.exclstr 0 : { *(.stab.exclstr) }
180 .stab.index 0 : { *(.stab.index) }
181 .stab.indexstr 0 : { *(.stab.indexstr) }
182
183 .comment 0 : { *(.comment) }
184
ceb0a680
NC
185EOF
186
d061dfac 187. $srcdir/scripttempl/DWARF.sc
ceb0a680
NC
188
189cat <<EOF
252b5132
RH
190}
191EOF