]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - ld/configure.tgt
Disable execstack and rwx segments warnings for MIPS targets.
[thirdparty/binutils-gdb.git] / ld / configure.tgt
CommitLineData
e407c74b
NC
1# configure.tgt
2#
a2c58332 3# Copyright (C) 2013-2022 Free Software Foundation, Inc.
e407c74b
NC
4#
5# This file is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 3 of the License, or
8# (at your option) any later version.
35c08157 9#
e407c74b
NC
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
35c08157 14#
e407c74b
NC
15# You should have received a copy of the GNU General Public License
16# along with this program; see the file COPYING3. If not see
17# <http://www.gnu.org/licenses/>.
18
252b5132
RH
19# This is the linker target specific file. This is invoked by the
20# autoconf generated configure script. Putting it in a separate shell
21# file lets us skip running autoconf when modifying target specific
22# information.
23
24# This file switches on the shell variable ${targ}, and sets the
25# following shell variables:
26# targ_emul name of linker emulation to use
27# targ_extra_emuls additional linker emulations to provide
3336653a 28# targ_extra_libpath additional linker emulations using LIB_PATH
5063daf7 29# targ_extra_ofiles additional host-compiled objects needed by the emulation
534d3119 30# targ64_extra_emuls additional linker emulations to provide if
6c19b93b 31# --enable-64-bit-bfd is given or if host is 64 bit.
534d3119 32# targ64_extra_libpath additional linker emulations using LIB_PATH if
6c19b93b 33# --enable-64-bit-bfd is given or if host is 64 bit.
9c8ebd6a
DJ
34# NATIVE_LIB_DIRS library directories to search on this host
35# (if we are a native or sysrooted linker)
252b5132
RH
36
37targ_extra_emuls=
534d3119 38targ_extra_libpath=
d871d478 39targ_extra_ofiles="ldelf.o ldelfgen.o"
534d3119
L
40targ64_extra_emuls=
41targ64_extra_libpath=
252b5132 42
ed1c7ad8
NC
43# By default the linker will generate warnings if it is creating an
44# executable stack or a segment with all three of read, write and
45# execute permissions. These settings are not appropriate for all
46# targets however, so we can change them here:
47
48if test "${ac_default_ld_warn_rwx_segments}" = unset; then
49 case "${targ}" in
50 # The CRIS default linker script yields just one segment
51 # as intended, so a rwx segment warning is not helpful.
52 # The HPPA's PLT section uses a constructed trampoline
53 # hence it needs to have a RWX segment.
54 # Many MIPS targets use executable segments.
55 cris-*-* | crisv32-*-* | \
56 hppa*-*-* | \
57 mips*-*-*)
58 ac_default_ld_warn_rwx_segments=0
59 ;;
60 *)
61 ;;
62 esac
63fi
64
65if test "${ac_default_ld_warn_execstack}" = 2; then
66 case "${targ}" in
67 # The HPPA port needs to support older kernels that
68 # use executable stacks for signals and syscalls.
69 # Many MIPS targets use executable stacks.
70 hppa*-*-* | \
71 mips*-*-*)
72 ac_default_ld_warn_execstack=0
73 ;;
74 *)
75 ;;
76 esac
77fi
78
984b909a
AM
79# Please try to keep this table more or less in alphabetic order - it
80# makes it much easier to lookup a specific archictecture.
252b5132 81case "${targ}" in
a06ea964 82aarch64_be-*-elf) targ_emul=aarch64elfb
d871d478
AM
83 targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf"
84 ;;
1f568f9a 85aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
12a132db 86 targ_emul=aarch64elf
d871d478
AM
87 targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb"
88 ;;
a75cf613 89aarch64-*-cloudabi*) targ_emul=aarch64cloudabi
d871d478
AM
90 targ_extra_emuls=aarch64cloudabib
91 ;;
15c7659f 92aarch64-*-freebsd*) targ_emul=aarch64fbsd
d871d478
AM
93 targ_extra_emuls="aarch64fbsdb aarch64elf"
94 ;;
d5451cd4 95aarch64-*-fuchsia*) targ_emul=aarch64elf
d871d478
AM
96 targ_extra_emuls="aarch64elfb armelf armelfb"
97 ;;
9a6465c2
JW
98aarch64_be-*-linux-gnu_ilp32)
99 targ_emul=aarch64linux32b
100 targ_extra_libpath="aarch64linuxb aarch64linux aarch64linux32 armelfb_linux_eabi armelf_linux_eabi"
d871d478
AM
101 targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath"
102 ;;
9a6465c2
JW
103aarch64-*-linux-gnu_ilp32)
104 targ_emul=aarch64linux32
105 targ_extra_libpath="aarch64linux aarch64linuxb aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
d871d478
AM
106 targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath"
107 ;;
a06ea964 108aarch64_be-*-linux*) targ_emul=aarch64linuxb
56244278 109 targ_extra_libpath="aarch64linux aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
d871d478
AM
110 targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath"
111 ;;
a06ea964 112aarch64-*-linux*) targ_emul=aarch64linux
56244278 113 targ_extra_libpath="aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
d871d478
AM
114 targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath"
115 ;;
d85e70a3
AGI
116aarch64-*-haiku*) targ_emul=aarch64haiku
117 targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb armelf_haiku $targ_extra_libpath"
118 ;;
e729279b 119alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
6c19b93b 120 targ_emul=elf64alpha_fbsd
e729279b 121 targ_extra_emuls="elf64alpha alpha"
d871d478
AM
122 tdir_alpha=`echo ${targ_alias} | sed -e 's/freebsd/freebsdecoff/'`
123 ;;
124alpha*-*-linux*ecoff*) targ_emul=alpha
125 targ_extra_emuls=elf64alpha
126 tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'`
127 ;;
128alpha*-*-linux-*) targ_emul=elf64alpha
129 targ_extra_emuls=alpha
130 tdir_alpha=`echo ${targ_alias} | sed -e 's/linux\(-gnu\)*/linux\1ecoff/'`
131 ;;
132alpha*-*-osf*) targ_emul=alpha
133 targ_extra_ofiles=
134 ;;
135alpha*-*-gnu*) targ_emul=elf64alpha
136 ;;
137alpha*-*-netbsd*) targ_emul=elf64alpha_nbsd
138 ;;
139alpha*-*-openbsd*) targ_emul=elf64alpha
140 ;;
8b351884 141alpha*-*-*vms*) targ_emul=alphavms
d871d478 142 targ_extra_ofiles=
e729279b 143 ;;
984b909a
AM
144am33_2.0-*-linux*) targ_emul=elf32am33lin # mn10300 variant
145 ;;
886a2506 146arc*-*-elf*) targ_emul=arcelf
5e4f7e05 147 targ_extra_emuls="arclinux arclinux_nps arcv2elf arcv2elfx"
6c19b93b 148 ;;
d7488716
AB
149arc*-*-linux*) case "${with_cpu}" in
150 nps400) targ_emul=arclinux_nps
151 targ_extra_emuls=arclinux
152 ;;
153 *) targ_emul=arclinux
154 targ_extra_emuls=arclinux_nps
155 ;;
156 esac
5e4f7e05 157 targ_extra_emuls="${targ_extra_emuls} arcelf arcv2elf arcv2elfx"
e729279b 158 ;;
d871d478
AM
159arm*-*-cegcc*) targ_emul=arm_wince_pe
160 targ_extra_ofiles="deffilep.o pe-dll.o"
161 LIB_PATH='${tooldir}/lib/w32api'
162 ;;
361dff73 163arm-wince-pe | arm-*-wince | arm*-*-mingw32ce*)
d871d478
AM
164 targ_emul=arm_wince_pe
165 targ_extra_ofiles="deffilep.o pe-dll.o"
166 ;;
167arm-*-pe) targ_emul=armpe
168 targ_extra_ofiles="deffilep.o pe-dll.o"
169 ;;
1804dbce 170arm*b-*-freebsd*) targ_emul=armelfb_fbsd
d871d478
AM
171 targ_extra_emuls="armelf_fbsd armelf"
172 ;;
1804dbce 173arm*-*-freebsd* | arm-*-kfreebsd*-gnu)
6c19b93b 174 targ_emul=armelf_fbsd
d871d478
AM
175 targ_extra_emuls="armelfb_fbsd armelf"
176 ;;
ab4f385b 177armeb-*-netbsd*) targ_emul=armelfb_nbsd;
d871d478
AM
178 targ_extra_emuls="armelf_nbsd armelf"
179 ;;
ab4f385b 180arm-*-netbsd*) targ_emul=armelf_nbsd;
d871d478
AM
181 targ_extra_emuls="armelfb_nbsd armelf"
182 ;;
183arm-*-nto*) targ_emul=armnto
184 ;;
185arm-*-phoenix*) targ_emul=armelf
186 ;;
01e6c1a4 187armeb-*-elf | armeb-*-eabi*)
d871d478
AM
188 targ_emul=armelfb
189 ;;
1f568f9a 190arm-*-elf | arm*-*-eabi* | arm-*-rtems* | arm-*-genode*)
d871d478
AM
191 targ_emul=armelf
192 ;;
d871d478
AM
193arm-*-kaos*) targ_emul=armelf
194 ;;
195arm9e-*-elf) targ_emul=armelf
196 ;;
0e9dfb46 197arm*b-*-linux-*eabi*) targ_emul=armelfb_linux_eabi
fffbd2ef
JM
198 targ_extra_emuls=armelf_linux_eabi
199 targ_extra_libpath=$targ_extra_emuls
200 ;;
201arm*b-*-linux-*) targ_emul=armelfb_linux
202 targ_extra_emuls="armelfb armelf armelf_linux"
203 targ_extra_libpath="armelf_linux"
204 ;;
0e9dfb46 205arm*-*-linux-*eabi*) targ_emul=armelf_linux_eabi
617a5ada
CL
206 targ_extra_emuls="armelfb_linux_eabi"
207 targ_extra_libpath=$targ_extra_emuls
208 ;;
209arm*-*-uclinuxfdpiceabi)
210 targ_emul=armelf_linux_eabi
211 targ_extra_emuls="armelfb_linux_eabi armelf_linux_fdpiceabi armelfb_linux_fdpiceabi"
fffbd2ef
JM
212 targ_extra_libpath=$targ_extra_emuls
213 ;;
6c19b93b 214arm*-*-linux-*) targ_emul=armelf_linux
fffbd2ef
JM
215 targ_extra_emuls="armelf armelfb armelfb_linux"
216 targ_extra_libpath="armelfb_linux"
217 ;;
b38cadfb 218arm*b-*-nacl*) targ_emul=armelfb_nacl
bbd19b19 219 targ_extra_emuls="armelf_nacl"
b38cadfb 220 targ_extra_libpath=$targ_extra_emuls
b38cadfb
NC
221 ;;
222arm*-*-nacl*) targ_emul=armelf_nacl
bbd19b19 223 targ_extra_emuls="armelfb_nacl"
b38cadfb 224 targ_extra_libpath=$targ_extra_emuls
b38cadfb 225 ;;
0e9dfb46 226arm*-*-uclinux*eabi*) targ_emul=armelf_linux_eabi
7bd1c961
PB
227 targ_extra_emuls=armelfb_linux_eabi
228 targ_extra_libpath=$targ_extra_emuls
229 ;;
fffbd2ef
JM
230arm*-*-uclinux*) targ_emul=armelf_linux
231 targ_extra_emuls="armelf armelfb armelfb_linux"
232 targ_extra_libpath="armelfb_linux"
233 ;;
d871d478
AM
234arm-*-vxworks) targ_emul=armelf_vxworks
235 ;;
236arm*-*-conix*) targ_emul=armelf
237 ;;
d5451cd4
JC
238arm*-*-fuchsia*) targ_emul=armelf_fuchsia
239 targ_extra_emuls="armelfb_fuchsia armelf armelfb"
240 ;;
cc5e4073 241arm*-*-haiku*) targ_emul=armelf_haiku
d85e70a3
AGI
242 targ_extra_emuls=armelf
243 ;;
75ca919a 244avr-*-*) targ_emul=avr2
f36e8886 245 targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny"
e729279b 246 ;;
c75b4ebd
SH
247bfin-*-elf | bfin-*-rtems*)
248 targ_emul=elf32bfin
c2c09cab
NC
249 targ_extra_emuls="elf32bfinfd"
250 targ_extra_libpath=$targ_extra_emuls
251 ;;
3f2dad24
BS
252bfin-*-uclinux*) targ_emul=elf32bfin;
253 targ_extra_emuls="elf32bfinfd"
254 targ_extra_libpath=$targ_extra_emuls
255 ;;
bec9537e
MF
256bfin-*-linux-uclibc*) targ_emul=elf32bfinfd;
257 targ_extra_emuls="elf32bfin"
3f2dad24
BS
258 targ_extra_libpath=$targ_extra_emuls
259 ;;
d871d478
AM
260bpf-*-*) targ_emul=elf64bpf
261 ;;
262cr16-*-elf*) targ_emul=elf32cr16
263 ;;
1268a053 264cris-*-*aout*) targ_emul=crisaout
9d06555c 265 targ_extra_emuls="criself crislinux"
d871d478
AM
266 targ_extra_libpath=$targ_extra_emuls
267 ;;
ed84e695 268cris-*-linux-* | crisv32-*-linux-*)
d871d478
AM
269 targ_emul=crislinux
270 ;;
a0055007 271cris-*-* | crisv32-*-*) targ_emul=criself
1268a053 272 targ_extra_emuls="crisaout crislinux"
e729279b
NC
273 targ_extra_libpath=$targ_extra_emuls
274 ;;
275crx-*-elf*) targ_emul=elf32crx
276 ;;
b8891f8d 277
d871d478
AM
278csky-*-elf*) targ_emul=cskyelf
279 ;;
280csky-*-linux*) targ_emul=cskyelf_linux
281 ;;
b8891f8d 282
d871d478
AM
283d10v-*-*) targ_emul=d10velf
284 ;;
285d30v-*-*ext*) targ_emul=d30v_e
286 targ_extra_emuls="d30velf d30v_o"
287 targ_extra_ofiles=ldelfgen.o
288 ;;
289d30v-*-*onchip*) targ_emul=d30v_o
290 targ_extra_emuls="d30velf d30v_e"
291 targ_extra_ofiles=ldelfgen.o
292 ;;
293d30v-*-*) targ_emul=d30velf
294 targ_extra_emuls="d30v_e d30v_o"
295 targ_extra_ofiles=ldelfgen.o
fb33b906 296 ;;
e729279b 297dlx-*-elf*) targ_emul=elf32_dlx
d871d478 298 targ_extra_ofiles=ldelfgen.o
252b5132 299 ;;
319c2dbe 300epiphany-*-*) targ_emul=elf32epiphany
f204ddb8 301 targ_extra_emuls="elf32epiphany_4x4"
cfb8c092 302 ;;
d871d478
AM
303fido*-*-elf*) targ_emul=m68kelf
304 ;;
e729279b 305fr30-*-*) targ_emul=elf32fr30
d871d478
AM
306 targ_extra_ofiles=ldelfgen.o
307 ;;
308frv-*-*linux*) targ_emul=elf32frvfd
252b5132 309 ;;
d871d478
AM
310frv-*-*) targ_emul=elf32frv
311 targ_extra_emuls="elf32frvfd"
252b5132 312 ;;
984b909a 313ft32-*-*) targ_emul=elf32ft32
d871d478 314 targ_extra_ofiles=ldelfgen.o
20135e4c 315 ;;
e729279b
NC
316h8300-*-elf* | h8300-*-rtems*)
317 targ_emul=h8300elf;
d871d478
AM
318 targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf"
319 ;;
5518c738
YS
320h8300-*-linux*)
321 targ_emul=h8300elf_linux;
d871d478
AM
322 targ_extra_emuls="h8300helf_linux h8300self_linux h8300sxelf_linux"
323 ;;
324hppa*64*-*-linux-*) targ_emul=hppa64linux
325 ;;
326hppa*64*-hpux*) targ_emul=elf64hppa
327 ;;
328hppa*-*-linux-*) targ_emul=hppalinux
329 ;;
330hppa*-*-*elf*) targ_emul=hppaelf
331 ;;
332hppa*-*-lites*) targ_emul=hppaelf
333 ;;
334hppa*-*-netbsd*) targ_emul=hppanbsd
335 ;;
e729279b 336hppa*-*-openbsd*) targ_emul=hppaobsd
a1836d49 337 ;;
d871d478
AM
338i[3-7]86-*-nto-qnx*) targ_emul=i386nto
339 ;;
340i[3-7]86-*-go32) targ_emul=i386go32
341 targ_extra_ofiles=
342 ;;
343i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32
344 targ_extra_ofiles=
345 ;;
346i[3-7]86-*-lynxos*) targ_emul=i386lynx
347 ;;
7e0a8112 348i[3-7]86-*-aros*) targ_emul=elf_i386
d871d478
AM
349 targ_extra_emuls=elf_iamcu
350 ;;
7e0a8112 351i[3-7]86-*-rdos*) targ_emul=elf_i386
d871d478
AM
352 targ_extra_emuls=elf_iamcu
353 ;;
d871d478
AM
354i[3-7]86-*-bsd) targ_emul=i386bsd
355 targ_extra_ofiles=
356 ;;
357i[3-7]86-*-bsd386) targ_emul=i386bsd
358 targ_extra_ofiles=
359 ;;
360i[3-7]86-*-bsdi*) targ_emul=i386bsd
361 targ_extra_ofiles=
362 ;;
ed84e695 363i[3-7]86-*-linux-*) targ_emul=elf_i386
c65c21e1 364 targ_extra_emuls="elf_iamcu"
e961c696 365 targ64_extra_emuls="elf_x86_64 elf32_x86_64"
d871d478
AM
366 targ64_extra_libpath="elf_x86_64 elf32_x86_64"
367 ;;
f2e2d2f5 368i[3-7]86-*-redox*) targ_emul=elf_i386
d871d478
AM
369 targ_extra_emuls=elf_x86_64
370 ;;
7e0a8112 371i[3-7]86-*-sysv[45]*) targ_emul=elf_i386
d871d478
AM
372 targ_extra_emuls=elf_iamcu
373 ;;
a6cc6b3b 374i[3-7]86-*-solaris2*) targ_emul=elf_i386_sol2
e961c696 375 targ_extra_emuls="elf_i386_ldso elf_i386 elf_iamcu elf_x86_64_sol2 elf_x86_64"
d19628a5 376 targ_extra_libpath=$targ_extra_emuls
6c19b93b 377 ;;
7e0a8112 378i[3-7]86-*-unixware) targ_emul=elf_i386
d871d478
AM
379 targ_extra_emuls=elf_iamcu
380 ;;
80c7c40a 381i[3-7]86-*-solaris*) targ_emul=elf_i386_ldso
6c19b93b 382 targ_extra_emuls="elf_i386"
d19628a5 383 targ_extra_libpath=$targ_extra_emuls
6c19b93b 384 ;;
ab4f385b
JE
385i[3-7]86-*-netbsdpe*) targ_emul=i386pe
386 targ_extra_ofiles="deffilep.o pe-dll.o"
387 ;;
388i[3-7]86-*-netbsd* | \
4615568e 389i[3-7]86-*-netbsd*-gnu* | \
b88237bc
AM
390i[3-7]86-*-knetbsd*-gnu | \
391i[3-7]86-*-openbsd*)
a06a29f2 392 targ_emul=elf_i386
d871d478
AM
393 targ_extra_emuls="elf_iamcu"
394 ;;
5197d474 395i[3-7]86-*-elfiamcu) targ_emul=elf_iamcu
d871d478
AM
396 targ_extra_emuls=elf_i386
397 ;;
1f568f9a 398i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
c75b4ebd 399 targ_emul=elf_i386
d871d478
AM
400 targ_extra_emuls=elf_iamcu
401 ;;
5b806d27 402i[3-7]86-*-dragonfly*) targ_emul=elf_i386
d871d478
AM
403 targ_extra_emuls="elf_iamcu i386bsd"
404 ;;
5b806d27 405i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
6c19b93b 406 targ_emul=elf_i386_fbsd
d871d478
AM
407 targ_extra_emuls="elf_i386 elf_iamcu i386bsd"
408 ;;
7e0a8112 409i[3-7]86-*-gnu*) targ_emul=elf_i386
d871d478
AM
410 targ_extra_emuls=elf_iamcu
411 ;;
412i[3-7]86-*-msdos*) targ_emul=i386msdos
413 targ_extra_emuls=i386aout
414 targ_extra_ofiles=
415 ;;
416i[3-7]86-*-moss*) targ_emul=i386moss
417 targ_extra_emuls=i386msdos
d871d478 418 ;;
80c7c40a 419i[3-7]86-*-winnt*) targ_emul=i386pe ;
d871d478
AM
420 targ_extra_ofiles="deffilep.o pe-dll.o"
421 ;;
80c7c40a 422i[3-7]86-*-pe) targ_emul=i386pe ;
d871d478
AM
423 targ_extra_ofiles="deffilep.o pe-dll.o"
424 ;;
80c7c40a 425i[3-7]86-*-cygwin*) targ_emul=i386pe ;
5063daf7 426 targ_extra_ofiles="deffilep.o pe-dll.o" ;
d871d478
AM
427 test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
428 ;;
80c7c40a 429i[3-7]86-*-mingw32*) targ_emul=i386pe ;
d871d478
AM
430 targ_extra_ofiles="deffilep.o pe-dll.o"
431 ;;
80c7c40a 432i[3-7]86-*-interix*) targ_emul=i386pe_posix;
d871d478
AM
433 targ_extra_ofiles="deffilep.o pe-dll.o"
434 ;;
435i[3-7]86-*-beospe*) targ_emul=i386beos
436 targ_extra_ofiles=
437 ;;
438i[3-7]86-*-beos*) targ_emul=elf_i386_be
439 ;;
d85e70a3
AGI
440i[3-7]86-*-haiku*) targ_emul=elf_i386_haiku
441 ;;
d871d478
AM
442i[3-7]86-*-vxworks*) targ_emul=elf_i386_vxworks
443 ;;
e729279b 444i[3-7]86-*-chaos) targ_emul=elf_i386_chaos
8af6dd41 445 ;;
d871d478
AM
446ia16-*-elf*) targ_emul=elf_i386
447 targ_extra_emuls=i386msdos
448 ;;
449ia64-*-elf*) targ_emul=elf64_ia64
450 ;;
e729279b 451ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
6c19b93b 452 targ_emul=elf64_ia64_fbsd
d871d478
AM
453 targ_extra_emuls="elf64_ia64"
454 ;;
455ia64-*-netbsd*) targ_emul=elf64_ia64
456 ;;
457ia64-*-linux*) targ_emul=elf64_ia64
458 ;;
459ia64-*-*vms*) targ_emul=elf64_ia64_vms
460 targ_extra_ofiles=ldelfgen.o
461 ;;
e729279b 462ia64-*-aix*) targ_emul=elf64_aix
7a33bc10 463 ;;
e729279b 464ip2k-*-elf) targ_emul=elf32ip2k
252b5132 465 ;;
d871d478
AM
466iq2000-*-elf) targ_emul=elf32iq2000
467 targ_extra_emuls="elf32iq10"
468 targ_extra_ofiles=ldelfgen.o
6c19b93b 469 ;;
d871d478
AM
470lm32-*-*linux*) targ_emul=elf32lm32fd
471 ;;
472lm32-*-*) targ_emul=elf32lm32
473 targ_extra_emuls="elf32lm32fd"
ed71e111 474 ;;
ae47e309 475m32c-*-elf)
8a2a2dbb 476 targ_emul=elf32m32c
7a33bc10 477 ;;
d871d478
AM
478m32r*le-*-elf*) targ_emul=m32rlelf
479 ;;
ae47e309 480m32r*-*-elf*)
d871d478
AM
481 targ_emul=m32relf
482 ;;
483m32r*le-*-linux-*) targ_emul=m32rlelf_linux
484 ;;
6c19b93b 485m32r*-*-linux-*) targ_emul=m32relf_linux
2d92cb7d 486 ;;
5a68afcf 487m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf
d871d478
AM
488 targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb"
489 ;;
5a68afcf 490m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf
d871d478
AM
491 targ_extra_emuls="m68hc12elfb m68hc11elf m68hc11elfb"
492 ;;
ab4f385b 493m68*-*-netbsd*) targ_emul=m68kelfnbsd
d871d478 494 ;;
d85e70a3
AGI
495m68*-*-haiku*) targ_emul=m68kelf
496 ;;
d871d478
AM
497m68*-*-*) targ_emul=m68kelf
498 ;;
e729279b 499mcore-*-pe) targ_emul=mcorepe ;
d871d478
AM
500 targ_extra_ofiles="deffilep.o pe-dll.o"
501 ;;
e729279b
NC
502mcore-*-elf) targ_emul=elf32mcore
503 ;;
d871d478
AM
504mep-*-elf) targ_emul=elf32mep
505 ;;
506metag-*-*) targ_emul=elf32metag
507 ;;
f23200ad
ME
508microblazeel*-linux*) targ_emul="elf32mbel_linux"
509 targ_extra_emuls="elf32mb_linux"
510 ;;
511microblaze*-linux*) targ_emul="elf32mb_linux"
512 targ_extra_emuls="elf32mbel_linux"
513 ;;
514microblazeel*) targ_emul=elf32microblazeel
515 targ_extra_emuls=elf32microblaze
516 ;;
517microblaze*) targ_emul=elf32microblaze
518 targ_extra_emuls=elf32microblazeel
519 ;;
d871d478
AM
520mips*-sgi-irix5*) targ_emul=elf32bsmip
521 ;;
dc831978 522mips*-sgi-irix6*) targ_emul=elf32bmipn32
6c19b93b 523 targ_extra_emuls="elf32bsmip elf64bmip"
d871d478
AM
524 targ_extra_libpath=$targ_extra_emuls
525 ;;
d85e70a3
AGI
526mips*el-*-haiku*) targ_emul=elf_mipsel_haiku
527 targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
528 ;;
aaa2ab3d
NH
529mips*el-*-netbsd*) targ_emul=elf32ltsmip
530 targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
531 ;;
532mips*-*-netbsd*) targ_emul=elf32btsmip
533 targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
6c19b93b 534 ;;
b7f54058
MR
535mips64el-*-openbsd*) targ_emul=elf64ltsmip
536 targ_extra_emuls=elf64btsmip
537 ;;
538mips64-*-openbsd*) targ_emul=elf64btsmip
539 targ_extra_emuls=elf64ltsmip
540 ;;
d871d478
AM
541mips*vr4300el-*-elf*) targ_emul=elf32l4300
542 ;;
543mips*vr4300-*-elf*) targ_emul=elf32b4300
544 ;;
545mips*vr4100el-*-elf*) targ_emul=elf32l4300
546 ;;
547mips*vr4100-*-elf*) targ_emul=elf32b4300
548 ;;
549mips*vr5000el-*-elf*) targ_emul=elf32l4300
550 ;;
551mips*vr5000-*-elf*) targ_emul=elf32b4300
552 ;;
f21cd979
MR
553mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
554 targ_emul=elf32ltsmip
d871d478
AM
555 targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
556 ;;
a9d58c06 557mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
c76b75fd 558 targ_emul=elf32btsmip
d871d478
AM
559 targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
560 ;;
e407c74b
NC
561mips64*el-ps2-elf*) targ_emul=elf32lr5900n32
562 targ_extra_emuls="elf32lr5900"
d871d478
AM
563 targ_extra_libpath=$targ_extra_emuls
564 ;;
e407c74b
NC
565mips*el-ps2-elf*) targ_emul=elf32lr5900
566 targ_extra_emuls="elf32lr5900n32"
d871d478
AM
567 targ_extra_libpath=$targ_extra_emuls
568 ;;
569mips*el-*-elf*) targ_emul=elf32elmip
570 ;;
c75b4ebd 571mips*-*-elf* | mips*-*-rtems*)
d871d478
AM
572 targ_emul=elf32ebmip
573 ;;
0a44bf69 574mips*el-*-vxworks*) targ_emul=elf32elmipvxworks
d871d478
AM
575 targ_extra_emuls="elf32ebmipvxworks"
576 ;;
0a44bf69 577mips*-*-vxworks*) targ_emul=elf32ebmipvxworks
d871d478
AM
578 targ_extra_emuls="elf32elmipvxworks"
579 ;;
580mips*-*-windiss) targ_emul=elf32mipswindiss
581 ;;
ed84e695 582mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
7808a785 583 targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
d871d478
AM
584 targ_extra_libpath=$targ_extra_emuls
585 ;;
ed84e695 586mips64*-*-linux-*) targ_emul=elf32btsmipn32
7808a785 587 targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
d871d478
AM
588 targ_extra_libpath=$targ_extra_emuls
589 ;;
ed84e695 590mips*el-*-linux-*) targ_emul=elf32ltsmip
919e35ed 591 targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
d871d478
AM
592 targ_extra_libpath=$targ_extra_emuls
593 ;;
ed84e695 594mips*-*-linux-*) targ_emul=elf32btsmip
919e35ed 595 targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
d871d478
AM
596 targ_extra_libpath=$targ_extra_emuls
597 ;;
cae4ddc6 598mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
aeffff67
RS
599 targ_emul=elf32ltsmipn32_fbsd
600 targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
d871d478
AM
601 targ_extra_libpath=$targ_extra_emuls
602 ;;
cae4ddc6 603mips64*-*-freebsd* | mips64*-*-kfreebsd*-gnu)
aeffff67
RS
604 targ_emul=elf32btsmipn32_fbsd
605 targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
d871d478
AM
606 targ_extra_libpath=$targ_extra_emuls
607 ;;
cae4ddc6 608mips*el-*-freebsd* | mips*el-*-kfreebsd*-gnu)
aeffff67
RS
609 targ_emul=elf32ltsmip_fbsd
610 targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmipn32_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
d871d478
AM
611 targ_extra_libpath=$targ_extra_emuls
612 ;;
cae4ddc6 613mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
aeffff67
RS
614 targ_emul=elf32btsmip_fbsd
615 targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmipn32_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
d871d478
AM
616 targ_extra_libpath=$targ_extra_emuls
617 ;;
6c19b93b 618mips*-*-sysv4*) targ_emul=elf32btsmip
e729279b 619 ;;
3c3bdf30
NC
620mmix-*-*) targ_emul=mmo
621 targ_extra_emuls=elf64mmix
622 ;;
d871d478
AM
623mn10200-*-*) targ_emul=mn10200
624 targ_extra_ofiles=ldelfgen.o
625 ;;
e729279b 626mn10300-*-*) targ_emul=mn10300
fb33b906 627 ;;
984b909a
AM
628moxie-*-moxiebox*) targ_emul=moxiebox
629 targ_extra_ofiles=ldelfgen.o
630 ;;
631moxie-*-*) targ_emul=elf32moxie
252b5132 632 ;;
6c19b93b 633msp430-*-*) targ_emul=msp430elf
1ade0651 634 targ_extra_emuls="msp430X"
d871d478 635 targ_extra_ofiles=ldelfgen.o
e729279b 636 ;;
984b909a
AM
637mt-*elf) targ_emul=elf32mt
638 targ_extra_ofiles=ldelfgen.o
639 ;;
35c08157
KLC
640nds32*le-*-elf*) targ_emul=nds32elf
641 targ_extra_emuls="nds32elf16m nds32belf nds32belf16m"
642 ;;
643nds32*be-*-elf*) targ_emul=nds32belf
644 targ_extra_emuls="nds32elf nds32elf16m nds32belf16m"
645 ;;
d871d478
AM
646nds32*le-*-linux-gnu*) targ_emul=nds32elf_linux
647 ;;
648nds32*be-*-linux-gnu*) targ_emul=nds32belf_linux
649 ;;
650nios2*-*-linux*) targ_emul=nios2linux
651 ;;
652nios2*-*-*) targ_emul=nios2elf
653 ;;
654ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha
655 targ_extra_ofiles=
656 ;;
41ee6d14 657ns32k-*-*bsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd
d871d478 658 targ_extra_ofiles=
252b5132 659 ;;
c75b4ebd 660or1k-*-elf | or1knd-*-elf | or1k-*-rtems* | or1knd-*-rtems*)
d871d478
AM
661 targ_emul=elf32or1k
662 ;;
663or1k-*-linux* | or1knd-*-linux*) targ_emul=elf32or1k_linux
664 ;;
e729279b 665pdp11-*-*) targ_emul=pdp11
d871d478 666 targ_extra_ofiles=
e729279b 667 ;;
6c19b93b 668pjl*-*-*) targ_emul=pjlelf
d871d478
AM
669 targ_extra_emuls="elf_i386 elf_iamcu"
670 ;;
6c19b93b 671pj*-*-*) targ_emul=pjelf
d871d478 672 targ_extra_ofiles=ldelfgen.o
e729279b 673 ;;
13dfd2d0 674powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
bd59d916
AM
675 targ_emul=elf32ppc_fbsd
676 targ_extra_emuls="elf32ppc elf32ppcsim"
fb33b906 677 targ_extra_libpath=elf32ppc;
d871d478
AM
678 tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
679 ;;
bd59d916
AM
680powerpc64-*-freebsd*)
681 targ_emul=elf64ppc_fbsd
682 targ_extra_emuls="elf64ppc elf32ppc_fbsd elf32ppc"
683 targ_extra_libpath="elf32ppc_fbsd elf32ppc"
684 tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
685 tdir_elf32ppc_fbsd=$tdir_elf32ppc
686 ;;
6afcdeb3
BB
687powerpc64le-*-freebsd*)
688 targ_emul=elf64lppc_fbsd
689 targ_extra_emuls="elf64lppc"
690 ;;
49926cd0
AM
691powerpc-*-vxworks*)
692 targ_emul=elf32ppcvxworks
d871d478
AM
693 targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
694 ;;
49926cd0
AM
695powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
696 | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
c75b4ebd 697 | powerpc*-*-rtems* \
49926cd0
AM
698 | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
699 case "${targ}" in
4811ccb4
AM
700 powerpc64*)
701 targ_emul=elf64ppc
702 targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
703 targ_extra_libpath="elf32ppc elf32ppclinux" ;;
704 *linux*)
705 targ_emul=elf32ppclinux
706 targ_extra_emuls="elf32ppc elf32ppcsim"
707 targ_extra_libpath=elf32ppc
708 targ64_extra_emuls=elf64ppc
709 targ64_extra_libpath=elf64ppc ;;
710 *)
711 targ_emul=elf32ppc
712 targ_extra_emuls="elf32ppclinux elf32ppcsim"
713 targ_extra_libpath=elf32ppclinux
714 targ64_extra_emuls=elf64ppc
715 targ64_extra_libpath=elf64ppc ;;
49926cd0 716 esac
4811ccb4
AM
717 td=tdir_elf32ppc
718 td64=tdir_elf64ppc
719 s=s/ppc/lppc/g
49926cd0 720 case "${targ}" in
4811ccb4
AM
721 powerpcle-* | powerpc64le-*)
722 for z in td td64 targ_emul targ_extra_emuls \
723 targ_extra_libpath targ64_extra_emuls \
724 targ64_extra_libpath
725 do
726 eval ${z}=\"\`echo \$${z} \| sed -e $s\`\"
727 done
728 s=s/lppc/ppc/g ;;
729 esac
730 # Why oh why did we set tooldir based on target_alias
731 # rather than on target?
732 eval tdir_${targ_emul}="${targ_alias}"
733 cpu=`echo "${targ_alias}" | sed -e 's/-.*//'`
734 rest=`echo "${targ_alias}" | sed -e 's/^[^-]*//'`
735 le=le
736 case "${cpu}" in
737 *little) le=little
738 esac
739 ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
740 ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}'/;s/be64$/64be/'`"${rest}"
741 eval test -n \"\$${td}\" || eval ${td}="${ta32}"
742 eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
743 eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
744 eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
745 # Now provide the other endian
746 for z in targ_extra_emuls targ_extra_libpath
747 do
748 eval ${z}=\"\$${z} \`echo ${targ_emul} \$${z} \| sed -e $s\`\"
749 done
750 for z in targ64_extra_emuls targ64_extra_libpath
751 do
752 eval ${z}=\"\$${z} \`echo \$${z} \| sed -e $s\`\"
753 done
754 td=`echo "${td}" | sed -e $s`
755 td64=`echo "${td64}" | sed -e $s`
756 case "${targ}" in
757 powerpcle-* | powerpc64le-*)
758 cpu=`echo "${cpu}" | sed -e s/${le}\$//` ;;
759 *)
760 cpu=`echo "${cpu}" | sed -e s/be\$//`${le} ;;
761 esac
762 ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
763 ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}/`"${rest}"
764 eval test -n \"\$${td}\" || eval ${td}="${ta32}"
765 eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
766 eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
767 eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
768 ;;
d871d478
AM
769powerpc-*-nto*) targ_emul=elf32ppcnto
770 ;;
771powerpcle-*-nto*) targ_emul=elf32lppcnto
772 ;;
773powerpc-*-macos*) targ_emul=ppcmacos
774 targ_extra_ofiles=
775 ;;
d871d478
AM
776powerpc-*-aix[5-9]*) targ_emul=aix5ppc
777 targ_extra_ofiles=
778 ;;
779powerpc-*-aix*) targ_emul=aixppc
780 targ_extra_ofiles=
781 ;;
782powerpc-*-beos*) targ_emul=aixppc
783 targ_extra_ofiles=
784 ;;
d85e70a3
AGI
785powerpc-*-haiku*) targ_emul=elf32ppchaiku
786 ;;
d871d478
AM
787powerpc-*-windiss*) targ_emul=elf32ppcwindiss
788 ;;
d871d478
AM
789pru*-*-*) targ_emul=pruelf
790 ;;
fbc09e7a
MC
791riscv32be*-*-linux*) targ_emul=elf32briscv
792 targ_extra_emuls="elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64"
793 targ_extra_libpath=$targ_extra_emuls
794 ;;
10d98088 795riscv32*-*-linux*) targ_emul=elf32lriscv
fbc09e7a
MC
796 targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64"
797 targ_extra_libpath=$targ_extra_emuls
798 ;;
799riscvbe-*-* | riscv32be*-*-*)
800 targ_emul=elf32briscv
801 targ_extra_emuls="elf64briscv elf32lriscv elf64lriscv"
d871d478
AM
802 targ_extra_libpath=$targ_extra_emuls
803 ;;
bb11866d
JW
804riscv-*-* | riscv32*-*-*)
805 targ_emul=elf32lriscv
fbc09e7a
MC
806 targ_extra_emuls="elf64lriscv elf32briscv elf64briscv"
807 targ_extra_libpath=$targ_extra_emuls
808 ;;
809riscv64be*-*-linux*) targ_emul=elf64briscv
810 targ_extra_emuls="elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32"
d871d478
AM
811 targ_extra_libpath=$targ_extra_emuls
812 ;;
10d98088 813riscv64*-*-linux*) targ_emul=elf64lriscv
fbc09e7a
MC
814 targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32"
815 targ_extra_libpath=$targ_extra_emuls
816 ;;
817riscv64be*-*-*) targ_emul=elf64briscv
818 targ_extra_emuls="elf32briscv elf64lriscv elf32lriscv"
d871d478
AM
819 targ_extra_libpath=$targ_extra_emuls
820 ;;
e23eba97 821riscv64*-*-*) targ_emul=elf64lriscv
fbc09e7a 822 targ_extra_emuls="elf32lriscv elf64briscv elf32briscv"
d871d478
AM
823 targ_extra_libpath=$targ_extra_emuls
824 ;;
825rs6000-*-aix[5-9]*) targ_emul=aix5rs6
826 targ_extra_ofiles=
827 ;;
e729279b 828rs6000-*-aix*) targ_emul=aixrs6
d871d478
AM
829 targ_extra_ofiles=
830 ;;
831rl78-*-*) targ_emul=elf32rl78
832 ;;
c578f16e
YS
833rx-*-linux*) targ_emul=elf32rx_linux
834 ;;
d871d478 835rx-*-*) targ_emul=elf32rx
e729279b 836 ;;
984b909a
AM
837s12z-*-*) targ_emul=m9s12zelf
838 targ_extra_ofiles=ldelfgen.o
839 ;;
6c19b93b 840s390x-*-linux*) targ_emul=elf64_s390
f52d1d64
JJ
841 targ_extra_emuls=elf_s390
842 targ_extra_libpath=$targ_extra_emuls
d871d478
AM
843 tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
844 ;;
2fbd2a87 845s390x-*-tpf*) targ_emul=elf64_s390
d871d478
AM
846 tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
847 ;;
6c19b93b 848s390-*-linux*) targ_emul=elf_s390
534d3119
L
849 targ64_extra_emuls=elf64_s390
850 targ64_extra_libpath=elf64_s390
851 tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
e729279b 852 ;;
6c19b93b 853score-*-elf) targ_emul=score7_elf
d871d478
AM
854 targ_extra_emuls=score3_elf
855 ;;
e729279b 856sh-*-linux*) targ_emul=shlelf_linux
0e1e4a75 857 targ_extra_emuls="shelf_linux shlelf_fd shelf_fd"
d871d478
AM
858 targ_extra_libpath=shelf_linux
859 ;;
a39d2e82 860sh*eb-*-linux*) targ_emul=shelf_linux
d871d478
AM
861 targ_extra_emuls="shelf_fd"
862 ;;
a39d2e82 863sh*-*-linux*) targ_emul=shlelf_linux
d871d478
AM
864 targ_extra_emuls="shlelf_fd"
865 ;;
ab4f385b
JE
866sh*l*-*-netbsdaout*) targ_emul=shl
867 targ_extra_emuls=sh
868 ;;
869sh*-*-netbsdaout*) targ_emul=sh
870 targ_extra_emuls=shl
871 ;;
872sh*l*-*-netbsd*) targ_emul=shlelf_nbsd
d871d478
AM
873 targ_extra_emuls=shelf_nbsd
874 ;;
ab4f385b 875sh*-*-netbsd*) targ_emul=shelf_nbsd
d871d478
AM
876 targ_extra_emuls=shlelf_nbsd
877 ;;
e729279b
NC
878shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
879 targ_emul=shlelf
d871d478
AM
880 targ_extra_emuls="shelf shl sh"
881 ;;
55e6e397 882sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*)
e729279b 883 targ_emul=shelf
d871d478
AM
884 targ_extra_emuls="shlelf sh shl"
885 ;;
ed6ba298
NS
886sh-*-uclinux* | sh[12]-*-uclinux*)
887 targ_emul=shelf_uclinux
d871d478
AM
888 targ_extra_emuls="shelf shlelf sh shl shelf_fd shlelf_fd"
889 ;;
55e6e397 890sh-*-vxworks) targ_emul=shelf_vxworks
d871d478
AM
891 targ_extra_emuls=shlelf_vxworks
892 ;;
e729279b 893sh-*-nto*) targ_emul=shelf_nto
d871d478
AM
894 targ_extra_emuls=shlelf_nto
895 ;;
e729279b 896sh-*-pe) targ_emul=shpe ;
d871d478
AM
897 targ_extra_ofiles="deffilep.o pe-dll.o"
898 ;;
899sh-*-*) targ_emul=sh;
900 targ_extra_emuls=shl
901 targ_extra_ofiles=
902 ;;
e729279b
NC
903sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
904 targ_emul=elf64_sparc_fbsd
905 targ_extra_emuls="elf64_sparc elf32_sparc"
906 targ_extra_libpath=$targ_extra_emuls
d871d478
AM
907 tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
908 ;;
e729279b 909sparc64-*-linux-*) targ_emul=elf64_sparc
c9098af4 910 targ_extra_emuls="elf32_sparc"
e729279b 911 targ_extra_libpath=elf32_sparc
d871d478
AM
912 tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
913 ;;
c9098af4 914sparc64-*-*bsd*) targ_emul=elf64_sparc
d871d478
AM
915 targ_extra_emuls="elf32_sparc"
916 ;;
c9098af4
AM
917sparc64-*-solaris2* | sparcv9-*-solaris2*)
918 targ_emul=elf64_sparc_sol2
919 targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
920 targ_extra_libpath=$targ_extra_emuls
d871d478
AM
921 tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
922 ;;
d85e70a3
AGI
923sparc64-*-haiku*) targ_emul=elf64_sparc
924 ;;
d871d478
AM
925sparc64-*-*) targ_emul=elf64_sparc
926 ;;
e729279b 927sparc*-*-linux-*) targ_emul=elf32_sparc
c9098af4 928 targ_extra_emuls="elf64_sparc"
e729279b 929 targ_extra_libpath=elf64_sparc
d871d478
AM
930 tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
931 ;;
e729279b 932sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
a6cc6b3b 933 targ_emul=elf32_sparc_sol2
d871d478
AM
934 targ_extra_emuls=elf32_sparc
935 ;;
a6cc6b3b
RO
936sparc-*-solaris2*) targ_emul=elf32_sparc_sol2
937 targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
e729279b 938 targ_extra_libpath=$targ_extra_emuls
d871d478
AM
939 tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
940 ;;
941sparc*-*-vxworks*) targ_emul=elf32_sparc_vxworks
942 ;;
943sparc*-*-*) targ_emul=elf32_sparc
944 ;;
945spu-*-elf*) targ_emul=elf32_spu
946 ;;
d871d478
AM
947tic30-*-*coff*) targ_emul=tic30coff
948 targ_extra_ofiles=
949 ;;
950tic4x-*-* | c4x-*-*) targ_emul=tic4xcoff
951 targ_extra_emuls="tic3xcoff tic3xcoff_onchip"
952 targ_extra_ofiles=
953 ;;
954tic54x-*-* | c54x*-*-*) targ_emul=tic54xcoff
955 targ_extra_ofiles=
956 ;;
2a616379
BS
957tic6x-*-elf) targ_emul=elf32_tic6x_elf_le
958 targ_extra_emuls="elf32_tic6x_elf_be elf32_tic6x_le elf32_tic6x_be"
959 targ_extra_libpath=$targ_extra_emuls
960 ;;
961tic6x-*-uclinux) targ_emul=elf32_tic6x_linux_le
962 targ_extra_emuls="elf32_tic6x_linux_be elf32_tic6x_le elf32_tic6x_be"
963 targ_extra_libpath=$targ_extra_emuls
40b36596 964 ;;
aa137e4d 965tilegx-*-*) targ_emul=elf64tilegx
fb6cedde 966 targ_extra_emuls="elf64tilegx_be elf32tilegx elf32tilegx_be"
d871d478
AM
967 targ_extra_libpath=$targ_extra_emuls
968 ;;
fb6cedde
WL
969tilegxbe-*-*) targ_emul=elf64tilegx_be
970 targ_extra_emuls="elf64tilegx elf32tilegx elf32tilegx_be"
d871d478
AM
971 targ_extra_libpath=$targ_extra_emuls
972 ;;
973tilepro-*-*) targ_emul=elf32tilepro
974 ;;
de863c74
NC
975v850*-*-*) targ_emul=v850_rh850
976 targ_extra_emuls=v850
e729279b 977 ;;
ab4f385b 978vax-*-netbsdaout*) targ_emul=vaxnbsd
d871d478
AM
979 targ_extra_emuls=elf32vax
980 ;;
ab4f385b
JE
981vax-*-netbsd*) targ_emul=elf32vax
982 targ_extra_emuls=vaxnbsd
983 ;;
6c19b93b 984vax-*-linux-*) targ_emul=elf32vax
e729279b 985 ;;
c18392d8
EB
986visium-*-elf) targ_emul=elf32visium
987 ;;
984b909a
AM
988x86_64-*-rdos*) targ_emul=elf64rdos
989 ;;
990x86_64-*-cloudabi*) targ_emul=elf_x86_64_cloudabi
991 ;;
d85e70a3
AGI
992x86_64-*-haiku*) targ_emul=elf_x86_64_haiku
993 targ_extra_emuls="elf_x86_64 elf_i386_haiku"
994 ;;
984b909a 995x86_64-*-linux-gnux32) targ_emul=elf32_x86_64
e961c696
JB
996 targ_extra_emuls="elf_x86_64 elf_i386 elf_iamcu"
997 targ_extra_libpath="elf_i386 elf_iamcu elf_x86_64"
984b909a
AM
998 tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
999 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
1000 ;;
1001x86_64-*-linux-*) targ_emul=elf_x86_64
e961c696
JB
1002 targ_extra_emuls="elf32_x86_64 elf_i386 elf_iamcu"
1003 targ_extra_libpath="elf_i386 elf32_x86_64"
984b909a
AM
1004 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1005 ;;
1006x86_64-*-redox*) targ_emul=elf_x86_64
1007 targ_extra_emuls=elf_i386
1008 ;;
1009x86_64-*-solaris2*) targ_emul=elf_x86_64_sol2
e961c696 1010 targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
984b909a
AM
1011 targ_extra_libpath=$targ_extra_emuls
1012 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1013 ;;
b88237bc
AM
1014x86_64-*-netbsd* | x86_64-*-openbsd*)
1015 targ_emul=elf_x86_64
e961c696 1016 targ_extra_emuls="elf_i386 elf_iamcu"
984b909a 1017 tdir_elf_iamcu=`echo ${targ_alias} | \
ab4f385b 1018 sed -e 's/x86_64/i386/' -e 's/aout//'`
984b909a 1019 tdir_elf_i386=`echo ${targ_alias} | \
ab4f385b 1020 sed -e 's/x86_64/i386/' -e 's/aout//'`
984b909a 1021 ;;
1f568f9a 1022x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
984b909a 1023 targ_emul=elf_x86_64
e961c696
JB
1024 targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64"
1025 targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64"
984b909a
AM
1026 tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1027 ;;
1028x86_64-*-dragonfly*) targ_emul=elf_x86_64
e961c696 1029 targ_extra_emuls="elf_i386 elf_iamcu"
984b909a
AM
1030 ;;
1031x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
1032 targ_emul=elf_x86_64_fbsd
e961c696 1033 targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu"
984b909a
AM
1034 targ_extra_libpath="elf_i386_fbsd"
1035 tdir_elf_i386_fbsd=`echo ${targ_alias} \
1036 | sed -e 's/x86_64/i386/'`
1037 tdir_elf_iamcu=`echo ${targ_alias} \
1038 | sed -e 's/x86_64/i386/'`
1039 tdir_elf_i386=`echo ${targ_alias} \
1040 | sed -e 's/x86_64/i386/'`
1041 ;;
1042x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
1043 targ_extra_emuls=i386pe ;
1044 targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1045 ;;
1046x86_64-*-cygwin) targ_emul=i386pep ;
1047 targ_extra_emuls=i386pe
1048 targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1049 test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
1050 ;;
1051x86_64-*-mingw*) targ_emul=i386pep ;
1052 targ_extra_emuls=i386pe
1053 targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1054 ;;
984b909a
AM
1055xgate-*-*) targ_emul=xgateelf
1056 targ_extra_ofiles=ldelfgen.o
1057 ;;
e729279b
NC
1058xstormy16-*-*) targ_emul=elf32xstormy16
1059 ;;
f8a52b59 1060xtensa*-*-*) targ_emul=elf32xtensa
e729279b 1061 ;;
6655dba2
SB
1062z80-*-elf*) targ_emul=elf32z80
1063 targ_extra_ofiles="ldelf.o ldelfgen.o"
1064 ;;
3c9b82ba 1065z80-*-coff) targ_emul=z80
d871d478 1066 targ_extra_ofiles=
3c9b82ba 1067 ;;
d871d478
AM
1068z8k-*-coff) targ_emul=z8002
1069 targ_extra_emuls=z8001
1070 targ_extra_ofiles=
e729279b 1071 ;;
560b3fe2 1072loongarch32-*) targ_emul=elf32loongarch
1073 ;;
1074loongarch64-*) targ_emul=elf64loongarch
1075 ;;
e729279b 1076*-*-ieee*) targ_emul=vanilla
d871d478 1077 targ_extra_ofiles=
e729279b 1078 ;;
252b5132
RH
1079*)
1080 echo 2>&1 "*** ld does not support target ${targ}"
1081 echo 2>&1 "*** see ld/configure.tgt for supported targets"
1082 exit 1
1083
1084esac
9c8ebd6a
DJ
1085
1086NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
1087case "${target}" in
1088
5b806d27 1089*-*-dragonfly*)
5febff9b 1090 NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
5b806d27
NC
1091 ;;
1092
1093*-*-freebsd*)
9c8ebd6a
DJ
1094 NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
1095 ;;
1096
1097hppa*64*-*-hpux11*)
1098 NATIVE_LIB_DIRS=/usr/lib/pa20_64
1099 ;;
1100
80c7c40a 1101i[3-7]86-*-sysv4*)
9c8ebd6a
DJ
1102 NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1103 ;;
1104
80c7c40a 1105i[3-7]86-*-solaris*)
9c8ebd6a
DJ
1106 NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1107 ;;
1108
80c7c40a 1109i[3-7]86-pc-interix*)
9c8ebd6a
DJ
1110 NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
1111 ;;
1112
1113ia64-*-aix*)
1114 NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
1115 ;;
1116
1117sparc*-*-solaris2*)
1118 NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1119 ;;
1120
a6c73b34 1121spu-*-elf*)
f9a6a8f0 1122 # This allows one to build a pair of PPU/SPU toolchains with common sysroot.
d7b99e76 1123 NATIVE_LIB_DIRS='/lib'
a6c73b34
BE
1124 ;;
1125
a07ee50e 1126i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
d55b850c
CF
1127 NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
1128 ;;
1129
9c8ebd6a
DJ
1130*-*-linux*)
1131 ;;
1132
9c8ebd6a
DJ
1133*-*-netbsd*)
1134 ;;
1135
1136alpha*-*-*)
1137 NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1138 ;;
1139
1140esac
647e4d46
L
1141
1142case "${target}" in
1143frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*)
1144 # Don't enable -z relro by default since many relro tests fail on these
1145 # targets:
1146 # FAIL: strip -z relro (relro1)
1147 # FAIL: strip -z relro -shared (relro1)
1148 # FAIL: objcopy -z relro (relro1)
1149 # FAIL: objcopy -z relro -shared (relro1)
1150 # FAIL: objcopy -z relro (tdata1)
1151 # FAIL: objcopy -shared -z relro (tdata1)
1152 # FAIL: objcopy -z relro (tdata2)
1153 # FAIL: objcopy -shared -z relro (tdata2)
1154 # FAIL: objcopy -z relro (tdata3)
1155 # FAIL: objcopy -shared -z relro (tdata3)
1156 # FAIL: objcopy -shared -z relro (tbss1)
1157 # FAIL: objcopy -shared -z relro (tbss2)
1158 # FAIL: objcopy -shared -z relro (tbss3)
1159 ;;
1160*-*-linux*)
1161 if test ${ac_default_ld_z_relro} = unset; then
1162 ac_default_ld_z_relro=1
1163 fi
1164 ;;
1165esac
f6aec96d 1166
fa6ecf94 1167# Enable -z separate-code and --warn-textrel by default for Linux/x86.
f6aec96d
L
1168case "${target}" in
1169i[3-7]86-*-linux-* | x86_64-*-linux-*)
1170 if test ${ac_default_ld_z_separate_code} = unset; then
1171 ac_default_ld_z_separate_code=1
1172 fi
fa6ecf94
L
1173 if test ${ac_default_ld_textrel_check} = unset; then
1174 ac_default_ld_textrel_check=yes
1175 fi
f6aec96d
L
1176 ;;
1177esac