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