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