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