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