Commit | Line | Data |
---|---|---|
252b5132 RH |
1 | # This shell script emits a C file. -*- C -*- |
2 | # It does some substitutions. | |
252b5132 | 3 | test -z "${ELFSIZE}" && ELFSIZE=32 |
86af25fe L |
4 | if [ -z "$MACHINE" ]; then |
5 | OUTPUT_ARCH=${ARCH} | |
6 | else | |
7 | OUTPUT_ARCH=${ARCH}:${MACHINE} | |
8 | fi | |
92b93329 | 9 | fragment <<EOF |
252b5132 RH |
10 | /* This file is is generated by a shell script. DO NOT EDIT! */ |
11 | ||
12 | /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME} | |
b3adc24a | 13 | Copyright (C) 1991-2020 Free Software Foundation, Inc. |
252b5132 RH |
14 | Written by Steve Chamberlain <sac@cygnus.com> |
15 | ELF support by Ian Lance Taylor <ian@cygnus.com> | |
16 | ||
f96b4a7b NC |
17 | This file is part of the GNU Binutils. |
18 | ||
19 | This program is free software; you can redistribute it and/or modify | |
20 | it under the terms of the GNU General Public License as published by | |
21 | the Free Software Foundation; either version 3 of the License, or | |
22 | (at your option) any later version. | |
23 | ||
24 | This program is distributed in the hope that it will be useful, | |
25 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
27 | GNU General Public License for more details. | |
28 | ||
29 | You should have received a copy of the GNU General Public License | |
30 | along with this program; if not, write to the Free Software | |
31 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
32 | MA 02110-1301, USA. */ | |
252b5132 RH |
33 | |
34 | #define TARGET_IS_${EMULATION_NAME} | |
35 | ||
252b5132 | 36 | #include "sysdep.h" |
3db64b00 | 37 | #include "bfd.h" |
1c9acd94 | 38 | #include "libiberty.h" |
fcf65871 | 39 | #include "getopt.h" |
252b5132 | 40 | #include "bfdlink.h" |
1ff6de03 | 41 | #include "ctf-api.h" |
252b5132 RH |
42 | #include "ld.h" |
43 | #include "ldmain.h" | |
252b5132 RH |
44 | #include "ldmisc.h" |
45 | #include "ldexp.h" | |
46 | #include "ldlang.h" | |
b71e2778 AM |
47 | #include "ldfile.h" |
48 | #include "ldemul.h" | |
df2a7313 | 49 | #include <ldgram.h> |
ecca9871 | 50 | #include "elf-bfd.h" |
d871d478 AM |
51 | #include "ldelf.h" |
52 | #include "ldelfgen.h" | |
252b5132 | 53 | |
0c7a8e5a AM |
54 | /* Declare functions used by various EXTRA_EM_FILEs. */ |
55 | static void gld${EMULATION_NAME}_before_parse (void); | |
56 | static void gld${EMULATION_NAME}_after_open (void); | |
57 | static void gld${EMULATION_NAME}_before_allocation (void); | |
eaeb0a9d | 58 | static void gld${EMULATION_NAME}_after_allocation (void); |
d3989512 | 59 | EOF |
d3989512 | 60 | |
41392f03 AM |
61 | # Import any needed special functions and/or overrides. |
62 | # | |
92b93329 | 63 | source_em ${srcdir}/emultempl/elf-generic.em |
41392f03 | 64 | if test -n "$EXTRA_EM_FILE" ; then |
92b93329 | 65 | source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em |
41392f03 AM |
66 | fi |
67 | ||
f813923c | 68 | # Functions in this file can be overridden by setting the LDEMUL_* shell |
41392f03 AM |
69 | # variables. If the name of the overriding function is the same as is |
70 | # defined in this file, then don't output this file's version. | |
71 | # If a different overriding name is given then output the standard function | |
72 | # as presumably it is called from the overriding function. | |
73 | # | |
74 | if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then | |
92b93329 | 75 | fragment <<EOF |
41392f03 | 76 | |
252b5132 | 77 | static void |
0c7a8e5a | 78 | gld${EMULATION_NAME}_before_parse (void) |
252b5132 | 79 | { |
5e2f1575 | 80 | ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`); |
66be1055 | 81 | input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; |
b34976b6 | 82 | config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; |
4724d37e | 83 | config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; |
5c3261b0 | 84 | link_info.check_relocs_after_open_input = TRUE; |
647e4d46 | 85 | link_info.relro = DEFAULT_LD_Z_RELRO; |
f6aec96d | 86 | link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE; |
663fa543 L |
87 | } |
88 | ||
822b8bf4 | 89 | EOF |
663fa543 | 90 | fi |
822b8bf4 | 91 | |
92b93329 | 92 | fragment <<EOF |
252b5132 | 93 | |
7ee314fa AM |
94 | /* These variables are used to implement target options */ |
95 | ||
96 | static char *audit; /* colon (typically) separated list of libs */ | |
97 | static char *depaudit; /* colon (typically) separated list of libs */ | |
252b5132 | 98 | |
04925e1e | 99 | EOF |
316a1245 | 100 | |
d871d478 | 101 | if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then |
04925e1e | 102 | |
d871d478 AM |
103 | IS_LINUX_TARGET=FALSE |
104 | IS_FREEBSD_TARGET=FALSE | |
3dc16cab | 105 | case ${target} in |
a5244b7e | 106 | *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*) |
d871d478 AM |
107 | IS_LINUX_TARGET=TRUE ;; |
108 | *-*-freebsd* | *-*-dragonfly*) | |
109 | IS_FREEBSD_TARGET=TRUE ;; | |
110 | esac | |
111 | IS_LIBPATH=FALSE | |
112 | if test "x${USE_LIBPATH}" = xyes; then | |
113 | IS_LIBPATH=TRUE | |
114 | fi | |
115 | IS_NATIVE=FALSE | |
116 | if test "x${NATIVE}" = xyes; then | |
117 | IS_NATIVE=TRUE | |
118 | fi | |
04925e1e | 119 | |
d871d478 | 120 | fragment <<EOF |
04925e1e | 121 | |
d871d478 | 122 | /* This is called after all the input files have been opened. */ |
d3989512 JJ |
123 | |
124 | static void | |
d871d478 | 125 | gld${EMULATION_NAME}_after_open (void) |
d3989512 | 126 | { |
d871d478 | 127 | ldelf_after_open ($IS_LIBPATH, $IS_NATIVE, |
ef8f08ca | 128 | $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix"); |
252b5132 RH |
129 | } |
130 | ||
04925e1e | 131 | EOF |
04925e1e | 132 | fi |
d871d478 AM |
133 | |
134 | if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation; then | |
135 | if test x"${ELF_INTERPRETER_NAME}" = x; then | |
136 | ELF_INTERPRETER_NAME=NULL | |
137 | fi | |
92b93329 | 138 | fragment <<EOF |
04925e1e | 139 | |
d871d478 AM |
140 | /* This is called after the sections have been attached to output |
141 | sections, but before any sizes or addresses have been set. */ | |
252b5132 RH |
142 | |
143 | static void | |
d871d478 | 144 | gld${EMULATION_NAME}_before_allocation (void) |
252b5132 | 145 | { |
d871d478 AM |
146 | ldelf_before_allocation (audit, depaudit, ${ELF_INTERPRETER_NAME}); |
147 | } | |
7cedef86 | 148 | |
c56feb2b AM |
149 | EOF |
150 | fi | |
151 | ||
eaeb0a9d | 152 | if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then |
92b93329 | 153 | fragment <<EOF |
252b5132 | 154 | |
deb04cdb | 155 | static void |
eaeb0a9d | 156 | gld${EMULATION_NAME}_after_allocation (void) |
deb04cdb | 157 | { |
75938853 AM |
158 | int need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info); |
159 | ||
160 | if (need_layout < 0) | |
d003af55 | 161 | einfo (_("%X%P: .eh_frame/.stab edit: %E\n")); |
75938853 | 162 | else |
d871d478 | 163 | ldelf_map_segments (need_layout); |
73d074b4 | 164 | } |
41392f03 AM |
165 | EOF |
166 | fi | |
167 | ||
168 | if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then | |
92b93329 | 169 | fragment <<EOF |
252b5132 RH |
170 | |
171 | static char * | |
0c7a8e5a | 172 | gld${EMULATION_NAME}_get_script (int *isfile) |
252b5132 RH |
173 | EOF |
174 | ||
7225345d | 175 | if test x"$COMPILE_IN" = xyes |
252b5132 RH |
176 | then |
177 | # Scripts compiled in. | |
178 | ||
179 | # sed commands to quote an ld script as a C string. | |
597e2591 | 180 | sc="-f stringify.sed" |
252b5132 | 181 | |
92b93329 | 182 | fragment <<EOF |
60bcf0fa | 183 | { |
252b5132 RH |
184 | *isfile = 0; |
185 | ||
0e1862bb | 186 | if (bfd_link_relocatable (&link_info) && config.build_constructors) |
597e2591 | 187 | return |
252b5132 | 188 | EOF |
afd7a018 | 189 | sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c |
0e1862bb | 190 | echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c |
afd7a018 AM |
191 | sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c |
192 | echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c | |
193 | sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c | |
61585df2 | 194 | if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then : ; else |
afd7a018 AM |
195 | echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c |
196 | sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c | |
db6751f2 | 197 | fi |
36af4a4e JJ |
198 | if test -n "$GENERATE_PIE_SCRIPT" ; then |
199 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then | |
0e1862bb L |
200 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c |
201 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
47acac12 L |
202 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c |
203 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c | |
204 | sed $sc ldscripts/${EMULATION_NAME}.xdwe >> e${EMULATION_NAME}.c | |
205 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c | |
206 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
0e1862bb | 207 | echo ' && link_info.relro' >> e${EMULATION_NAME}.c |
fbfca19e | 208 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c |
afd7a018 | 209 | sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c |
a3813728 AK |
210 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
211 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c | |
212 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
213 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c | |
214 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
215 | sed $sc ldscripts/${EMULATION_NAME}.xdceo >> e${EMULATION_NAME}.c | |
216 | fi | |
0e1862bb | 217 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c |
47acac12 L |
218 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c |
219 | echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c | |
220 | sed $sc ldscripts/${EMULATION_NAME}.xdce >> e${EMULATION_NAME}.c | |
a3813728 AK |
221 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
222 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c | |
223 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
224 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
225 | sed $sc ldscripts/${EMULATION_NAME}.xdco >> e${EMULATION_NAME}.c | |
226 | fi | |
47acac12 | 227 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c |
0e1862bb | 228 | echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c |
afd7a018 | 229 | sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c |
a3813728 AK |
230 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
231 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c | |
232 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c | |
233 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
234 | sed $sc ldscripts/${EMULATION_NAME}.xdeo >> e${EMULATION_NAME}.c | |
235 | fi | |
36af4a4e | 236 | fi |
47acac12 L |
237 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c |
238 | echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c | |
239 | sed $sc ldscripts/${EMULATION_NAME}.xde >> e${EMULATION_NAME}.c | |
a3813728 AK |
240 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
241 | echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c | |
242 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
243 | sed $sc ldscripts/${EMULATION_NAME}.xdo >> e${EMULATION_NAME}.c | |
244 | fi | |
0e1862bb | 245 | echo ' ; else if (bfd_link_pie (&link_info)) return' >> e${EMULATION_NAME}.c |
afd7a018 | 246 | sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c |
36af4a4e | 247 | fi |
252b5132 | 248 | if test -n "$GENERATE_SHLIB_SCRIPT" ; then |
82434356 | 249 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then |
fb24d531 L |
250 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c |
251 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
47acac12 L |
252 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c |
253 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c | |
254 | sed $sc ldscripts/${EMULATION_NAME}.xswe >> e${EMULATION_NAME}.c | |
255 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c | |
256 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
fb24d531 | 257 | echo ' && link_info.relro' >> e${EMULATION_NAME}.c |
fbfca19e | 258 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c |
afd7a018 | 259 | sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c |
a3813728 AK |
260 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
261 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c | |
262 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
263 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c | |
264 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
265 | sed $sc ldscripts/${EMULATION_NAME}.xsceo >> e${EMULATION_NAME}.c | |
266 | fi | |
fb24d531 | 267 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c |
47acac12 L |
268 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c |
269 | echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c | |
270 | sed $sc ldscripts/${EMULATION_NAME}.xsce >> e${EMULATION_NAME}.c | |
a3813728 AK |
271 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
272 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c | |
273 | echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c | |
274 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
275 | sed $sc ldscripts/${EMULATION_NAME}.xsco >> e${EMULATION_NAME}.c | |
276 | fi | |
47acac12 | 277 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c |
fb24d531 | 278 | echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c |
afd7a018 | 279 | sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c |
a3813728 AK |
280 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
281 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c | |
282 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c | |
283 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
284 | sed $sc ldscripts/${EMULATION_NAME}.xseo >> e${EMULATION_NAME}.c | |
285 | fi | |
82434356 | 286 | fi |
47acac12 L |
287 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c |
288 | echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c | |
289 | sed $sc ldscripts/${EMULATION_NAME}.xse >> e${EMULATION_NAME}.c | |
a3813728 AK |
290 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
291 | echo ' ; else if (bfd_link_dll (&link_info)' >> e${EMULATION_NAME}.c | |
292 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
293 | sed $sc ldscripts/${EMULATION_NAME}.xso >> e${EMULATION_NAME}.c | |
294 | fi | |
0e1862bb | 295 | echo ' ; else if (bfd_link_dll (&link_info)) return' >> e${EMULATION_NAME}.c |
afd7a018 | 296 | sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c |
252b5132 | 297 | fi |
82434356 | 298 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then |
fb24d531 | 299 | echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c |
47acac12 L |
300 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c |
301 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c | |
302 | sed $sc ldscripts/${EMULATION_NAME}.xwe >> e${EMULATION_NAME}.c | |
303 | echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c | |
fb24d531 | 304 | echo ' && link_info.relro' >> e${EMULATION_NAME}.c |
fbfca19e | 305 | echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c |
afd7a018 | 306 | sed $sc ldscripts/${EMULATION_NAME}.xw >> e${EMULATION_NAME}.c |
a3813728 AK |
307 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
308 | echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c | |
309 | echo ' && link_info.separate_code' >> e${EMULATION_NAME}.c | |
310 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
311 | sed $sc ldscripts/${EMULATION_NAME}.xceo >> e${EMULATION_NAME}.c | |
312 | fi | |
47acac12 L |
313 | echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c |
314 | echo ' && link_info.separate_code) return' >> e${EMULATION_NAME}.c | |
315 | sed $sc ldscripts/${EMULATION_NAME}.xce >> e${EMULATION_NAME}.c | |
a3813728 AK |
316 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
317 | echo ' ; else if (link_info.combreloc' >> e${EMULATION_NAME}.c | |
318 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
319 | sed $sc ldscripts/${EMULATION_NAME}.xco >> e${EMULATION_NAME}.c | |
320 | fi | |
afd7a018 AM |
321 | echo ' ; else if (link_info.combreloc) return' >> e${EMULATION_NAME}.c |
322 | sed $sc ldscripts/${EMULATION_NAME}.xc >> e${EMULATION_NAME}.c | |
82434356 | 323 | fi |
a3813728 AK |
324 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
325 | echo ' ; else if (link_info.separate_code' >> e${EMULATION_NAME}.c | |
326 | echo ' && link_info.relro) return' >> e${EMULATION_NAME}.c | |
327 | sed $sc ldscripts/${EMULATION_NAME}.xeo >> e${EMULATION_NAME}.c | |
328 | fi | |
329 | echo ' ; else if (link_info.separate_code) return' >> e${EMULATION_NAME}.c | |
47acac12 | 330 | sed $sc ldscripts/${EMULATION_NAME}.xe >> e${EMULATION_NAME}.c |
a3813728 AK |
331 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
332 | echo ' ; else if (link_info.relro) return' >> e${EMULATION_NAME}.c | |
333 | sed $sc ldscripts/${EMULATION_NAME}.xo >> e${EMULATION_NAME}.c | |
334 | fi | |
afd7a018 AM |
335 | echo ' ; else return' >> e${EMULATION_NAME}.c |
336 | sed $sc ldscripts/${EMULATION_NAME}.x >> e${EMULATION_NAME}.c | |
337 | echo '; }' >> e${EMULATION_NAME}.c | |
252b5132 RH |
338 | |
339 | else | |
340 | # Scripts read from the filesystem. | |
341 | ||
92b93329 | 342 | fragment <<EOF |
60bcf0fa | 343 | { |
252b5132 RH |
344 | *isfile = 1; |
345 | ||
0e1862bb | 346 | if (bfd_link_relocatable (&link_info) && config.build_constructors) |
252b5132 | 347 | return "ldscripts/${EMULATION_NAME}.xu"; |
0e1862bb | 348 | else if (bfd_link_relocatable (&link_info)) |
252b5132 RH |
349 | return "ldscripts/${EMULATION_NAME}.xr"; |
350 | else if (!config.text_read_only) | |
351 | return "ldscripts/${EMULATION_NAME}.xbn"; | |
a060b769 AM |
352 | EOF |
353 | if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then : | |
354 | else | |
92b93329 | 355 | fragment <<EOF |
252b5132 RH |
356 | else if (!config.magic_demand_paged) |
357 | return "ldscripts/${EMULATION_NAME}.xn"; | |
a060b769 AM |
358 | EOF |
359 | fi | |
36af4a4e JJ |
360 | if test -n "$GENERATE_PIE_SCRIPT" ; then |
361 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then | |
92b93329 | 362 | fragment <<EOF |
0e1862bb L |
363 | else if (bfd_link_pie (&link_info) |
364 | && link_info.combreloc | |
365 | && link_info.relro | |
366 | && (link_info.flags & DF_BIND_NOW)) | |
47acac12 L |
367 | { |
368 | if (link_info.separate_code) | |
369 | return "ldscripts/${EMULATION_NAME}.xdwe"; | |
370 | else | |
371 | return "ldscripts/${EMULATION_NAME}.xdw"; | |
372 | } | |
a3813728 AK |
373 | EOF |
374 | if test -n "$GENERATE_RELRO_SCRIPT" ; then | |
375 | fragment <<EOF | |
376 | else if (bfd_link_pie (&link_info) | |
377 | && link_info.combreloc | |
378 | && link_info.relro) | |
379 | { | |
380 | if (link_info.separate_code) | |
381 | return "ldscripts/${EMULATION_NAME}.xdceo"; | |
382 | else | |
383 | return "ldscripts/${EMULATION_NAME}.xdco"; | |
384 | } | |
385 | EOF | |
386 | fi | |
387 | fragment <<EOF | |
0e1862bb L |
388 | else if (bfd_link_pie (&link_info) |
389 | && link_info.combreloc) | |
47acac12 L |
390 | { |
391 | if (link_info.separate_code) | |
392 | return "ldscripts/${EMULATION_NAME}.xdce"; | |
393 | else | |
394 | return "ldscripts/${EMULATION_NAME}.xdc"; | |
395 | } | |
36af4a4e JJ |
396 | EOF |
397 | fi | |
a3813728 AK |
398 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
399 | fragment <<EOF | |
400 | else if (bfd_link_pie (&link_info) | |
401 | && link_info.relro) | |
402 | { | |
403 | if (link_info.separate_code) | |
404 | return "ldscripts/${EMULATION_NAME}.xdeo"; | |
405 | else | |
406 | return "ldscripts/${EMULATION_NAME}.xdo"; | |
407 | } | |
408 | EOF | |
409 | fi | |
92b93329 | 410 | fragment <<EOF |
0e1862bb | 411 | else if (bfd_link_pie (&link_info)) |
47acac12 L |
412 | { |
413 | if (link_info.separate_code) | |
414 | return "ldscripts/${EMULATION_NAME}.xde"; | |
415 | else | |
416 | return "ldscripts/${EMULATION_NAME}.xd"; | |
417 | } | |
36af4a4e JJ |
418 | EOF |
419 | fi | |
a060b769 AM |
420 | if test -n "$GENERATE_SHLIB_SCRIPT" ; then |
421 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then | |
92b93329 | 422 | fragment <<EOF |
0e1862bb | 423 | else if (bfd_link_dll (&link_info) && link_info.combreloc |
fbfca19e | 424 | && link_info.relro && (link_info.flags & DF_BIND_NOW)) |
47acac12 L |
425 | { |
426 | if (link_info.separate_code) | |
427 | return "ldscripts/${EMULATION_NAME}.xswe"; | |
428 | else | |
429 | return "ldscripts/${EMULATION_NAME}.xsw"; | |
430 | } | |
a3813728 AK |
431 | EOF |
432 | if test -n "$GENERATE_RELRO_SCRIPT" ; then | |
433 | fragment <<EOF | |
434 | else if (bfd_link_dll (&link_info) | |
435 | && link_info.combreloc | |
436 | && link_info.relro) | |
437 | { | |
438 | if (link_info.separate_code) | |
439 | return "ldscripts/${EMULATION_NAME}.xsceo"; | |
440 | else | |
441 | return "ldscripts/${EMULATION_NAME}.xsco"; | |
442 | } | |
443 | EOF | |
444 | fi | |
445 | fragment <<EOF | |
0e1862bb | 446 | else if (bfd_link_dll (&link_info) && link_info.combreloc) |
47acac12 L |
447 | { |
448 | if (link_info.separate_code) | |
449 | return "ldscripts/${EMULATION_NAME}.xsce"; | |
450 | else | |
451 | return "ldscripts/${EMULATION_NAME}.xsc"; | |
452 | } | |
a060b769 AM |
453 | EOF |
454 | fi | |
a3813728 AK |
455 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
456 | fragment <<EOF | |
457 | else if (bfd_link_dll (&link_info) | |
458 | && link_info.relro) | |
459 | { | |
460 | if (link_info.separate_code) | |
461 | return "ldscripts/${EMULATION_NAME}.xseo"; | |
462 | else | |
463 | return "ldscripts/${EMULATION_NAME}.xso"; | |
464 | } | |
465 | EOF | |
466 | fi | |
92b93329 | 467 | fragment <<EOF |
0e1862bb | 468 | else if (bfd_link_dll (&link_info)) |
47acac12 L |
469 | { |
470 | if (link_info.separate_code) | |
471 | return "ldscripts/${EMULATION_NAME}.xse"; | |
472 | else | |
473 | return "ldscripts/${EMULATION_NAME}.xs"; | |
474 | } | |
a060b769 AM |
475 | EOF |
476 | fi | |
477 | if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then | |
92b93329 | 478 | fragment <<EOF |
8c37241b | 479 | else if (link_info.combreloc && link_info.relro |
fbfca19e | 480 | && (link_info.flags & DF_BIND_NOW)) |
47acac12 L |
481 | { |
482 | if (link_info.separate_code) | |
483 | return "ldscripts/${EMULATION_NAME}.xwe"; | |
484 | else | |
485 | return "ldscripts/${EMULATION_NAME}.xw"; | |
486 | } | |
a3813728 AK |
487 | EOF |
488 | if test -n "$GENERATE_RELRO_SCRIPT" ; then | |
489 | fragment <<EOF | |
490 | else if (link_info.combreloc | |
491 | && link_info.relro) | |
492 | { | |
493 | if (link_info.separate_code) | |
494 | return "ldscripts/${EMULATION_NAME}.xceo"; | |
495 | else | |
496 | return "ldscripts/${EMULATION_NAME}.xco"; | |
497 | } | |
498 | EOF | |
499 | fi | |
500 | fragment <<EOF | |
a060b769 | 501 | else if (link_info.combreloc) |
47acac12 L |
502 | { |
503 | if (link_info.separate_code) | |
504 | return "ldscripts/${EMULATION_NAME}.xce"; | |
505 | else | |
506 | return "ldscripts/${EMULATION_NAME}.xc"; | |
507 | } | |
a060b769 AM |
508 | EOF |
509 | fi | |
a3813728 AK |
510 | if test -n "$GENERATE_RELRO_SCRIPT" ; then |
511 | fragment <<EOF | |
512 | else if (link_info.relro) | |
513 | { | |
514 | if (link_info.separate_code) | |
515 | return "ldscripts/${EMULATION_NAME}.xeo"; | |
516 | else | |
517 | return "ldscripts/${EMULATION_NAME}.xo"; | |
518 | } | |
519 | EOF | |
520 | fi | |
92b93329 | 521 | fragment <<EOF |
252b5132 | 522 | else |
47acac12 L |
523 | { |
524 | if (link_info.separate_code) | |
525 | return "ldscripts/${EMULATION_NAME}.xe"; | |
526 | else | |
527 | return "ldscripts/${EMULATION_NAME}.x"; | |
528 | } | |
252b5132 | 529 | } |
252b5132 | 530 | |
3b108066 | 531 | EOF |
41392f03 AM |
532 | fi |
533 | fi | |
3b108066 | 534 | |
e0ee487b | 535 | if test -n "$PARSE_AND_LIST_PROLOGUE" ; then |
92b93329 | 536 | fragment <<EOF |
e0ee487b L |
537 | $PARSE_AND_LIST_PROLOGUE |
538 | EOF | |
539 | fi | |
540 | ||
92b93329 | 541 | fragment <<EOF |
e0ee487b | 542 | |
29063f8b NC |
543 | enum elf_options |
544 | { | |
545 | OPTION_DISABLE_NEW_DTAGS = 400, | |
546 | OPTION_ENABLE_NEW_DTAGS, | |
547 | OPTION_GROUP, | |
548 | OPTION_EH_FRAME_HDR, | |
549 | OPTION_NO_EH_FRAME_HDR, | |
550 | OPTION_EXCLUDE_LIBS, | |
551 | OPTION_HASH_STYLE, | |
552 | OPTION_BUILD_ID, | |
553 | OPTION_AUDIT, | |
554 | OPTION_COMPRESS_DEBUG | |
555 | }; | |
e13629bc | 556 | |
3bcf5557 | 557 | static void |
0c7a8e5a AM |
558 | gld${EMULATION_NAME}_add_options |
559 | (int ns, char **shortopts, int nl, struct option **longopts, | |
560 | int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED) | |
e0ee487b | 561 | { |
fb42df5e AM |
562 | EOF |
563 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then | |
564 | fragment <<EOF | |
7ee314fa | 565 | static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:P:"; |
fb42df5e AM |
566 | EOF |
567 | else | |
568 | fragment <<EOF | |
569 | static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:"; | |
570 | EOF | |
571 | fi | |
572 | fragment <<EOF | |
3bcf5557 | 573 | static const struct option xtra_long[] = { |
fb42df5e AM |
574 | EOF |
575 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then | |
576 | fragment <<EOF | |
7ee314fa | 577 | {"audit", required_argument, NULL, OPTION_AUDIT}, |
fb42df5e AM |
578 | {"Bgroup", no_argument, NULL, OPTION_GROUP}, |
579 | EOF | |
580 | fi | |
581 | fragment <<EOF | |
582 | {"build-id", optional_argument, NULL, OPTION_BUILD_ID}, | |
0ce398f1 | 583 | {"compress-debug-sections", required_argument, NULL, OPTION_COMPRESS_DEBUG}, |
e0ee487b | 584 | EOF |
e0ee487b | 585 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then |
92b93329 | 586 | fragment <<EOF |
fb42df5e | 587 | {"depaudit", required_argument, NULL, 'P'}, |
3bcf5557 AM |
588 | {"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS}, |
589 | {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS}, | |
590 | {"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR}, | |
29063f8b | 591 | {"no-eh-frame-hdr", no_argument, NULL, OPTION_NO_EH_FRAME_HDR}, |
b58f81ae | 592 | {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS}, |
fdc90cb4 | 593 | {"hash-style", required_argument, NULL, OPTION_HASH_STYLE}, |
e0ee487b L |
594 | EOF |
595 | fi | |
e0ee487b | 596 | if test -n "$PARSE_AND_LIST_LONGOPTS" ; then |
92b93329 | 597 | fragment <<EOF |
3bcf5557 | 598 | $PARSE_AND_LIST_LONGOPTS |
e0ee487b L |
599 | EOF |
600 | fi | |
92b93329 | 601 | fragment <<EOF |
3bcf5557 AM |
602 | {NULL, no_argument, NULL, 0} |
603 | }; | |
604 | ||
605 | *shortopts = (char *) xrealloc (*shortopts, ns + sizeof (xtra_short)); | |
606 | memcpy (*shortopts + ns, &xtra_short, sizeof (xtra_short)); | |
607 | *longopts = (struct option *) | |
608 | xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long)); | |
609 | memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long)); | |
610 | } | |
04925e1e | 611 | |
24382dca | 612 | #define DEFAULT_BUILD_ID_STYLE "sha1" |
c0065db7 | 613 | |
3bcf5557 | 614 | static bfd_boolean |
0c7a8e5a | 615 | gld${EMULATION_NAME}_handle_option (int optc) |
e0ee487b | 616 | { |
e0ee487b L |
617 | switch (optc) |
618 | { | |
619 | default: | |
3bcf5557 | 620 | return FALSE; |
6c1439be | 621 | |
c0065db7 | 622 | case OPTION_BUILD_ID: |
5e2ab612 AM |
623 | free ((char *) ldelf_emit_note_gnu_build_id); |
624 | ldelf_emit_note_gnu_build_id = NULL; | |
c0065db7 RM |
625 | if (optarg == NULL) |
626 | optarg = DEFAULT_BUILD_ID_STYLE; | |
627 | if (strcmp (optarg, "none")) | |
d871d478 | 628 | ldelf_emit_note_gnu_build_id = xstrdup (optarg); |
c0065db7 | 629 | break; |
fb42df5e | 630 | |
0ce398f1 L |
631 | case OPTION_COMPRESS_DEBUG: |
632 | if (strcasecmp (optarg, "none") == 0) | |
633 | link_info.compress_debug = COMPRESS_DEBUG_NONE; | |
634 | else if (strcasecmp (optarg, "zlib") == 0) | |
19a7fe52 | 635 | link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; |
0ce398f1 L |
636 | else if (strcasecmp (optarg, "zlib-gnu") == 0) |
637 | link_info.compress_debug = COMPRESS_DEBUG_GNU_ZLIB; | |
638 | else if (strcasecmp (optarg, "zlib-gabi") == 0) | |
639 | link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB; | |
640 | else | |
df5f2391 | 641 | einfo (_("%F%P: invalid --compress-debug-sections option: \`%s'\n"), |
0ce398f1 L |
642 | optarg); |
643 | break; | |
fb42df5e AM |
644 | EOF |
645 | ||
646 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then | |
647 | fragment <<EOF | |
7ee314fa | 648 | case OPTION_AUDIT: |
d871d478 | 649 | ldelf_append_to_separated_string (&audit, optarg); |
7ee314fa | 650 | break; |
fb42df5e | 651 | |
7ee314fa | 652 | case 'P': |
d871d478 | 653 | ldelf_append_to_separated_string (&depaudit, optarg); |
7ee314fa | 654 | break; |
c0065db7 | 655 | |
6c1439be | 656 | case OPTION_DISABLE_NEW_DTAGS: |
b34976b6 | 657 | link_info.new_dtags = FALSE; |
6c1439be L |
658 | break; |
659 | ||
660 | case OPTION_ENABLE_NEW_DTAGS: | |
b34976b6 | 661 | link_info.new_dtags = TRUE; |
6c1439be L |
662 | break; |
663 | ||
65765700 | 664 | case OPTION_EH_FRAME_HDR: |
2f0c68f2 | 665 | link_info.eh_frame_hdr_type = DWARF2_EH_HDR; |
65765700 JJ |
666 | break; |
667 | ||
29063f8b NC |
668 | case OPTION_NO_EH_FRAME_HDR: |
669 | link_info.eh_frame_hdr_type = 0; | |
670 | break; | |
671 | ||
a1ab1d2a UD |
672 | case OPTION_GROUP: |
673 | link_info.flags_1 |= (bfd_vma) DF_1_GROUP; | |
674 | /* Groups must be self-contained. */ | |
95a51568 FS |
675 | link_info.unresolved_syms_in_objects = RM_DIAGNOSE; |
676 | link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE; | |
a1ab1d2a UD |
677 | break; |
678 | ||
b58f81ae DJ |
679 | case OPTION_EXCLUDE_LIBS: |
680 | add_excluded_libs (optarg); | |
681 | break; | |
682 | ||
fdc90cb4 JJ |
683 | case OPTION_HASH_STYLE: |
684 | link_info.emit_hash = FALSE; | |
685 | link_info.emit_gnu_hash = FALSE; | |
686 | if (strcmp (optarg, "sysv") == 0) | |
687 | link_info.emit_hash = TRUE; | |
688 | else if (strcmp (optarg, "gnu") == 0) | |
689 | link_info.emit_gnu_hash = TRUE; | |
690 | else if (strcmp (optarg, "both") == 0) | |
691 | { | |
692 | link_info.emit_hash = TRUE; | |
693 | link_info.emit_gnu_hash = TRUE; | |
694 | } | |
695 | else | |
df5f2391 | 696 | einfo (_("%F%P: invalid hash style \`%s'\n"), optarg); |
fdc90cb4 JJ |
697 | break; |
698 | ||
fb42df5e AM |
699 | EOF |
700 | fi | |
701 | fragment <<EOF | |
e0ee487b | 702 | case 'z': |
fb42df5e | 703 | if (strcmp (optarg, "defs") == 0) |
95a51568 | 704 | link_info.unresolved_syms_in_objects = RM_DIAGNOSE; |
97a232d7 NC |
705 | else if (strcmp (optarg, "undefs") == 0) |
706 | link_info.unresolved_syms_in_objects = RM_IGNORE; | |
fb42df5e AM |
707 | else if (strcmp (optarg, "muldefs") == 0) |
708 | link_info.allow_multiple_definition = TRUE; | |
709 | else if (CONST_STRNEQ (optarg, "max-page-size=")) | |
710 | { | |
711 | char *end; | |
712 | ||
713 | config.maxpagesize = strtoul (optarg + 14, &end, 0); | |
714 | if (*end || (config.maxpagesize & (config.maxpagesize - 1)) != 0) | |
eca4b721 | 715 | einfo (_("%F%P: invalid maximum page size \`%s'\n"), |
fb42df5e AM |
716 | optarg + 14); |
717 | } | |
718 | else if (CONST_STRNEQ (optarg, "common-page-size=")) | |
719 | { | |
720 | char *end; | |
721 | config.commonpagesize = strtoul (optarg + 17, &end, 0); | |
722 | if (*end | |
723 | || (config.commonpagesize & (config.commonpagesize - 1)) != 0) | |
df5f2391 | 724 | einfo (_("%F%P: invalid common page size \`%s'\n"), |
fb42df5e AM |
725 | optarg + 17); |
726 | } | |
04c3a755 NS |
727 | else if (CONST_STRNEQ (optarg, "stack-size=")) |
728 | { | |
729 | char *end; | |
730 | link_info.stacksize = strtoul (optarg + 11, &end, 0); | |
731 | if (*end || link_info.stacksize < 0) | |
df5f2391 | 732 | einfo (_("%F%P: invalid stack size \`%s'\n"), optarg + 11); |
04c3a755 NS |
733 | if (!link_info.stacksize) |
734 | /* Use -1 for explicit no-stack, because zero means | |
735 | 'default'. */ | |
736 | link_info.stacksize = -1; | |
737 | } | |
fb42df5e AM |
738 | else if (strcmp (optarg, "execstack") == 0) |
739 | { | |
740 | link_info.execstack = TRUE; | |
741 | link_info.noexecstack = FALSE; | |
742 | } | |
743 | else if (strcmp (optarg, "noexecstack") == 0) | |
744 | { | |
745 | link_info.noexecstack = TRUE; | |
746 | link_info.execstack = FALSE; | |
747 | } | |
93ab9c0d NC |
748 | else if (strcmp (optarg, "globalaudit") == 0) |
749 | { | |
750 | link_info.flags_1 |= DF_1_GLOBAUDIT; | |
751 | } | |
fb42df5e | 752 | EOF |
d258b828 | 753 | |
fb42df5e AM |
754 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then |
755 | fragment <<EOF | |
b039ef04 L |
756 | else if (strcmp (optarg, "global") == 0) |
757 | link_info.flags_1 |= (bfd_vma) DF_1_GLOBAL; | |
fb42df5e | 758 | else if (strcmp (optarg, "initfirst") == 0) |
e0ee487b L |
759 | link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST; |
760 | else if (strcmp (optarg, "interpose") == 0) | |
761 | link_info.flags_1 |= (bfd_vma) DF_1_INTERPOSE; | |
762 | else if (strcmp (optarg, "loadfltr") == 0) | |
763 | link_info.flags_1 |= (bfd_vma) DF_1_LOADFLTR; | |
764 | else if (strcmp (optarg, "nodefaultlib") == 0) | |
765 | link_info.flags_1 |= (bfd_vma) DF_1_NODEFLIB; | |
766 | else if (strcmp (optarg, "nodelete") == 0) | |
767 | link_info.flags_1 |= (bfd_vma) DF_1_NODELETE; | |
768 | else if (strcmp (optarg, "nodlopen") == 0) | |
769 | link_info.flags_1 |= (bfd_vma) DF_1_NOOPEN; | |
770 | else if (strcmp (optarg, "nodump") == 0) | |
771 | link_info.flags_1 |= (bfd_vma) DF_1_NODUMP; | |
772 | else if (strcmp (optarg, "now") == 0) | |
773 | { | |
774 | link_info.flags |= (bfd_vma) DF_BIND_NOW; | |
775 | link_info.flags_1 |= (bfd_vma) DF_1_NOW; | |
776 | } | |
5fa222e4 AM |
777 | else if (strcmp (optarg, "lazy") == 0) |
778 | { | |
779 | link_info.flags &= ~(bfd_vma) DF_BIND_NOW; | |
780 | link_info.flags_1 &= ~(bfd_vma) DF_1_NOW; | |
781 | } | |
e0ee487b L |
782 | else if (strcmp (optarg, "origin") == 0) |
783 | { | |
784 | link_info.flags |= (bfd_vma) DF_ORIGIN; | |
785 | link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN; | |
786 | } | |
db6751f2 | 787 | else if (strcmp (optarg, "combreloc") == 0) |
b34976b6 | 788 | link_info.combreloc = TRUE; |
db6751f2 | 789 | else if (strcmp (optarg, "nocombreloc") == 0) |
b34976b6 | 790 | link_info.combreloc = FALSE; |
8bd621d8 | 791 | else if (strcmp (optarg, "nocopyreloc") == 0) |
0c7a8e5a | 792 | link_info.nocopyreloc = TRUE; |
8c37241b JJ |
793 | else if (strcmp (optarg, "relro") == 0) |
794 | link_info.relro = TRUE; | |
795 | else if (strcmp (optarg, "norelro") == 0) | |
796 | link_info.relro = FALSE; | |
47acac12 L |
797 | else if (strcmp (optarg, "separate-code") == 0) |
798 | link_info.separate_code = TRUE; | |
799 | else if (strcmp (optarg, "noseparate-code") == 0) | |
800 | link_info.separate_code = FALSE; | |
b8871f35 L |
801 | else if (strcmp (optarg, "common") == 0) |
802 | link_info.elf_stt_common = elf_stt_common; | |
803 | else if (strcmp (optarg, "nocommon") == 0) | |
804 | link_info.elf_stt_common = no_elf_stt_common; | |
c192a133 | 805 | else if (strcmp (optarg, "text") == 0) |
a6dbf402 | 806 | link_info.textrel_check = textrel_check_error; |
c192a133 | 807 | else if (strcmp (optarg, "notext") == 0) |
a6dbf402 | 808 | link_info.textrel_check = textrel_check_none; |
c192a133 | 809 | else if (strcmp (optarg, "textoff") == 0) |
a6dbf402 | 810 | link_info.textrel_check = textrel_check_none; |
88b882e9 | 811 | EOF |
fb42df5e | 812 | fi |
88b882e9 | 813 | |
eba27bd7 L |
814 | if test -n "$PARSE_AND_LIST_ARGS_CASE_Z" ; then |
815 | fragment <<EOF | |
816 | $PARSE_AND_LIST_ARGS_CASE_Z | |
817 | EOF | |
818 | fi | |
819 | ||
92b93329 | 820 | fragment <<EOF |
fb42df5e | 821 | else |
df5f2391 | 822 | einfo (_("%P: warning: -z %s ignored\n"), optarg); |
6c1439be | 823 | break; |
e0ee487b | 824 | EOF |
e0ee487b L |
825 | |
826 | if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then | |
92b93329 | 827 | fragment <<EOF |
e0ee487b L |
828 | $PARSE_AND_LIST_ARGS_CASES |
829 | EOF | |
830 | fi | |
831 | ||
92b93329 | 832 | fragment <<EOF |
e0ee487b L |
833 | } |
834 | ||
3bcf5557 | 835 | return TRUE; |
e0ee487b L |
836 | } |
837 | ||
41392f03 | 838 | EOF |
41392f03 | 839 | |
4b209b22 | 840 | if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then |
c58212ea | 841 | gld_list_options="gld${EMULATION_NAME}_list_options" |
eba27bd7 | 842 | if test -n "$PARSE_AND_LIST_OPTIONS"; then |
92b93329 | 843 | fragment <<EOF |
41392f03 | 844 | |
e0ee487b | 845 | static void |
0c7a8e5a | 846 | gld${EMULATION_NAME}_list_options (FILE * file) |
e0ee487b | 847 | { |
fb42df5e | 848 | EOF |
e0ee487b L |
849 | |
850 | if test -n "$PARSE_AND_LIST_OPTIONS" ; then | |
92b93329 | 851 | fragment <<EOF |
e0ee487b L |
852 | $PARSE_AND_LIST_OPTIONS |
853 | EOF | |
854 | fi | |
855 | ||
92b93329 | 856 | fragment <<EOF |
e0ee487b L |
857 | } |
858 | EOF | |
c58212ea L |
859 | else |
860 | gld_list_options="NULL" | |
861 | fi | |
e0ee487b L |
862 | |
863 | if test -n "$PARSE_AND_LIST_EPILOGUE" ; then | |
92b93329 | 864 | fragment <<EOF |
e0ee487b L |
865 | $PARSE_AND_LIST_EPILOGUE |
866 | EOF | |
867 | fi | |
41392f03 | 868 | fi |
e0ee487b | 869 | |
92b93329 | 870 | fragment <<EOF |
252b5132 | 871 | |
60bcf0fa | 872 | struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = |
252b5132 | 873 | { |
41392f03 AM |
874 | ${LDEMUL_BEFORE_PARSE-gld${EMULATION_NAME}_before_parse}, |
875 | ${LDEMUL_SYSLIB-syslib_default}, | |
876 | ${LDEMUL_HLL-hll_default}, | |
d871d478 | 877 | ${LDEMUL_AFTER_PARSE-ldelf_after_parse}, |
41392f03 | 878 | ${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open}, |
5c3261b0 | 879 | ${LDEMUL_AFTER_CHECK_RELOCS-after_check_relocs_default}, |
9b538ba7 | 880 | ${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans}, |
eaeb0a9d | 881 | ${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}, |
41392f03 AM |
882 | ${LDEMUL_SET_OUTPUT_ARCH-set_output_arch_default}, |
883 | ${LDEMUL_CHOOSE_TARGET-ldemul_default_target}, | |
884 | ${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}, | |
885 | ${LDEMUL_GET_SCRIPT-gld${EMULATION_NAME}_get_script}, | |
252b5132 RH |
886 | "${EMULATION_NAME}", |
887 | "${OUTPUT_FORMAT}", | |
eaeb0a9d | 888 | ${LDEMUL_FINISH-finish_default}, |
41392f03 | 889 | ${LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS-NULL}, |
d871d478 AM |
890 | ${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}, |
891 | ${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}, | |
41392f03 | 892 | ${LDEMUL_SET_SYMBOLS-NULL}, |
3bcf5557 AM |
893 | ${LDEMUL_PARSE_ARGS-NULL}, |
894 | gld${EMULATION_NAME}_add_options, | |
895 | gld${EMULATION_NAME}_handle_option, | |
41392f03 | 896 | ${LDEMUL_UNRECOGNIZED_FILE-NULL}, |
c58212ea | 897 | ${LDEMUL_LIST_OPTIONS-${gld_list_options}}, |
d871d478 | 898 | ${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols}, |
41392f03 | 899 | ${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL}, |
7a2f2d82 | 900 | ${LDEMUL_NEW_VERS_PATTERN-NULL}, |
1ff6de03 NA |
901 | ${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}, |
902 | ${LDEMUL_EMIT_CTF_EARLY-NULL}, | |
3edf7b9f DR |
903 | ${LDEMUL_EXAMINE_STRTAB_FOR_CTF-NULL}, |
904 | ${LDEMUL_PRINT_SYMBOL-NULL} | |
252b5132 RH |
905 | }; |
906 | EOF |