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