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