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