Update release readme after making 2.43.1 release
[binutils-gdb.git] / ld / emultempl / elf.em
blob863657e12f5d4b1630f76dfe204c30a64d1b61dc
1 # This shell script emits a C file. -*- C -*-
2 # It does some substitutions.
3 test -z "${ELFSIZE}" && ELFSIZE=32
4 if [ -z "$MACHINE" ]; then
5   OUTPUT_ARCH=${ARCH}
6 else
7   OUTPUT_ARCH=${ARCH}:${MACHINE}
8 fi
9 fragment <<EOF
10 /* This file is is generated by a shell script.  DO NOT EDIT! */
12 /* ${ELFSIZE} bit ELF emulation code for ${EMULATION_NAME}
13    Copyright (C) 1991-2024 Free Software Foundation, Inc.
14    Written by Steve Chamberlain <sac@cygnus.com>
15    ELF support by Ian Lance Taylor <ian@cygnus.com>
17    This file is part of the GNU Binutils.
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.
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.
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.  */
34 #define TARGET_IS_${EMULATION_NAME}
36 #include "sysdep.h"
37 #include "bfd.h"
38 #include "libiberty.h"
39 #include "getopt.h"
40 #include "bfdlink.h"
41 #include "ctf-api.h"
42 #include "ld.h"
43 #include "ldmain.h"
44 #include "ldmisc.h"
45 #include "ldexp.h"
46 #include "ldlang.h"
47 #include "ldfile.h"
48 #include "ldlex.h"
49 #include "ldemul.h"
50 #include <ldgram.h>
51 #include "elf-bfd.h"
52 #include "ldelf.h"
53 #include "ldelfgen.h"
55 /* Declare functions used by various EXTRA_EM_FILEs.  */
56 static void gld${EMULATION_NAME}_before_parse (void);
57 static void gld${EMULATION_NAME}_before_plugin_all_symbols_read
58   (void);
59 static void gld${EMULATION_NAME}_after_open (void);
60 static void gld${EMULATION_NAME}_before_allocation (void);
61 static void gld${EMULATION_NAME}_after_allocation (void);
62 EOF
64 # Import any needed special functions and/or overrides.
66 source_em ${srcdir}/emultempl/elf-generic.em
67 if test -n "$EXTRA_EM_FILE" ; then
68   source_em ${srcdir}/emultempl/${EXTRA_EM_FILE}.em
71 # Functions in this file can be overridden by setting the LDEMUL_* shell
72 # variables.  If the name of the overriding function is the same as is
73 # defined in this file, then don't output this file's version.
74 # If a different overriding name is given then output the standard function
75 # as presumably it is called from the overriding function.
77 if test x"$LDEMUL_BEFORE_PARSE" != xgld"$EMULATION_NAME"_before_parse; then
78 fragment <<EOF
80 static void
81 gld${EMULATION_NAME}_before_parse (void)
83   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
84   input_flags.dynamic = ${DYNAMIC_LINK-true};
85   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
86   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo true ; else echo false ; fi`;
87   link_info.check_relocs_after_open_input = true;
88 EOF
89 if test -n "$COMMONPAGESIZE"; then
90 fragment <<EOF
91   link_info.relro = DEFAULT_LD_Z_RELRO;
92 EOF
94 fragment <<EOF
95   link_info.separate_code = DEFAULT_LD_Z_SEPARATE_CODE;
96   link_info.one_rosegment = DEFAULT_LD_ROSEGMENT;
97   link_info.warn_execstack = DEFAULT_LD_WARN_EXECSTACK;
98   link_info.no_warn_rwx_segments = ! DEFAULT_LD_WARN_RWX_SEGMENTS;
99   link_info.default_execstack = DEFAULT_LD_EXECSTACK;
100   link_info.error_execstack = DEFAULT_LD_ERROR_EXECSTACK;
101   link_info.warn_is_error_for_rwx_segments = DEFAULT_LD_ERROR_RWX_SEGMENTS;
107 fragment <<EOF
109 /* These variables are used to implement target options */
111 static char *audit; /* colon (typically) separated list of libs */
112 static char *depaudit; /* colon (typically) separated list of libs */
116 if test x"$LDEMUL_AFTER_OPEN" != xgld"$EMULATION_NAME"_after_open; then
118   IS_LINUX_TARGET=false
119   IS_FREEBSD_TARGET=false
120   case ${target} in
121     *-*-linux-* | *-*-k*bsd*-* | *-*-gnu*)
122       IS_LINUX_TARGET=true ;;
123     *-*-freebsd* | *-*-dragonfly*)
124       IS_FREEBSD_TARGET=true ;;
125   esac
126   IS_LIBPATH=false
127   if test "x${USE_LIBPATH}" = xyes; then
128     IS_LIBPATH=true
129   fi
130   IS_NATIVE=false
131   if test "x${NATIVE}" = xyes; then
132     IS_NATIVE=true
133   fi
135 fragment <<EOF
137 /* This is called before calling plugin 'all symbols read' hook.  */
139 static void
140 gld${EMULATION_NAME}_before_plugin_all_symbols_read (void)
142   ldelf_before_plugin_all_symbols_read ($IS_LIBPATH, $IS_NATIVE,
143                                         $IS_LINUX_TARGET,
144                                         $IS_FREEBSD_TARGET,
145                                         $ELFSIZE, "$prefix");
148 /* This is called after all the input files have been opened.  */
150 static void
151 gld${EMULATION_NAME}_after_open (void)
153   ldelf_after_open ($IS_LIBPATH, $IS_NATIVE,
154                     $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix");
160 if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation; then
161   if test x"${ELF_INTERPRETER_NAME}" = x; then
162     ELF_INTERPRETER_NAME=NULL
163   fi
164 fragment <<EOF
166 /* This is called after the sections have been attached to output
167    sections, but before any sizes or addresses have been set.  */
169 static void
170 gld${EMULATION_NAME}_before_allocation (void)
172   ldelf_before_allocation (audit, depaudit, ${ELF_INTERPRETER_NAME});
178 if test x"$LDEMUL_AFTER_ALLOCATION" != xgld"$EMULATION_NAME"_after_allocation; then
179 fragment <<EOF
181 static void
182 gld${EMULATION_NAME}_after_allocation (void)
184   int need_layout = bfd_elf_discard_info (link_info.output_bfd, &link_info);
186   if (need_layout < 0)
187     einfo (_("%X%P: .eh_frame/.stab edit: %E\n"));
188   else
189     ldelf_map_segments (need_layout);
194 if test x"$LDEMUL_GET_SCRIPT" != xgld"$EMULATION_NAME"_get_script; then
195 fragment <<EOF
197 static char *
198 gld${EMULATION_NAME}_get_script (int *isfile)
201 if test x"$COMPILE_IN" = xyes
202 then
203 # Scripts compiled in.
205 # sed commands to quote an ld script as a C string.
206 sc="-f ${srcdir}/emultempl/stringify.sed"
208 fragment <<EOF
210   *isfile = 0;
212   if (bfd_link_relocatable (&link_info) && config.build_constructors)
213     return
215 sed $sc ldscripts/${EMULATION_NAME}.xu                  >> e${EMULATION_NAME}.c
217 echo '  ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
218 sed $sc ldscripts/${EMULATION_NAME}.xr                  >> e${EMULATION_NAME}.c
220 echo '  ; else if (!config.text_read_only) return'      >> e${EMULATION_NAME}.c
221 sed $sc ldscripts/${EMULATION_NAME}.xbn                 >> e${EMULATION_NAME}.c
223 if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then : ; else
224   echo '  ; else if (!config.magic_demand_paged) return'        >> e${EMULATION_NAME}.c
225   sed $sc ldscripts/${EMULATION_NAME}.xn                        >> e${EMULATION_NAME}.c
228 if test -n "$GENERATE_PIE_SCRIPT" ; then
229 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
231 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
232 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
233 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
234 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
235 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
236 sed $sc ldscripts/${EMULATION_NAME}.xdwer               >> e${EMULATION_NAME}.c
238 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
239 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
240 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
241 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
242 sed $sc ldscripts/${EMULATION_NAME}.xdwe                >> e${EMULATION_NAME}.c
244 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
245 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
246 echo '             && link_info.relro'                  >> e${EMULATION_NAME}.c
247 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
248 sed $sc ldscripts/${EMULATION_NAME}.xdw                 >> e${EMULATION_NAME}.c
250 if test -n "$GENERATE_RELRO_SCRIPT" ; then
252 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
253 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
254 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
255 echo '             && link_info.one_rosegment'         >> e${EMULATION_NAME}.c
256 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
257 sed $sc ldscripts/${EMULATION_NAME}.xdceor             >> e${EMULATION_NAME}.c
259 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
260 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
261 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
262 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
263 sed $sc ldscripts/${EMULATION_NAME}.xdceo              >> e${EMULATION_NAME}.c
267 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
268 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
269 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
270 echo '             && link_info.combreloc) return'      >> e${EMULATION_NAME}.c
271 sed $sc ldscripts/${EMULATION_NAME}.xdcer               >> e${EMULATION_NAME}.c
273 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
274 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
275 echo '             && link_info.combreloc) return'      >> e${EMULATION_NAME}.c
276 sed $sc ldscripts/${EMULATION_NAME}.xdce                >> e${EMULATION_NAME}.c
278 if test -n "$GENERATE_RELRO_SCRIPT" ; then
280 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
281 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
282 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
283 sed $sc ldscripts/${EMULATION_NAME}.xdco               >> e${EMULATION_NAME}.c
287 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
288 echo '             && link_info.combreloc) return'      >> e${EMULATION_NAME}.c
289 sed $sc ldscripts/${EMULATION_NAME}.xdc                 >> e${EMULATION_NAME}.c
291 if test -n "$GENERATE_RELRO_SCRIPT" ; then
293 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
294 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
295 echo '             && link_info.one_rosegment'         >> e${EMULATION_NAME}.c
296 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
297 sed $sc ldscripts/${EMULATION_NAME}.xdeor              >> e${EMULATION_NAME}.c
299 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
300 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
301 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
302 sed $sc ldscripts/${EMULATION_NAME}.xdeo               >> e${EMULATION_NAME}.c
308 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
309 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
310 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
311 sed $sc ldscripts/${EMULATION_NAME}.xder                >> e${EMULATION_NAME}.c
313 echo '  ; else if (bfd_link_pie (&link_info)'           >> e${EMULATION_NAME}.c
314 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
315 sed $sc ldscripts/${EMULATION_NAME}.xde                 >> e${EMULATION_NAME}.c
317 if test -n "$GENERATE_RELRO_SCRIPT" ; then
319 echo '  ; else if (bfd_link_pie (&link_info)'          >> e${EMULATION_NAME}.c
320 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
321 sed $sc ldscripts/${EMULATION_NAME}.xdo                >> e${EMULATION_NAME}.c
325 echo '  ; else if (bfd_link_pie (&link_info)) return'   >> e${EMULATION_NAME}.c
326 sed $sc ldscripts/${EMULATION_NAME}.xd                  >> e${EMULATION_NAME}.c
329 if test -n "$GENERATE_SHLIB_SCRIPT" ; then
330 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
332 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
333 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
334 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
335 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
336 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
337 sed $sc ldscripts/${EMULATION_NAME}.xswer               >> e${EMULATION_NAME}.c
339 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
340 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
341 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
342 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
343 sed $sc ldscripts/${EMULATION_NAME}.xswe                >> e${EMULATION_NAME}.c
345 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
346 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
347 echo '             && link_info.relro'                  >> e${EMULATION_NAME}.c
348 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
349 sed $sc ldscripts/${EMULATION_NAME}.xsw                 >> e${EMULATION_NAME}.c
351 if test -n "$GENERATE_RELRO_SCRIPT" ; then
353 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
354 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
355 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
356 echo '             && link_info.one_rosegment'         >> e${EMULATION_NAME}.c
357 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
358 sed $sc ldscripts/${EMULATION_NAME}.xsceor             >> e${EMULATION_NAME}.c
360 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
361 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
362 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
363 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
364 sed $sc ldscripts/${EMULATION_NAME}.xsceo              >> e${EMULATION_NAME}.c
368 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
369 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
370 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
371 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
372 sed $sc ldscripts/${EMULATION_NAME}.xscer               >> e${EMULATION_NAME}.c
374 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
375 echo '             && link_info.combreloc'              >> e${EMULATION_NAME}.c
376 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
377 sed $sc ldscripts/${EMULATION_NAME}.xsce                        >> e${EMULATION_NAME}.c
379 if test -n "$GENERATE_RELRO_SCRIPT" ; then
381 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
382 echo '             && link_info.combreloc'             >> e${EMULATION_NAME}.c
383 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
384 sed $sc ldscripts/${EMULATION_NAME}.xsco               >> e${EMULATION_NAME}.c
388 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
389 echo '             && link_info.combreloc) return'      >> e${EMULATION_NAME}.c
390 sed $sc ldscripts/${EMULATION_NAME}.xsc                 >> e${EMULATION_NAME}.c
392 if test -n "$GENERATE_RELRO_SCRIPT" ; then
394 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
395 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
396 echo '             && link_info.one_rosegment'         >> e${EMULATION_NAME}.c
397 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
398 sed $sc ldscripts/${EMULATION_NAME}.xseor              >> e${EMULATION_NAME}.c
400 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
401 echo '             && link_info.separate_code'         >> e${EMULATION_NAME}.c
402 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
403 sed $sc ldscripts/${EMULATION_NAME}.xseo               >> e${EMULATION_NAME}.c
409 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
410 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
411 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
412 sed $sc ldscripts/${EMULATION_NAME}.xser                >> e${EMULATION_NAME}.c
414 echo '  ; else if (bfd_link_dll (&link_info)'           >> e${EMULATION_NAME}.c
415 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
416 sed $sc ldscripts/${EMULATION_NAME}.xse                 >> e${EMULATION_NAME}.c
418 if test -n "$GENERATE_RELRO_SCRIPT" ; then
420 echo '  ; else if (bfd_link_dll (&link_info)'          >> e${EMULATION_NAME}.c
421 echo '             && link_info.relro) return'         >> e${EMULATION_NAME}.c
422 sed $sc ldscripts/${EMULATION_NAME}.xso               >> e${EMULATION_NAME}.c
426 echo '  ; else if (bfd_link_dll (&link_info)) return'   >> e${EMULATION_NAME}.c
427 sed $sc ldscripts/${EMULATION_NAME}.xs                  >> e${EMULATION_NAME}.c
431 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
433 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
434 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
435 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
436 sed $sc ldscripts/${EMULATION_NAME}.xwe                 >> e${EMULATION_NAME}.c
438 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
439 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
440 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
441 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
442 sed $sc ldscripts/${EMULATION_NAME}.xwer                >> e${EMULATION_NAME}.c
444 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
445 echo '             && link_info.relro'                  >> e${EMULATION_NAME}.c
446 echo '             && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
447 sed $sc ldscripts/${EMULATION_NAME}.xw                  >> e${EMULATION_NAME}.c
449 if test -n "$GENERATE_RELRO_SCRIPT" ; then
451 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
452 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
453 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
454 echo '             && link_info.relro) return'          >> e${EMULATION_NAME}.c
455 sed $sc ldscripts/${EMULATION_NAME}.xceor               >> e${EMULATION_NAME}.c
457 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
458 echo '             && link_info.separate_code'          >> e${EMULATION_NAME}.c
459 echo '             && link_info.relro) return'          >> e${EMULATION_NAME}.c
460 sed $sc ldscripts/${EMULATION_NAME}.xceo                >> e${EMULATION_NAME}.c
464 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
465 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
466 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
467 sed $sc ldscripts/${EMULATION_NAME}.xcer                >> e${EMULATION_NAME}.c
469 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
470 echo '             && link_info.separate_code) return'  >> e${EMULATION_NAME}.c
471 sed $sc ldscripts/${EMULATION_NAME}.xce                 >> e${EMULATION_NAME}.c
473 if test -n "$GENERATE_RELRO_SCRIPT" ; then
475 echo '  ; else if (link_info.combreloc'                 >> e${EMULATION_NAME}.c
476 echo '             && link_info.relro) return'          >> e${EMULATION_NAME}.c
477 sed $sc ldscripts/${EMULATION_NAME}.xco                 >> e${EMULATION_NAME}.c
481 echo '  ; else if (link_info.combreloc) return'         >> e${EMULATION_NAME}.c
482 sed $sc ldscripts/${EMULATION_NAME}.xc                  >> e${EMULATION_NAME}.c
486 if test -n "$GENERATE_RELRO_SCRIPT" ; then
488 echo '  ; else if (link_info.separate_code'             >> e${EMULATION_NAME}.c
489 echo '             && link_info.one_rosegment'          >> e${EMULATION_NAME}.c
490 echo '             && link_info.relro) return'          >> e${EMULATION_NAME}.c
491 sed $sc ldscripts/${EMULATION_NAME}.xeor                >> e${EMULATION_NAME}.c
493 echo '  ; else if (link_info.separate_code'             >> e${EMULATION_NAME}.c
494 echo '             && link_info.relro) return'          >> e${EMULATION_NAME}.c
495 sed $sc ldscripts/${EMULATION_NAME}.xeo                 >> e${EMULATION_NAME}.c
499 echo '  ; else if (link_info.separate_code'             >> e${EMULATION_NAME}.c
500 echo '             && link_info.one_rosegment) return'  >> e${EMULATION_NAME}.c
501 sed $sc ldscripts/${EMULATION_NAME}.xer                 >> e${EMULATION_NAME}.c
503 echo '  ; else if (link_info.separate_code) return'     >> e${EMULATION_NAME}.c
504 sed $sc ldscripts/${EMULATION_NAME}.xe                  >> e${EMULATION_NAME}.c
506 if test -n "$GENERATE_RELRO_SCRIPT" ; then
508 echo '  ; else if (link_info.relro) return'             >> e${EMULATION_NAME}.c
509 sed $sc ldscripts/${EMULATION_NAME}.xo                  >> e${EMULATION_NAME}.c
513 echo '  ; else return'                                  >> e${EMULATION_NAME}.c
514 sed $sc ldscripts/${EMULATION_NAME}.x                   >> e${EMULATION_NAME}.c
515 echo '; }'                                              >> e${EMULATION_NAME}.c
517 else
518 # Scripts read from the filesystem.
520 fragment <<EOF
522   *isfile = 1;
524   if (bfd_link_relocatable (&link_info) && config.build_constructors)
525     return "ldscripts/${EMULATION_NAME}.xu";
526   else if (bfd_link_relocatable (&link_info))
527     return "ldscripts/${EMULATION_NAME}.xr";
528   else if (!config.text_read_only)
529     return "ldscripts/${EMULATION_NAME}.xbn";
531 if cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then :
532 else
533 fragment <<EOF
534   else if (!config.magic_demand_paged)
535     return "ldscripts/${EMULATION_NAME}.xn";
538 if test -n "$GENERATE_PIE_SCRIPT" ; then
539 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
540 fragment <<EOF
541   else if (bfd_link_pie (&link_info)
542            && link_info.combreloc
543            && link_info.relro
544            && (link_info.flags & DF_BIND_NOW))
545     {
546       if (link_info.separate_code)
547         {
548           if (link_info.one_rosegment)
549             return "ldscripts/${EMULATION_NAME}.xdwer";
550           else
551             return "ldscripts/${EMULATION_NAME}.xdwe";
552         }
553       else
554         return "ldscripts/${EMULATION_NAME}.xdw";
555     }
557 if test -n "$GENERATE_RELRO_SCRIPT" ; then
558 fragment <<EOF
559   else if (bfd_link_pie (&link_info)
560            && link_info.combreloc
561            && link_info.relro)
562     {
563       if (link_info.separate_code)
564         {
565           if (link_info.one_rosegment)
566             return "ldscripts/${EMULATION_NAME}.xdceor";
567           else
568             return "ldscripts/${EMULATION_NAME}.xdceo";
569         }
570       else
571         return "ldscripts/${EMULATION_NAME}.xdco";
572     }
575 fragment <<EOF
576   else if (bfd_link_pie (&link_info)
577            && link_info.combreloc)
578     {
579       if (link_info.separate_code)
580         {
581           if (link_info.one_rosegment)
582             return "ldscripts/${EMULATION_NAME}.xdcer";
583           else
584             return "ldscripts/${EMULATION_NAME}.xdce";
585         }
586       else
587         return "ldscripts/${EMULATION_NAME}.xdc";
588     }
591 if test -n "$GENERATE_RELRO_SCRIPT" ; then
592 fragment <<EOF
593   else if (bfd_link_pie (&link_info)
594            && link_info.relro)
595     {
596       if (link_info.separate_code)
597         {
598           if (link_info.one_rosegment)
599             return "ldscripts/${EMULATION_NAME}.xdeor";
600           else
601             return "ldscripts/${EMULATION_NAME}.xdeo";
602         }
603       else
604         return "ldscripts/${EMULATION_NAME}.xdo";
605     }
608 fragment <<EOF
609   else if (bfd_link_pie (&link_info))
610     {
611       if (link_info.separate_code)
612         {
613           if (link_info.one_rosegment)
614             return "ldscripts/${EMULATION_NAME}.xder";
615           else
616             return "ldscripts/${EMULATION_NAME}.xde";
617         }
618       else
619         return "ldscripts/${EMULATION_NAME}.xd";
620     }
623 if test -n "$GENERATE_SHLIB_SCRIPT" ; then
624 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
625 fragment <<EOF
626   else if (bfd_link_dll (&link_info) && link_info.combreloc
627            && link_info.relro && (link_info.flags & DF_BIND_NOW))
628     {
629       if (link_info.separate_code)
630         {
631           if (link_info.one_rosegment)
632             return "ldscripts/${EMULATION_NAME}.xswer";
633           else
634             return "ldscripts/${EMULATION_NAME}.xswe";
635         }
636       else
637         return "ldscripts/${EMULATION_NAME}.xsw";
638     }
640 if test -n "$GENERATE_RELRO_SCRIPT" ; then
641 fragment <<EOF
642   else if (bfd_link_dll (&link_info)
643            && link_info.combreloc
644            && link_info.relro)
645     {
646       if (link_info.separate_code)
647         {
648           if (link_info.one_rosegment)
649             return "ldscripts/${EMULATION_NAME}.xsceor";
650           else
651             return "ldscripts/${EMULATION_NAME}.xsceo";
652         }
653       else
654         return "ldscripts/${EMULATION_NAME}.xsco";
655     }
658 fragment <<EOF
659   else if (bfd_link_dll (&link_info) && link_info.combreloc)
660     {
661       if (link_info.separate_code)
662         {
663           if (link_info.one_rosegment)
664             return "ldscripts/${EMULATION_NAME}.xscer";
665           else
666             return "ldscripts/${EMULATION_NAME}.xsce";
667         }
668       else
669         return "ldscripts/${EMULATION_NAME}.xsc";
670     }
673 if test -n "$GENERATE_RELRO_SCRIPT" ; then
674 fragment <<EOF
675   else if (bfd_link_dll (&link_info)
676            && link_info.relro)
677     {
678       if (link_info.separate_code)
679         {
680           if (link_info.one_rosegment)
681             return "ldscripts/${EMULATION_NAME}.xseor";
682           else
683             return "ldscripts/${EMULATION_NAME}.xseo";
684         }
685       else
686         return "ldscripts/${EMULATION_NAME}.xso";
687     }
690 fragment <<EOF
691   else if (bfd_link_dll (&link_info))
692     {
693       if (link_info.separate_code)
694         {
695           if (link_info.one_rosegment)
696             return "ldscripts/${EMULATION_NAME}.xser";
697           else
698             return "ldscripts/${EMULATION_NAME}.xse";
699         }
700       else
701         return "ldscripts/${EMULATION_NAME}.xs";
702     }
705 if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
706 fragment <<EOF
707   else if (link_info.combreloc && link_info.relro
708            && (link_info.flags & DF_BIND_NOW))
709     {
710       if (link_info.separate_code)
711         {
712           if (link_info.one_rosegment)
713             return "ldscripts/${EMULATION_NAME}.xwer";
714           else
715             return "ldscripts/${EMULATION_NAME}.xwe";
716         }
717       else
718         return "ldscripts/${EMULATION_NAME}.xw";
719     }
721 if test -n "$GENERATE_RELRO_SCRIPT" ; then
722 fragment <<EOF
723   else if (link_info.combreloc
724            && link_info.relro)
725     {
726       if (link_info.separate_code)
727         {
728           if (link_info.one_rosegment)
729             return "ldscripts/${EMULATION_NAME}.xceor";
730           else
731             return "ldscripts/${EMULATION_NAME}.xceo";
732         }
733       else
734         return "ldscripts/${EMULATION_NAME}.xco";
735     }
738 fragment <<EOF
739   else if (link_info.combreloc)
740     {
741       if (link_info.separate_code)
742         {
743           if (link_info.one_rosegment)
744             return "ldscripts/${EMULATION_NAME}.xcer";
745           else
746             return "ldscripts/${EMULATION_NAME}.xce";
747         }
748       else
749         return "ldscripts/${EMULATION_NAME}.xc";
750     }
753 if test -n "$GENERATE_RELRO_SCRIPT" ; then
754 fragment <<EOF
755   else if (link_info.relro)
756     {
757       if (link_info.separate_code)
758         {
759           if (link_info.one_rosegment)
760             return "ldscripts/${EMULATION_NAME}.xeor";
761           else
762             return "ldscripts/${EMULATION_NAME}.xeo";
763         }
764       else
765         return "ldscripts/${EMULATION_NAME}.xo";
766     }
769 fragment <<EOF
770   else
771     {
772       if (link_info.separate_code)
773         {
774           if (link_info.one_rosegment)
775             return "ldscripts/${EMULATION_NAME}.xer";
776           else
777             return "ldscripts/${EMULATION_NAME}.xe";
778         }
779       else
780         return "ldscripts/${EMULATION_NAME}.x";
781     }
788 fragment <<EOF
790 static void
791 gld${EMULATION_NAME}_add_options
792   (int ns, char **shortopts, int nl, struct option **longopts,
793    int nrl ATTRIBUTE_UNUSED, struct option **really_longopts ATTRIBUTE_UNUSED)
796 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
797 fragment <<EOF
798   static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:P:";
800 else
801 fragment <<EOF
802   static const char xtra_short[] = "${PARSE_AND_LIST_SHORTOPTS}z:";
805 fragment <<EOF
806   static const struct option xtra_long[] = {
808 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
809 fragment <<EOF
810     {"audit", required_argument, NULL, OPTION_AUDIT},
811     {"Bgroup", no_argument, NULL, OPTION_GROUP},
814 fragment <<EOF
815     {"build-id", optional_argument, NULL, OPTION_BUILD_ID},
816     {"package-metadata", optional_argument, NULL, OPTION_PACKAGE_METADATA},
817     {"compress-debug-sections", required_argument, NULL, OPTION_COMPRESS_DEBUG},
818     {"rosegment", no_argument, NULL, OPTION_ROSEGMENT},
819     {"no-rosegment", no_argument, NULL, OPTION_NO_ROSEGMENT},
821 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
822 fragment <<EOF
823     {"depaudit", required_argument, NULL, 'P'},
824     {"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
825     {"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
826     {"eh-frame-hdr", no_argument, NULL, OPTION_EH_FRAME_HDR},
827     {"no-eh-frame-hdr", no_argument, NULL, OPTION_NO_EH_FRAME_HDR},
828     {"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
829     {"hash-style", required_argument, NULL, OPTION_HASH_STYLE},
832 if test -n "$PARSE_AND_LIST_LONGOPTS" ; then
833 fragment <<EOF
834     $PARSE_AND_LIST_LONGOPTS
837 fragment <<EOF
838     {NULL, no_argument, NULL, 0}
839   };
841   *shortopts = (char *) xrealloc (*shortopts, ns + sizeof (xtra_short));
842   memcpy (*shortopts + ns, &xtra_short, sizeof (xtra_short));
843   *longopts = (struct option *)
844     xrealloc (*longopts, nl * sizeof (struct option) + sizeof (xtra_long));
845   memcpy (*longopts + nl, &xtra_long, sizeof (xtra_long));
848 #define DEFAULT_BUILD_ID_STYLE  "sha1"
850 static bool
851 gld${EMULATION_NAME}_handle_option (int optc)
853   switch (optc)
854     {
855     default:
856       return false;
858     case OPTION_BUILD_ID:
859       free ((char *) ldelf_emit_note_gnu_build_id);
860       ldelf_emit_note_gnu_build_id = NULL;
861       if (optarg == NULL)
862         optarg = DEFAULT_BUILD_ID_STYLE;
863       if (strcmp (optarg, "none"))
864         ldelf_emit_note_gnu_build_id = xstrdup (optarg);
865       break;
867     case OPTION_PACKAGE_METADATA:
868       free ((char *) ldelf_emit_note_fdo_package_metadata);
869       ldelf_emit_note_fdo_package_metadata = NULL;
870       if (optarg != NULL && strlen(optarg) > 0)
871         ldelf_emit_note_fdo_package_metadata = xstrdup (optarg);
872       break;
874     case OPTION_COMPRESS_DEBUG:
875       config.compress_debug = bfd_get_compression_algorithm (optarg);
876       if (strcasecmp (optarg, "zstd") == 0)
877         {
878 #ifndef HAVE_ZSTD
879           if (config.compress_debug == COMPRESS_DEBUG_ZSTD)
880             einfo (_ ("%F%P: --compress-debug-sections=zstd: ld is not built "
881                   "with zstd support\n"));
882 #endif
883         }
884       if (config.compress_debug == COMPRESS_UNKNOWN)
885         einfo (_("%F%P: invalid --compress-debug-sections option: \`%s'\n"),
886                optarg);
887       break;
889     case OPTION_ROSEGMENT:
890       link_info.one_rosegment = true;
891       break;
892     case OPTION_NO_ROSEGMENT:
893       link_info.one_rosegment = false;
894       break;      
897 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
898 fragment <<EOF
899     case OPTION_AUDIT:
900         ldelf_append_to_separated_string (&audit, optarg);
901         break;
903     case 'P':
904         ldelf_append_to_separated_string (&depaudit, optarg);
905         break;
907     case OPTION_DISABLE_NEW_DTAGS:
908       link_info.new_dtags = false;
909       break;
911     case OPTION_ENABLE_NEW_DTAGS:
912       link_info.new_dtags = true;
913       break;
915     case OPTION_EH_FRAME_HDR:
916       link_info.eh_frame_hdr_type = DWARF2_EH_HDR;
917       break;
919     case OPTION_NO_EH_FRAME_HDR:
920       link_info.eh_frame_hdr_type = 0;
921       break;
923     case OPTION_GROUP:
924       link_info.flags_1 |= (bfd_vma) DF_1_GROUP;
925       /* Groups must be self-contained.  */
926       link_info.unresolved_syms_in_objects = RM_DIAGNOSE;
927       link_info.unresolved_syms_in_shared_libs = RM_DIAGNOSE;
928       break;
930     case OPTION_EXCLUDE_LIBS:
931       add_excluded_libs (optarg);
932       break;
934     case OPTION_HASH_STYLE:
935       link_info.emit_hash = false;
936       link_info.emit_gnu_hash = false;
937       if (strcmp (optarg, "sysv") == 0)
938         link_info.emit_hash = true;
939       else if (strcmp (optarg, "gnu") == 0)
940         link_info.emit_gnu_hash = true;
941       else if (strcmp (optarg, "both") == 0)
942         {
943           link_info.emit_hash = true;
944           link_info.emit_gnu_hash = true;
945         }
946       else
947         einfo (_("%F%P: invalid hash style \`%s'\n"), optarg);
948       break;
952 fragment <<EOF
953     case 'z':
954       if (strcmp (optarg, "defs") == 0)
955         link_info.unresolved_syms_in_objects = RM_DIAGNOSE;
956       else if (strcmp (optarg, "undefs") == 0)
957         link_info.unresolved_syms_in_objects = RM_IGNORE;
958       else if (strcmp (optarg, "muldefs") == 0)
959         link_info.allow_multiple_definition = true;
960       else if (startswith (optarg, "max-page-size="))
961         {
962           char *end;
964           link_info.maxpagesize = strtoul (optarg + 14, &end, 0);
965           if (*end
966               || (link_info.maxpagesize & (link_info.maxpagesize - 1)) != 0)
967             einfo (_("%F%P: invalid maximum page size \`%s'\n"),
968                    optarg + 14);
969           link_info.maxpagesize_is_set = true;
970         }
971       else if (startswith (optarg, "common-page-size="))
972         {
973           char *end;
974           link_info.commonpagesize = strtoul (optarg + 17, &end, 0);
975           if (*end
976               || (link_info.commonpagesize & (link_info.commonpagesize - 1)) != 0)
977             einfo (_("%F%P: invalid common page size \`%s'\n"),
978                    optarg + 17);
979           link_info.commonpagesize_is_set = true;
980         }
981       else if (startswith (optarg, "stack-size="))
982         {
983           char *end;
984           link_info.stacksize = strtoul (optarg + 11, &end, 0);
985           if (*end || link_info.stacksize < 0)
986             einfo (_("%F%P: invalid stack size \`%s'\n"), optarg + 11);
987           if (!link_info.stacksize)
988             /* Use -1 for explicit no-stack, because zero means
989                'default'.   */
990             link_info.stacksize = -1;
991         }
992       else if (strcmp (optarg, "execstack") == 0)
993         {
994           link_info.execstack = true;
995           link_info.noexecstack = false;
996         }
997       else if (strcmp (optarg, "noexecstack") == 0)
998         {
999           link_info.noexecstack = true;
1000           link_info.execstack = false;
1001         }
1002       else if (strcmp (optarg, "unique-symbol") == 0)
1003         link_info.unique_symbol = true;
1004       else if (strcmp (optarg, "nounique-symbol") == 0)
1005         link_info.unique_symbol = false;
1006       else if (strcmp (optarg, "globalaudit") == 0)
1007         {
1008           link_info.flags_1 |= DF_1_GLOBAUDIT;
1009         }
1010       else if (startswith (optarg, "start-stop-gc"))
1011         link_info.start_stop_gc = true;
1012       else if (startswith (optarg, "nostart-stop-gc"))
1013         link_info.start_stop_gc = false;
1014       else if (startswith (optarg, "start-stop-visibility="))
1015         {
1016           if (strcmp (optarg, "start-stop-visibility=default") == 0)
1017             link_info.start_stop_visibility = STV_DEFAULT;
1018           else if (strcmp (optarg, "start-stop-visibility=internal") == 0)
1019             link_info.start_stop_visibility = STV_INTERNAL;
1020           else if (strcmp (optarg, "start-stop-visibility=hidden") == 0)
1021             link_info.start_stop_visibility = STV_HIDDEN;
1022           else if (strcmp (optarg, "start-stop-visibility=protected") == 0)
1023             link_info.start_stop_visibility = STV_PROTECTED;
1024           else
1025             einfo (_("%F%P: invalid visibility in \`-z %s'; "
1026                      "must be default, internal, hidden, or protected"),
1027                    optarg);
1028         }
1029       else if (strcmp (optarg, "sectionheader") == 0)
1030         config.no_section_header = false;
1031       else if (strcmp (optarg, "nosectionheader") == 0)
1032         config.no_section_header = true;
1035 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
1036 fragment <<EOF
1037       else if (strcmp (optarg, "global") == 0)
1038         link_info.flags_1 |= (bfd_vma) DF_1_GLOBAL;
1039       else if (strcmp (optarg, "initfirst") == 0)
1040         link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
1041       else if (strcmp (optarg, "interpose") == 0)
1042         link_info.flags_1 |= (bfd_vma) DF_1_INTERPOSE;
1043       else if (strcmp (optarg, "loadfltr") == 0)
1044         link_info.flags_1 |= (bfd_vma) DF_1_LOADFLTR;
1045       else if (strcmp (optarg, "nodefaultlib") == 0)
1046         link_info.flags_1 |= (bfd_vma) DF_1_NODEFLIB;
1047       else if (strcmp (optarg, "nodelete") == 0)
1048         link_info.flags_1 |= (bfd_vma) DF_1_NODELETE;
1049       else if (strcmp (optarg, "nodlopen") == 0)
1050         link_info.flags_1 |= (bfd_vma) DF_1_NOOPEN;
1051       else if (strcmp (optarg, "nodump") == 0)
1052         link_info.flags_1 |= (bfd_vma) DF_1_NODUMP;
1053       else if (strcmp (optarg, "now") == 0)
1054         {
1055           link_info.flags |= (bfd_vma) DF_BIND_NOW;
1056           link_info.flags_1 |= (bfd_vma) DF_1_NOW;
1057         }
1058       else if (strcmp (optarg, "lazy") == 0)
1059         {
1060           link_info.flags &= ~(bfd_vma) DF_BIND_NOW;
1061           link_info.flags_1 &= ~(bfd_vma) DF_1_NOW;
1062         }
1063       else if (strcmp (optarg, "origin") == 0)
1064         {
1065           link_info.flags |= (bfd_vma) DF_ORIGIN;
1066           link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN;
1067         }
1068       else if (strcmp (optarg, "unique") == 0)
1069         link_info.gnu_flags_1 |= (bfd_vma) DF_GNU_1_UNIQUE;
1070       else if (strcmp (optarg, "nounique") == 0)
1071         link_info.gnu_flags_1 &= ~(bfd_vma) DF_GNU_1_UNIQUE;
1072       else if (strcmp (optarg, "combreloc") == 0)
1073         link_info.combreloc = true;
1074       else if (strcmp (optarg, "nocombreloc") == 0)
1075         link_info.combreloc = false;
1076       else if (strcmp (optarg, "nocopyreloc") == 0)
1077         link_info.nocopyreloc = true;
1079 if test -n "$COMMONPAGESIZE"; then
1080 fragment <<EOF
1081       else if (strcmp (optarg, "relro") == 0)
1082         link_info.relro = true;
1083       else if (strcmp (optarg, "norelro") == 0)
1084         link_info.relro = false;
1087 fragment <<EOF
1088       else if (strcmp (optarg, "separate-code") == 0)
1089         link_info.separate_code = true;
1090       else if (strcmp (optarg, "noseparate-code") == 0)
1091         link_info.separate_code = false;
1092       else if (strcmp (optarg, "common") == 0)
1093         link_info.elf_stt_common = elf_stt_common;
1094       else if (strcmp (optarg, "nocommon") == 0)
1095         link_info.elf_stt_common = no_elf_stt_common;
1096       else if (strcmp (optarg, "text") == 0)
1097         link_info.textrel_check = textrel_check_error;
1098       else if (strcmp (optarg, "notext") == 0)
1099         link_info.textrel_check = textrel_check_none;
1100       else if (strcmp (optarg, "textoff") == 0)
1101         link_info.textrel_check = textrel_check_none;
1105 if test -n "$PARSE_AND_LIST_ARGS_CASE_Z" ; then
1106 fragment <<EOF
1107  $PARSE_AND_LIST_ARGS_CASE_Z
1111 fragment <<EOF
1112       else
1113         queue_unknown_cmdline_warning ("-z %s", optarg);
1114       break;
1117 if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then
1118 fragment <<EOF
1119  $PARSE_AND_LIST_ARGS_CASES
1123 fragment <<EOF
1124     }
1126   return true;
1131 if test x"$LDEMUL_LIST_OPTIONS" != xgld"$EMULATION_NAME"_list_options; then
1132 gld_list_options="gld${EMULATION_NAME}_list_options"
1133 if test -n "$PARSE_AND_LIST_OPTIONS"; then
1134 fragment <<EOF
1136 static void
1137 gld${EMULATION_NAME}_list_options (FILE * file)
1141 if test -n "$PARSE_AND_LIST_OPTIONS" ; then
1142 fragment <<EOF
1143  $PARSE_AND_LIST_OPTIONS
1147 fragment <<EOF
1150 else
1151   gld_list_options="NULL"
1154 if test -n "$PARSE_AND_LIST_EPILOGUE" ; then
1155 fragment <<EOF
1156  $PARSE_AND_LIST_EPILOGUE
1161 LDEMUL_AFTER_PARSE=${LDEMUL_AFTER_PARSE-ldelf_after_parse}
1162 LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ=${LDEMUL_BEFORE_PLUGIN_ALL_SYMBOLS_READ-gld${EMULATION_NAME}_before_plugin_all_symbols_read}
1163 LDEMUL_AFTER_OPEN=${LDEMUL_AFTER_OPEN-gld${EMULATION_NAME}_after_open}
1164 LDEMUL_BEFORE_PLACE_ORPHANS=${LDEMUL_BEFORE_PLACE_ORPHANS-ldelf_before_place_orphans}
1165 LDEMUL_AFTER_ALLOCATION=${LDEMUL_AFTER_ALLOCATION-gld${EMULATION_NAME}_after_allocation}
1166 LDEMUL_SET_OUTPUT_ARCH=${LDEMUL_SET_OUTPUT_ARCH-ldelf_set_output_arch}
1167 LDEMUL_BEFORE_ALLOCATION=${LDEMUL_BEFORE_ALLOCATION-gld${EMULATION_NAME}_before_allocation}
1168 LDEMUL_OPEN_DYNAMIC_ARCHIVE=${LDEMUL_OPEN_DYNAMIC_ARCHIVE-ldelf_open_dynamic_archive}
1169 LDEMUL_PLACE_ORPHAN=${LDEMUL_PLACE_ORPHAN-ldelf_place_orphan}
1170 LDEMUL_ADD_OPTIONS=gld${EMULATION_NAME}_add_options
1171 LDEMUL_HANDLE_OPTION=gld${EMULATION_NAME}_handle_option
1172 LDEMUL_LIST_OPTIONS=${LDEMUL_LIST_OPTIONS-${gld_list_options}}
1173 LDEMUL_RECOGNIZED_FILE=${LDEMUL_RECOGNIZED_FILE-ldelf_load_symbols}
1175 source_em ${srcdir}/emultempl/emulation.em