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