configure.tgt revision 1.44
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			;;
547mips64*el-*-netbsd*)	targ_emul=elf32ltsmipn32 	 
548			targ_extra_emuls="elf64btsmip elf64ltsmip elf32ltsmip elf32btsmipn32 elf32btsmip" 	 
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*el-*-netbsd*)	targ_emul=elf64ltsmip
556			targ_extra_emuls="elf64btsmip elf32ltsmip elf32btsmip elf32btsmipn32 elf32ltsmipn32"
557			targ_extra_libpath=$targ_extra_emuls
558			;; 	 
559mipsn64*-*-netbsd*)	targ_emul=elf64btsmip
560			targ_extra_emuls="elf64ltsmip elf64btsmip elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32"
561			targ_extra_libpath=$targ_extra_emuls
562  			;;
563mips*el-*-netbsd*)	targ_emul=elf32ltsmip
564			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
565			;;
566mips*-*-netbsd*)	targ_emul=elf32btsmip
567			targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
568			;;
569mips64el-*-openbsd*)	targ_emul=elf64ltsmip
570			targ_extra_emuls=elf64btsmip
571			;;
572mips64-*-openbsd*)	targ_emul=elf64btsmip
573			targ_extra_emuls=elf64ltsmip
574			;;
575mips*vr4300el-*-elf*)	targ_emul=elf32l4300
576			;;
577mips*vr4300-*-elf*)	targ_emul=elf32b4300
578			;;
579mips*vr4100el-*-elf*)	targ_emul=elf32l4300
580			;;
581mips*vr4100-*-elf*)	targ_emul=elf32b4300
582			;;
583mips*vr5000el-*-elf*)	targ_emul=elf32l4300
584			;;
585mips*vr5000-*-elf*)	targ_emul=elf32b4300
586			;;
587mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
588			targ_emul=elf32ltsmip
589			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
590			;;
591mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
592			targ_emul=elf32btsmip
593			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
594			;;
595mips64*el-ps2-elf*)	targ_emul=elf32lr5900n32
596			targ_extra_emuls="elf32lr5900"
597			targ_extra_libpath=$targ_extra_emuls
598			;;
599mips*el-ps2-elf*)	targ_emul=elf32lr5900
600			targ_extra_emuls="elf32lr5900n32"
601			targ_extra_libpath=$targ_extra_emuls
602			;;
603mips*el-*-elf*)		targ_emul=elf32elmip
604			;;
605mips*-*-elf* | mips*-*-rtems*)
606			targ_emul=elf32ebmip
607			;;
608mips*el-*-vxworks*)	targ_emul=elf32elmipvxworks
609			targ_extra_emuls="elf32ebmipvxworks"
610			;;
611mips*-*-vxworks*)	targ_emul=elf32ebmipvxworks
612			targ_extra_emuls="elf32elmipvxworks"
613			;;
614mips*-*-windiss)	targ_emul=elf32mipswindiss
615			;;
616mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
617			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
618			targ_extra_libpath=$targ_extra_emuls
619			;;
620mips64*-*-linux-*)	targ_emul=elf32btsmipn32
621			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
622			targ_extra_libpath=$targ_extra_emuls
623			;;
624mips*el-*-linux-*)	targ_emul=elf32ltsmip
625			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
626			targ_extra_libpath=$targ_extra_emuls
627			;;
628mips*-*-linux-*)	targ_emul=elf32btsmip
629			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
630			targ_extra_libpath=$targ_extra_emuls
631			;;
632mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
633			targ_emul=elf32ltsmipn32_fbsd
634			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
635			targ_extra_libpath=$targ_extra_emuls
636			;;
637mips64*-*-freebsd* | mips64*-*-kfreebsd*-gnu)
638			targ_emul=elf32btsmipn32_fbsd
639			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
640			targ_extra_libpath=$targ_extra_emuls
641			;;
642mips*el-*-freebsd* | mips*el-*-kfreebsd*-gnu)
643			targ_emul=elf32ltsmip_fbsd
644			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmipn32_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
645			targ_extra_libpath=$targ_extra_emuls
646			;;
647mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
648			targ_emul=elf32btsmip_fbsd
649			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmipn32_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
650			targ_extra_libpath=$targ_extra_emuls
651			;;
652mips*-*-sysv4*)		targ_emul=elf32btsmip
653			;;
654mmix-*-*)		targ_emul=mmo
655			targ_extra_emuls=elf64mmix
656			;;
657mn10200-*-*)		targ_emul=mn10200
658			targ_extra_ofiles=ldelfgen.o
659			;;
660mn10300-*-*)		targ_emul=mn10300
661			;;
662moxie-*-moxiebox*)	targ_emul=moxiebox
663			targ_extra_ofiles=ldelfgen.o
664			;;
665moxie-*-*)		targ_emul=elf32moxie
666			;;
667msp430-*-*)		targ_emul=msp430elf
668			targ_extra_emuls="msp430X"
669			targ_extra_ofiles=ldelfgen.o
670			;;
671mt-*elf)		targ_emul=elf32mt
672			targ_extra_ofiles=ldelfgen.o
673			;;
674nds32*le-*-elf*)	targ_emul=nds32elf
675			targ_extra_emuls="nds32elf16m nds32belf nds32belf16m"
676			;;
677nds32*be-*-elf*)	targ_emul=nds32belf
678			targ_extra_emuls="nds32elf nds32elf16m nds32belf16m"
679			;;
680nds32*le-*-linux-gnu*)	targ_emul=nds32elf_linux
681			;;
682nds32*be-*-linux-gnu*)	targ_emul=nds32belf_linux
683			;;
684nios2*-*-linux*)	targ_emul=nios2linux
685			;;
686nios2*-*-*)		targ_emul=nios2elf
687			;;
688ns32k-pc532-mach* | ns32k-pc532-ux*)  targ_emul=pc532macha
689			targ_extra_ofiles=
690			;;
691ns32k-*-*bsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd
692			targ_extra_ofiles=
693			;;
694or1k-*-elf | or1knd-*-elf | or1k-*-rtems* | or1knd-*-rtems*)
695			targ_emul=elf32or1k
696			;;
697or1k-*-netbsd* | or1knd-*-netbsd*)	targ_emul=elf32or1k_nbsd
698			;;
699or1k-*-linux* | or1knd-*-linux*)	targ_emul=elf32or1k_linux
700			;;
701powerpc-*-netbsd*)
702			targ_emul=elf32ppc_nbsd
703			targ_extra_emuls="elf32ppc elf32ppcsim"
704			targ_extra_libpath=elf32ppc;
705			tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
706			targ64_extra_emuls=elf64ppc
707			targ64_extra_libpath=elf64ppc
708			;;
709powerpc64-*-netbsd*)
710			targ_emul=elf64ppc
711			targ_extra_emuls="elf32ppc elf32ppc_nbsd elf32ppcsim"
712			targ_extra_libpath="elf32ppc_nbsd elf32ppc"
713			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
714			tdir_elf32ppc_fbsd=$tdir_elf32ppc
715			;;
716pdp11-*-*)		targ_emul=pdp11
717			targ_extra_ofiles=
718			;;
719pjl*-*-*)		targ_emul=pjlelf
720			targ_extra_emuls="elf_i386 elf_iamcu"
721			;;
722pj*-*-*)		targ_emul=pjelf
723			targ_extra_ofiles=ldelfgen.o
724			;;
725powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
726			targ_emul=elf32ppc_fbsd
727			targ_extra_emuls="elf32ppc elf32ppcsim"
728			targ_extra_libpath=elf32ppc;
729			tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
730			;;
731powerpc64-*-freebsd*)
732			targ_emul=elf64ppc_fbsd
733			targ_extra_emuls="elf64ppc elf32ppc_fbsd elf32ppc"
734			targ_extra_libpath="elf32ppc_fbsd elf32ppc"
735			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
736			tdir_elf32ppc_fbsd=$tdir_elf32ppc
737			;;
738powerpc64le-*-freebsd*)
739			targ_emul=elf64lppc_fbsd
740			targ_extra_emuls="elf64lppc"
741			;;
742powerpc-*-vxworks*)
743			targ_emul=elf32ppcvxworks
744			targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
745			;;
746powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
747  | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
748  | powerpc*-*-rtems* \
749  | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
750			case "${targ}" in
751			powerpc64*)
752			    targ_emul=elf64ppc
753			    targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
754			    targ_extra_libpath="elf32ppc elf32ppclinux" ;;
755			*linux*)
756			    targ_emul=elf32ppclinux
757			    targ_extra_emuls="elf32ppc elf32ppcsim"
758			    targ_extra_libpath=elf32ppc
759			    targ64_extra_emuls=elf64ppc
760			    targ64_extra_libpath=elf64ppc ;;
761			*)
762			    targ_emul=elf32ppc
763			    targ_extra_emuls="elf32ppclinux elf32ppcsim"
764			    targ_extra_libpath=elf32ppclinux
765			    targ64_extra_emuls=elf64ppc
766			    targ64_extra_libpath=elf64ppc ;;
767			esac
768			td=tdir_elf32ppc
769			td64=tdir_elf64ppc
770			s=s/ppc/lppc/g
771			case "${targ}" in
772			powerpcle-* | powerpc64le-*)
773			    for z in td td64 targ_emul targ_extra_emuls \
774					 targ_extra_libpath targ64_extra_emuls \
775					 targ64_extra_libpath
776			    do
777				eval ${z}=\"\`echo \$${z} \| sed -e $s\`\"
778			    done
779			    s=s/lppc/ppc/g ;;
780			esac
781			# Why oh why did we set tooldir based on target_alias
782			# rather than on target?
783			eval tdir_${targ_emul}="${targ_alias}"
784			cpu=`echo "${targ_alias}" | sed -e 's/-.*//'`
785			rest=`echo "${targ_alias}" | sed -e 's/^[^-]*//'`
786			le=le
787			case "${cpu}" in
788			*little) le=little
789			esac
790			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
791			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}'/;s/be64$/64be/'`"${rest}"
792			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
793			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
794			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
795			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
796			# Now provide the other endian
797			for z in targ_extra_emuls targ_extra_libpath
798			do
799			    eval ${z}=\"\$${z} \`echo ${targ_emul} \$${z} \| sed -e $s\`\"
800			done
801			for z in targ64_extra_emuls targ64_extra_libpath
802			do
803			    eval ${z}=\"\$${z} \`echo \$${z} \| sed -e $s\`\"
804			done
805			td=`echo "${td}" | sed -e $s`
806			td64=`echo "${td64}" | sed -e $s`
807			case "${targ}" in
808			powerpcle-* | powerpc64le-*)
809			    cpu=`echo "${cpu}" | sed -e s/${le}\$//` ;;
810			*)
811			    cpu=`echo "${cpu}" | sed -e s/be\$//`${le} ;;
812			esac
813			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
814			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}/`"${rest}"
815			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
816			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
817			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
818			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
819			;;
820powerpc-*-nto*)		targ_emul=elf32ppcnto
821			;;
822powerpcle-*-nto*)	targ_emul=elf32lppcnto
823			;;
824powerpc-*-macos*)	targ_emul=ppcmacos
825			targ_extra_ofiles=
826			;;
827powerpc-*-aix[5-9]*)	targ_emul=aix5ppc
828			targ_extra_ofiles=
829			;;
830powerpc-*-aix*)		targ_emul=aixppc
831			targ_extra_ofiles=
832			;;
833powerpc-*-beos*)	targ_emul=aixppc
834			targ_extra_ofiles=
835			;;
836powerpc-*-haiku*)	targ_emul=elf32ppchaiku
837			;;
838powerpc-*-windiss*)	targ_emul=elf32ppcwindiss
839			;;
840pru*-*-*)		targ_emul=pruelf
841			;;
842riscv32be*-*-linux* | riscv32be*-*-netbsd*)
843			targ_emul=elf32briscv
844			targ_extra_emuls="elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64"
845			targ_extra_libpath=$targ_extra_emuls
846			;;
847riscv32*-*-linux* | riscv-*-netbsd* | riscv32*-*-netbsd*)
848			targ_emul=elf32lriscv
849			targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64"
850			targ_extra_libpath=$targ_extra_emuls
851			;;
852riscvbe-*-* | riscv32be*-*-*)
853			targ_emul=elf32briscv
854			targ_extra_emuls="elf64briscv elf32lriscv elf64lriscv"
855			targ_extra_libpath=$targ_extra_emuls
856			;;
857riscv-*-* | riscv32*-*-*)
858			targ_emul=elf32lriscv
859			targ_extra_emuls="elf64lriscv elf32briscv elf64briscv"
860			targ_extra_libpath=$targ_extra_emuls
861			;;
862riscv64be*-*-linux* | riscv64be*-*-netbsd*)
863			targ_emul=elf64briscv
864			targ_extra_emuls="elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32"
865			targ_extra_libpath=$targ_extra_emuls
866			;;
867riscv64*-*-linux* | riscv64*-*-netbsd*)
868			targ_emul=elf64lriscv
869			targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32"
870			targ_extra_libpath=$targ_extra_emuls
871			;;
872riscv64be*-*-*)		targ_emul=elf64briscv
873			targ_extra_emuls="elf32briscv elf64lriscv elf32lriscv"
874			targ_extra_libpath=$targ_extra_emuls
875			;;
876riscv64*-*-*)		targ_emul=elf64lriscv
877			targ_extra_emuls="elf32lriscv elf64briscv elf32briscv"
878			targ_extra_libpath=$targ_extra_emuls
879			;;
880rs6000-*-aix[5-9]*)	targ_emul=aix5rs6
881			targ_extra_ofiles=
882			;;
883rs6000-*-aix*)		targ_emul=aixrs6
884			targ_extra_ofiles=
885			;;
886rl78-*-*)		targ_emul=elf32rl78
887			;;
888rx-*-linux*)		targ_emul=elf32rx_linux
889			;;
890rx-*-*)			targ_emul=elf32rx
891			;;
892s12z-*-*)		targ_emul=m9s12zelf
893			targ_extra_ofiles=ldelfgen.o
894			;;
895s390x-*-linux*)		targ_emul=elf64_s390
896			targ_extra_emuls=elf_s390
897			targ_extra_libpath=$targ_extra_emuls
898			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
899			;;
900s390x-*-tpf*)		targ_emul=elf64_s390
901			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'`
902			;;
903s390-*-linux*)		targ_emul=elf_s390
904			targ64_extra_emuls=elf64_s390
905			targ64_extra_libpath=elf64_s390
906			tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
907			;;
908score-*-elf)		targ_emul=score7_elf
909			targ_extra_emuls=score3_elf
910			;;
911sh-*-linux*)		targ_emul=shlelf_linux
912			targ_extra_emuls="shelf_linux shlelf_fd shelf_fd"
913			targ_extra_libpath=shelf_linux
914			;;
915sh*eb-*-linux*)		targ_emul=shelf_linux
916			targ_extra_emuls="shelf_fd"
917			;;
918sh*-*-linux*)		targ_emul=shlelf_linux
919			targ_extra_emuls="shlelf_fd"
920			;;
921sh*l*-*-netbsdaout*)	targ_emul=shl
922			targ_extra_emuls=sh
923			;;
924sh*-*-netbsdaout*)	targ_emul=sh
925			targ_extra_emuls=shl
926			;;
927sh*l*-*-netbsd*)	targ_emul=shlelf_nbsd
928			targ_extra_emuls=shelf_nbsd
929			;;
930sh*-*-netbsd*)	targ_emul=shelf_nbsd
931			targ_extra_emuls=shlelf_nbsd
932			;;
933shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
934			targ_emul=shlelf
935			targ_extra_emuls="shelf shl sh"
936			;;
937sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*)
938			targ_emul=shelf
939			targ_extra_emuls="shlelf sh shl"
940			;;
941sh-*-uclinux* | sh[12]-*-uclinux*)
942			targ_emul=shelf_uclinux
943			targ_extra_emuls="shelf shlelf sh shl shelf_fd shlelf_fd"
944			;;
945sh-*-vxworks)		targ_emul=shelf_vxworks
946			targ_extra_emuls=shlelf_vxworks
947			;;
948sh-*-nto*)		targ_emul=shelf_nto
949			targ_extra_emuls=shlelf_nto
950			;;
951sh-*-pe)		targ_emul=shpe ;
952			targ_extra_ofiles="deffilep.o pe-dll.o"
953			;;
954sh-*-*)			targ_emul=sh;
955			targ_extra_emuls=shl
956			targ_extra_ofiles=
957			;;
958sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
959			targ_emul=elf64_sparc_fbsd
960			targ_extra_emuls="elf64_sparc elf32_sparc"
961			targ_extra_libpath=$targ_extra_emuls
962			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
963			;;
964sparc64-*-linux-*)	targ_emul=elf64_sparc
965			targ_extra_emuls="elf32_sparc"
966			targ_extra_libpath=elf32_sparc
967			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
968			;;
969sparc64-*-*bsd*)	targ_emul=elf64_sparc
970			targ_extra_emuls="elf32_sparc"
971			;;
972sparc64-*-solaris2* | sparcv9-*-solaris2*)
973			targ_emul=elf64_sparc_sol2
974			targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
975			targ_extra_libpath=$targ_extra_emuls
976			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
977			;;
978sparc64-*-haiku*)	targ_emul=elf64_sparc
979			;;
980sparc64-*-*)		targ_emul=elf64_sparc
981			;;
982sparc*-*-linux-*)	targ_emul=elf32_sparc
983			targ_extra_emuls="elf64_sparc"
984			targ_extra_libpath=elf64_sparc
985			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
986			;;
987sparc64-*-netbsd*)	targ_emul=elf64_sparc
988			targ_extra_emuls="elf32_sparc"
989			;;
990sparc64-*-openbsd*)	targ_emul=elf64_sparc
991			targ_extra_emuls="elf32_sparc"
992			;;
993sparc*-*-netbsd*elf*)	targ_emul=elf32_sparc
994			;;
995sparc*-*-netbsd*)	targ_emul=sparcnbsd
996			;;
997sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
998			targ_emul=elf32_sparc_sol2
999			targ_extra_emuls=elf32_sparc
1000			;;
1001sparc-*-solaris2*)	targ_emul=elf32_sparc_sol2
1002			targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
1003			targ_extra_libpath=$targ_extra_emuls
1004			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
1005			;;
1006sparc*-*-vxworks*)	targ_emul=elf32_sparc_vxworks
1007			;;
1008sparc*-*-*)		targ_emul=elf32_sparc
1009			;;
1010spu-*-elf*)		targ_emul=elf32_spu
1011			;;
1012tic30-*-*coff*)		targ_emul=tic30coff
1013			targ_extra_ofiles=
1014			;;
1015tic4x-*-* | c4x-*-*)	targ_emul=tic4xcoff
1016			targ_extra_emuls="tic3xcoff tic3xcoff_onchip"
1017			targ_extra_ofiles=
1018			;;
1019tic54x-*-* | c54x*-*-*)	targ_emul=tic54xcoff
1020			targ_extra_ofiles=
1021			;;
1022tic6x-*-elf)		targ_emul=elf32_tic6x_elf_le
1023			targ_extra_emuls="elf32_tic6x_elf_be elf32_tic6x_le elf32_tic6x_be"
1024			targ_extra_libpath=$targ_extra_emuls
1025			;;
1026tic6x-*-uclinux)	targ_emul=elf32_tic6x_linux_le
1027			targ_extra_emuls="elf32_tic6x_linux_be elf32_tic6x_le elf32_tic6x_be"
1028			targ_extra_libpath=$targ_extra_emuls
1029			;;
1030tilegx-*-*)		targ_emul=elf64tilegx
1031			targ_extra_emuls="elf64tilegx_be elf32tilegx elf32tilegx_be"
1032			targ_extra_libpath=$targ_extra_emuls
1033			;;
1034tilegxbe-*-*)		targ_emul=elf64tilegx_be
1035			targ_extra_emuls="elf64tilegx elf32tilegx elf32tilegx_be"
1036			targ_extra_libpath=$targ_extra_emuls
1037			;;
1038tilepro-*-*)		targ_emul=elf32tilepro
1039			;;
1040v850*-*-*)		targ_emul=v850_rh850
1041			targ_extra_emuls=v850
1042			;;
1043vax-*-netbsdaout*)	targ_emul=vaxnbsd
1044			targ_extra_emuls=elf32vax
1045			;;
1046vax-*-netbsd*)		targ_emul=elf32vax
1047			targ_extra_emuls=vaxnbsd
1048			;;
1049vax-*-linux-*)		targ_emul=elf32vax
1050			;;
1051visium-*-elf)		targ_emul=elf32visium
1052			;;
1053x86_64-*-rdos*)		targ_emul=elf64rdos
1054			;;
1055x86_64-*-cloudabi*)	targ_emul=elf_x86_64_cloudabi
1056			;;
1057x86_64-*-haiku*)	targ_emul=elf_x86_64_haiku
1058			targ_extra_emuls="elf_x86_64 elf_i386_haiku"
1059			;;
1060x86_64-*-linux-gnux32)	targ_emul=elf32_x86_64
1061			targ_extra_emuls="elf_x86_64 elf_i386 elf_iamcu"
1062			targ_extra_libpath="elf_i386 elf_iamcu elf_x86_64"
1063			tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
1064			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
1065			;;
1066x86_64-*-linux-*)	targ_emul=elf_x86_64
1067			targ_extra_emuls="elf32_x86_64 elf_i386 elf_iamcu"
1068			targ_extra_libpath="elf_i386 elf32_x86_64"
1069			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1070			;;
1071x86_64-*-redox*)	targ_emul=elf_x86_64
1072			targ_extra_emuls=elf_i386
1073			;;
1074x86_64-*-solaris2*)	targ_emul=elf_x86_64_sol2
1075			targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu"
1076			targ_extra_libpath=$targ_extra_emuls
1077			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1078			;;
1079x86_64-*-netbsd* | x86_64-*-openbsd*)
1080			targ_emul=elf_x86_64
1081			targ_extra_emuls="elf_i386 elf_iamcu"
1082			tdir_elf_iamcu=`echo ${targ_alias} | \
1083			    sed -e 's/x86_64/i386/' -e 's/aout//'`
1084			tdir_elf_i386=`echo ${targ_alias} | \
1085			    sed -e 's/x86_64/i386/' -e 's/aout//'`
1086			;;
1087x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
1088			targ_emul=elf_x86_64
1089			targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64"
1090			targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64"
1091			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
1092			;;
1093x86_64-*-dragonfly*)	targ_emul=elf_x86_64
1094			targ_extra_emuls="elf_i386 elf_iamcu"
1095			;;
1096x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
1097			targ_emul=elf_x86_64_fbsd
1098			targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu"
1099			targ_extra_libpath="elf_i386_fbsd"
1100			tdir_elf_i386_fbsd=`echo ${targ_alias} \
1101			    | sed -e 's/x86_64/i386/'`
1102			tdir_elf_iamcu=`echo ${targ_alias} \
1103			    | sed -e 's/x86_64/i386/'`
1104			tdir_elf_i386=`echo ${targ_alias} \
1105			    | sed -e 's/x86_64/i386/'`
1106			;;
1107x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
1108			targ_extra_emuls=i386pe ;
1109			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1110			;;
1111x86_64-*-cygwin)	targ_emul=i386pep ;
1112			targ_extra_emuls=i386pe
1113			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1114			test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api'
1115			;;
1116x86_64-*-mingw*)	targ_emul=i386pep ;
1117			targ_extra_emuls=i386pe
1118			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
1119			;;
1120xgate-*-*)		targ_emul=xgateelf
1121			targ_extra_ofiles=ldelfgen.o
1122			;;
1123xstormy16-*-*)		targ_emul=elf32xstormy16
1124			;;
1125xtensa*-*-*)		targ_emul=elf32xtensa
1126			;;
1127z80-*-elf*)		targ_emul=elf32z80
1128			targ_extra_ofiles="ldelf.o ldelfgen.o"
1129			;;
1130z80-*-coff)		targ_emul=z80
1131			targ_extra_ofiles=
1132			;;
1133z8k-*-coff)		targ_emul=z8002
1134			targ_extra_emuls=z8001
1135			targ_extra_ofiles=
1136			;;
1137loongarch32-*)		targ_emul=elf32loongarch
1138			;;
1139loongarch64-*)		targ_emul=elf64loongarch
1140			;;
1141*-*-ieee*)		targ_emul=vanilla
1142			targ_extra_ofiles=
1143			;;
1144*)
1145  echo 2>&1 "*** ld does not support target ${targ}"
1146  echo 2>&1 "*** see ld/configure.tgt for supported targets"
1147  exit 1
1148
1149esac
1150
1151NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
1152case "${target}" in
1153
1154*-*-dragonfly*)
1155  NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
1156  ;;
1157
1158*-*-freebsd*)
1159  NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
1160  ;;
1161
1162hppa*64*-*-hpux11*)
1163  NATIVE_LIB_DIRS=/usr/lib/pa20_64
1164  ;;
1165
1166i[3-7]86-*-sysv4*)
1167  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1168  ;;
1169
1170i[3-7]86-*-solaris*)
1171  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1172  ;;
1173
1174i[3-7]86-pc-interix*)
1175  NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
1176  ;;
1177
1178ia64-*-aix*)
1179  NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
1180  ;;
1181
1182sparc*-*-solaris2*)
1183  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1184  ;;
1185
1186spu-*-elf*)
1187  # This allows one to build a pair of PPU/SPU toolchains with common sysroot.
1188  NATIVE_LIB_DIRS='/lib'
1189  ;;
1190
1191i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
1192  NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
1193  ;;
1194
1195*-*-linux*)
1196  ;;
1197
1198*-*-netbsd*)
1199  ;;
1200
1201alpha*-*-*)
1202  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
1203  ;;
1204
1205esac
1206
1207case "${target}" in
1208frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*)
1209  # Don't enable -z relro by default since many relro tests fail on these
1210  # targets:
1211  # FAIL: strip -z relro (relro1)
1212  # FAIL: strip -z relro -shared (relro1)
1213  # FAIL: objcopy -z relro (relro1)
1214  # FAIL: objcopy -z relro -shared (relro1)
1215  # FAIL: objcopy -z relro (tdata1)
1216  # FAIL: objcopy -shared -z relro (tdata1)
1217  # FAIL: objcopy -z relro (tdata2)
1218  # FAIL: objcopy -shared -z relro (tdata2)
1219  # FAIL: objcopy -z relro (tdata3)
1220  # FAIL: objcopy -shared -z relro (tdata3)
1221  # FAIL: objcopy -shared -z relro (tbss1)
1222  # FAIL: objcopy -shared -z relro (tbss2)
1223  # FAIL: objcopy -shared -z relro (tbss3)
1224  ;;
1225*-*-linux*)
1226  if test ${ac_default_ld_z_relro} = unset; then
1227    ac_default_ld_z_relro=1
1228  fi
1229  ;;
1230esac
1231
1232# Enable -z separate-code and --warn-textrel by default for Linux/x86.
1233case "${target}" in
1234i[3-7]86-*-linux-* | x86_64-*-linux-* | i[3-7]86-*-netbsd* | x86_64-*-netbsd*)
1235  if test ${ac_default_ld_z_separate_code} = unset; then
1236    ac_default_ld_z_separate_code=1
1237  fi
1238  if test ${ac_default_ld_textrel_check} = unset; then
1239    ac_default_ld_textrel_check=yes
1240  fi
1241  ;;
1242esac
1243