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