1# configure.tgt
2#
3#   Copyright (C) 2013-2017 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=
40targ64_extra_emuls=
41targ64_extra_libpath=
42
43# Please try to keep this table in alphabetic order - it makes it
44# much easier to lookup a specific archictecture.  Naturally any
45# architecture variants should be kept together even if their names
46# break the alpha sorting.
47case "${targ}" in
48aarch64_be-*-elf)	targ_emul=aarch64elfb
49			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
50aarch64-*-elf | aarch64-*-rtems*)
51			targ_emul=aarch64elf
52			targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb" ;;
53aarch64-*-cloudabi*)	targ_emul=aarch64cloudabi
54			targ_extra_emuls=aarch64cloudabib ;;
55aarch64-*-freebsd*)	targ_emul=aarch64fbsd
56			targ_extra_emuls="aarch64fbsdb aarch64elf" ;;
57aarch64-*-fuchsia*)	targ_emul=aarch64elf
58			targ_extra_emuls="aarch64elfb armelf armelfb" ;;
59aarch64_be-*-linux*)	targ_emul=aarch64linuxb
60			targ_extra_libpath="aarch64linux aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
61			targ_extra_emuls="aarch64elfb aarch64elf aarch64elf32 aarch64elf32b armelfb armelf $targ_extra_libpath" ;;
62aarch64-*-linux*)	targ_emul=aarch64linux
63			targ_extra_libpath="aarch64linuxb aarch64linux32 aarch64linux32b armelfb_linux_eabi armelf_linux_eabi"
64			targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb $targ_extra_libpath" ;;
65alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
66		        targ_emul=elf64alpha_fbsd
67			targ_extra_emuls="elf64alpha alpha"
68			tdir_alpha=`echo ${targ_alias} | sed -e 's/freebsd/freebsdecoff/'` ;;
69alpha*-*-linux*ecoff*)	targ_emul=alpha targ_extra_emuls=elf64alpha
70			tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'` ;;
71alpha*-*-linux-*)	targ_emul=elf64alpha targ_extra_emuls=alpha
72			tdir_alpha=`echo ${targ_alias} | sed -e 's/linux\(-gnu\)*/linux\1ecoff/'` ;;
73alpha*-*-osf*)		targ_emul=alpha ;;
74alpha*-*-gnu*)		targ_emul=elf64alpha ;;
75alpha*-*-netware*)	targ_emul=alpha ;;
76alpha*-*-netbsd*)	targ_emul=elf64alpha_nbsd ;;
77alpha*-*-openbsd*)	targ_emul=elf64alpha ;;
78alpha*-*-*vms*)		targ_emul=alphavms
79			;;
80arc*-*-elf*)		targ_emul=arcelf
81            		targ_extra_emuls="arcelf_prof arclinux arclinux_prof arcv2elf arcv2elfx"
82            		;;
83arc*-*-linux*)		targ_emul=arclinux
84			targ_extra_emuls="arclinux_prof arcelf arcelf_prof arcv2elf arcv2elfx"
85			;;
86arm-epoc-pe)		targ_emul=arm_epoc_pe ;	targ_extra_ofiles="deffilep.o pe-dll.o" ;;
87arm*-*-cegcc*)		targ_emul=arm_wince_pe ; targ_extra_ofiles="deffilep.o pe-dll.o"
88			LIB_PATH='${tooldir}/lib/w32api' ;;
89arm-wince-pe | arm-*-wince | arm*-*-mingw32ce*)
90			targ_emul=arm_wince_pe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
91arm-*-pe)		targ_emul=armpe ; targ_extra_ofiles="deffilep.o pe-dll.o" ;;
92arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
93armeb-*-aout)		targ_emul=armaoutb ;;
94arm-*-coff)		targ_emul=armcoff ;;
95arm*b-*-freebsd*)	targ_emul=armelfb_fbsd
96			targ_extra_emuls="armelf_fbsd armelf" ;;
97arm*-*-freebsd* | arm-*-kfreebsd*-gnu)
98	       		targ_emul=armelf_fbsd
99			targ_extra_emuls="armelfb_fbsd armelf" ;;
100armeb-*-netbsdelf*)	targ_emul=armelfb_nbsd;
101			targ_extra_emuls="armelf_nbsd armelf armnbsd" ;;
102arm-*-netbsdelf*)	targ_emul=armelf_nbsd;
103			targ_extra_emuls="armelfb_nbsd armelf armnbsd" ;;
104arm-*-netbsd*)		targ_emul=armnbsd;
105			targ_extra_emuls="armelf armelf_nbsd armelfb_nbsd"  ;;
106arm-*-nto*)		targ_emul=armnto ;;
107arm-*-openbsd*)		targ_emul=armnbsd ;;
108arm-*-phoenix*)		targ_emul=armelf ;;
109arm-*-rtems*)		targ_emul=armelf ;;
110armeb-*-elf | armeb-*-eabi*)
111			targ_emul=armelfb ;;
112arm-*-elf | arm*-*-eabi*)
113	  		targ_emul=armelf ;;
114arm*-*-symbianelf*)     targ_emul=armsymbian;;
115arm-*-kaos*)		targ_emul=armelf ;;
116arm9e-*-elf)		targ_emul=armelf ;;
117arm*b-*-linux-*eabi*)	targ_emul=armelfb_linux_eabi
118			targ_extra_emuls=armelf_linux_eabi
119			targ_extra_libpath=$targ_extra_emuls
120			;;
121arm*b-*-linux-*)	targ_emul=armelfb_linux
122			targ_extra_emuls="armelfb armelf armelf_linux"
123			targ_extra_libpath="armelf_linux"
124			;;
125arm*-*-linux-*eabi*)	targ_emul=armelf_linux_eabi
126			targ_extra_emuls=armelfb_linux_eabi
127			targ_extra_libpath=$targ_extra_emuls
128			;;
129arm*-*-linux-*)	        targ_emul=armelf_linux
130			targ_extra_emuls="armelf armelfb armelfb_linux"
131			targ_extra_libpath="armelfb_linux"
132			;;
133arm*b-*-nacl*)		targ_emul=armelfb_nacl
134			targ_extra_emuls="armelf_nacl elf_i386_nacl"
135			targ_extra_libpath=$targ_extra_emuls
136			targ64_extra_emuls="elf32_x86_64_nacl elf_x86_64_nacl"
137			targ64_extra_libpath=$targ64_extra_emuls
138			;;
139arm*-*-nacl*)		targ_emul=armelf_nacl
140			targ_extra_emuls="armelfb_nacl elf_i386_nacl"
141			targ_extra_libpath=$targ_extra_emuls
142			targ64_extra_emuls="elf32_x86_64_nacl elf_x86_64_nacl"
143			targ64_extra_libpath=$targ64_extra_emuls
144			;;
145arm*-*-uclinux*eabi*)	targ_emul=armelf_linux_eabi
146			targ_extra_emuls=armelfb_linux_eabi
147			targ_extra_libpath=$targ_extra_emuls
148			;;
149arm*-*-uclinux*)	targ_emul=armelf_linux
150			targ_extra_emuls="armelf armelfb armelfb_linux"
151			targ_extra_libpath="armelfb_linux"
152			;;
153arm-*-vxworks)		targ_emul=armelf_vxworks ;;
154arm*-*-conix*)		targ_emul=armelf ;;
155arm*-*-fuchsia*)	targ_emul=armelf_fuchsia
156			targ_extra_emuls="armelfb_fuchsia armelf armelfb"
157			;;
158arm*-*-haiku*)         targ_emul=armelf_haiku; targ_extra_emuls=armelf ;;
159avr-*-*)		targ_emul=avr2
160			targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny"
161			;;
162bfin-*-elf)		targ_emul=elf32bfin;
163			targ_extra_emuls="elf32bfinfd"
164			targ_extra_libpath=$targ_extra_emuls
165			;;
166bfin-*-rtems*)		targ_emul=elf32bfin;
167			targ_extra_emuls="elf32bfinfd"
168			targ_extra_libpath=$targ_extra_emuls
169			;;
170bfin-*-uclinux*)	targ_emul=elf32bfin;
171			targ_extra_emuls="elf32bfinfd"
172			targ_extra_libpath=$targ_extra_emuls
173			;;
174bfin-*-linux-uclibc*)	targ_emul=elf32bfinfd;
175			targ_extra_emuls="elf32bfin"
176			targ_extra_libpath=$targ_extra_emuls
177			;;
178cr16-*-elf*)            targ_emul=elf32cr16 ;;
179cr16c-*-elf*)           targ_emul=elf32cr16c
180			;;
181cris-*-*aout*)		targ_emul=crisaout
182			targ_extra_emuls="criself crislinux"
183			targ_extra_libpath=$targ_extra_emuls ;;
184cris-*-linux-* | crisv32-*-linux-*)
185			targ_emul=crislinux ;;
186cris-*-* | crisv32-*-*)	targ_emul=criself
187			targ_extra_emuls="crisaout crislinux"
188			targ_extra_libpath=$targ_extra_emuls
189			;;
190crx-*-elf*)		targ_emul=elf32crx
191			;;
192d10v-*-*)		targ_emul=d10velf ;;
193d30v-*-*ext*)		targ_emul=d30v_e; targ_extra_emuls="d30velf d30v_o" ;;
194d30v-*-*onchip*)	targ_emul=d30v_o; targ_extra_emuls="d30velf d30v_e" ;;
195d30v-*-*)		targ_emul=d30velf; targ_extra_emuls="d30v_e d30v_o"
196			;;
197dlx-*-elf*)		targ_emul=elf32_dlx
198			;;
199epiphany-*-elf)		targ_emul=elf32epiphany
200			targ_extra_emuls="elf32epiphany_4x4"
201			;;
202fido*-*-elf*)		targ_emul=m68kelf ;;
203fr30-*-*)		targ_emul=elf32fr30
204			;;
205frv-*-*linux*)		targ_emul=elf32frvfd ;;
206frv-*-*)		targ_emul=elf32frv ; targ_extra_emuls="elf32frvfd"
207			;;
208moxie-*-moxiebox*)	targ_emul=moxiebox
209			;;
210moxie-*-*)		targ_emul=elf32moxie
211			;;
212h8300-*-hms* | h8300-*-coff* | h8300-*-rtemscoff*)
213			targ_emul=h8300; targ_extra_emuls="h8300h h8300s h8300hn h8300sn h8300sx h8300sxn" ;;
214h8300-*-elf* | h8300-*-rtems*)
215			targ_emul=h8300elf;
216			targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf" ;;
217h8300-*-linux*)
218			targ_emul=h8300elf_linux;
219			targ_extra_emuls="h8300helf_linux h8300self_linux h8300sxelf_linux" ;;
220h8500-*-hms* | h8500-*-coff* | h8500-*-rtems*)
221			targ_emul=h8500
222			targ_extra_emuls="h8500s h8500b h8500m h8500c"
223			;;
224hppa*64*-*-linux-*)	targ_emul=hppa64linux ;;
225hppa*64*-hpux*)		targ_emul=elf64hppa ;;
226hppa*-*-linux-*)	targ_emul=hppalinux ;;
227hppa*-*-*elf*)		targ_emul=hppaelf ;;
228hppa*-*-lites*)		targ_emul=hppaelf ;;
229hppa*-*-netbsd*)	targ_emul=hppanbsd ;;
230hppa*-*-openbsd*)	targ_emul=hppaobsd
231			;;
232i370-*-elf* | i370-*-linux-*) targ_emul=elf32i370
233			;;
234i[3-7]86-*-nto-qnx*)	targ_emul=i386nto ;;
235i[3-7]86-*-vsta)	targ_emul=vsta ;;
236i[3-7]86-*-go32)	targ_emul=i386go32 ;;
237i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32 ;;
238i[3-7]86-*-aix*)	targ_emul=i386coff ;;
239i[3-7]86-*-sco*)	targ_emul=i386coff ;;
240i[3-7]86-*-isc*)	targ_emul=i386coff ;;
241i[3-7]86-*-lynxos*)	targ_emul=i386lynx ;;
242i[3-7]86-*-coff)	targ_emul=i386coff ;;
243i[3-7]86-*-rtems*)	targ_emul=elf_i386
244			targ_extra_emuls=elf_iamcu ;;
245i[3-7]86-*-aros*)	targ_emul=elf_i386
246			targ_extra_emuls=elf_iamcu ;;
247i[3-7]86-*-rdos*)	targ_emul=elf_i386
248			targ_extra_emuls=elf_iamcu ;;
249x86_64-*-rdos*)		targ_emul=elf64rdos ;;
250x86_64-*-cloudabi*)	targ_emul=elf_x86_64_cloudabi ;;
251i[3-7]86-*-bsd)		targ_emul=i386bsd ;;
252i[3-7]86-*-bsd386)	targ_emul=i386bsd ;;
253i[3-7]86-*-bsdi*)	targ_emul=i386bsd ;;
254i[3-7]86-*-aout)	targ_emul=i386aout ;;
255i[3-7]86-*-linux*aout*)	targ_emul=i386linux
256			targ_extra_emuls="elf_i386 elf_iamcu"
257			tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/aout//'`
258			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'` ;;
259i[3-7]86-*-linux*oldld)	targ_emul=i386linux
260			targ_extra_emuls="elf_i386 elf_iamcu" ;;
261i[3-7]86-*-linux-*)	targ_emul=elf_i386
262			targ_extra_emuls="i386linux elf_iamcu"
263			targ64_extra_emuls="elf_x86_64 elf32_x86_64 elf_l1om elf_k1om"
264			targ64_extra_libpath=elf_x86_64
265			targ_extra_libpath=elf32_x86_64
266			tdir_i386linux=${targ_alias}aout ;;
267x86_64-*-linux-gnux32)	targ_emul=elf32_x86_64
268			targ_extra_emuls="elf_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om"
269			targ_extra_libpath="elf_i386 elf_iamcu elf_x86_64 elf_l1om elf_k1om"
270			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
271			tdir_elf_iamcu=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'`
272			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/' -e 's/-linux-gnux32/-linux-gnu/'` ;;
273x86_64-*-linux-*)	targ_emul=elf_x86_64
274			targ_extra_emuls="elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om"
275			targ_extra_libpath="elf_i386 elf32_x86_64 elf_l1om elf_k1om"
276			tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
277			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
278i[3-7]86-*-sysv[45]*)	targ_emul=elf_i386
279			targ_extra_emuls=elf_iamcu ;;
280i[3-7]86-*-solaris2*)	targ_emul=elf_i386_sol2
281                        targ_extra_emuls="elf_i386_ldso elf_i386 elf_iamcu elf_x86_64_sol2 elf_x86_64 elf_l1om elf_k1om"
282			targ_extra_libpath=$targ_extra_emuls
283                        ;;
284x86_64-*-solaris2*)
285			targ_emul=elf_x86_64_sol2
286			targ_extra_emuls="elf_x86_64 elf_i386_sol2 elf_i386_ldso elf_i386 elf_iamcu elf_l1om elf_k1om"
287			targ_extra_libpath=$targ_extra_emuls
288			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'` ;;
289i[3-7]86-*-unixware)	targ_emul=elf_i386
290			targ_extra_emuls=elf_iamcu ;;
291i[3-7]86-*-solaris*)	targ_emul=elf_i386_ldso
292                        targ_extra_emuls="elf_i386"
293			targ_extra_libpath=$targ_extra_emuls
294                        ;;
295i[3-7]86-*-netbsdelf* | \
296i[3-7]86-*-netbsd*-gnu* | \
297i[3-7]86-*-knetbsd*-gnu)
298			targ_emul=elf_i386
299			targ_extra_emuls="elf_iamcu i386nbsd" ;;
300i[3-7]86-*-netbsdpe*)	targ_emul=i386pe
301			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
302i[3-7]86-*-netbsd*)	targ_emul=i386nbsd
303			targ_extra_emuls=elf_i386 ;;
304x86_64-*-netbsd*)	targ_emul=elf_x86_64
305			targ_extra_emuls="elf_i386 elf_iamcu i386nbsd elf_l1om elf_k1om"
306			tdir_elf_iamcu=`echo ${targ_alias} | \
307			    sed -e 's/x86_64/i386/'`
308			case "${tdir_elf_iamcu}" in
309			*-netbsdelf*)   ;;
310			*)		tdir_elf_iamcu=`echo ${tdir_elf_iamcu} | \
311				        sed -e 's/netbsd/netbsdelf/'`;;
312			esac
313			tdir_elf_i386=`echo ${targ_alias} | \
314			    sed -e 's/x86_64/i386/'`
315			case "${tdir_elf_i386}" in
316			*-netbsdelf*)   ;;
317			*)		tdir_elf_i386=`echo ${tdir_elf_i386} | \
318				        sed -e 's/netbsd/netbsdelf/'`;;
319			esac ;;
320i[3-7]86-*-netware)	targ_emul=i386nw ;;
321i[3-7]86-*-elfiamcu)	targ_emul=elf_iamcu
322			targ_extra_emuls=elf_i386 ;;
323i[3-7]86-*-elf*)	targ_emul=elf_i386
324			targ_extra_emuls=elf_iamcu ;;
325x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia*)
326			targ_emul=elf_x86_64
327			targ_extra_emuls="elf_i386 elf_iamcu elf32_x86_64 elf_l1om elf_k1om"
328			targ_extra_libpath="elf_i386 elf_iamcu elf32_x86_64 elf_l1om elf_k1om"
329			tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
330			;;
331i[3-7]86-*-kaos*)	targ_emul=elf_i386 ;;
332i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
333			targ_emul=i386bsd ;;
334i[3-7]86-*-dragonfly*)	targ_emul=elf_i386
335			targ_extra_emuls="elf_iamcu i386bsd" ;;
336x86_64-*-dragonfly*)	targ_emul=elf_x86_64
337			targ_extra_emuls="elf_i386 elf_iamcu elf_l1om elf_k1om" ;;
338i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
339		        targ_emul=elf_i386_fbsd
340			targ_extra_emuls="elf_i386 elf_iamcu i386bsd" ;;
341x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
342			targ_emul=elf_x86_64_fbsd
343			targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu elf_l1om elf_l1om_fbsd elf_k1om elf_k1om_fbsd"
344			targ_extra_libpath="elf_i386_fbsd"
345			tdir_elf_i386_fbsd=`echo ${targ_alias} \
346			    | sed -e 's/x86_64/i386/'`
347			tdir_elf_iamcu=`echo ${targ_alias} \
348			    | sed -e 's/x86_64/i386/'`
349			tdir_elf_i386=`echo ${targ_alias} \
350			    | sed -e 's/x86_64/i386/'` ;;
351i[3-7]86-*-sysv*)	targ_emul=i386coff ;;
352i[3-7]86-*-ptx*)	targ_emul=i386coff ;;
353i[3-7]86-*-mach*)	targ_emul=i386mach ;;
354i[3-7]86-*-gnu*)	targ_emul=elf_i386
355			targ_extra_emuls=elf_iamcu ;;
356i[3-7]86-*-msdos*)	targ_emul=i386msdos; targ_extra_emuls=i386aout ;;
357i[3-7]86-*-moss*)	targ_emul=i386moss; targ_extra_emuls=i386msdos ;;
358i[3-7]86-*-winnt*)	targ_emul=i386pe ;
359			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
360i[3-7]86-*-pe)		targ_emul=i386pe ;
361			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
362i[3-7]86-*-cygwin*)	targ_emul=i386pe ;
363			targ_extra_ofiles="deffilep.o pe-dll.o" ;
364			test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
365i[3-7]86-*-mingw32*)	targ_emul=i386pe ;
366			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
367x86_64-*-pe | x86_64-*-pep) targ_emul=i386pep ;
368			targ_extra_emuls=i386pe ;
369			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
370x86_64-*-cygwin)	targ_emul=i386pep ;
371			targ_extra_emuls=i386pe
372			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o"
373			test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
374x86_64-*-mingw*)	targ_emul=i386pep ;
375			targ_extra_emuls=i386pe
376			targ_extra_ofiles="deffilep.o pep-dll.o pe-dll.o" ;;
377i[3-7]86-*-interix*)	targ_emul=i386pe_posix;
378 			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
379i[3-7]86-*-beospe*)	targ_emul=i386beos ;;
380i[3-7]86-*-beos*)	targ_emul=elf_i386_be ;;
381i[3-7]86-*-haiku*)	targ_emul=elf_i386_haiku ;;
382x86_64-*-haiku*)	targ_emul=elf_x86_64_haiku
383			targ_extra_emuls="elf_x86_64 elf_i386_haiku" ;;
384i[3-7]86-*-vxworks*)	targ_emul=elf_i386_vxworks ;;
385i[3-7]86-*-chaos)	targ_emul=elf_i386_chaos
386			;;
387i[3-7]86-*-nacl*)	targ_emul=elf_i386_nacl
388			targ_extra_emuls="armelf_nacl armelfb_nacl"
389			targ_extra_libpath=$targ_extra_emuls
390			targ64_extra_emuls="elf32_x86_64_nacl elf_x86_64_nacl"
391			targ64_extra_libpath=$targ64_extra_emuls
392			;;
393x86_64-*-nacl*)		targ_emul=elf32_x86_64_nacl
394			targ_extra_emuls="elf_i386_nacl elf_x86_64_nacl armelf_nacl armelfb_nacl"
395			targ_extra_libpath=$targ_extra_emuls
396			tdir_elf_i386_nacl=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
397			;;
398i860-*-coff)		targ_emul=coff_i860 ;;
399i860-stardent-sysv4* | i860-stardent-elf*)
400			targ_emul=elf32_i860
401			;;
402i960-wrs-vxworks5.0*)	targ_emul=gld960 ;;
403i960-wrs-vxworks5*)	targ_emul=gld960coff ;;
404i960-wrs-vxworks*)	targ_emul=gld960 ;;
405i960-*-coff)		targ_emul=gld960coff ;;
406i960-intel-nindy)	targ_emul=gld960 ;;
407i960-*-rtems*)		targ_emul=gld960coff ;;
408i960-*-elf*)		targ_emul=elf32_i960
409			;;
410ia64-*-elf*)		targ_emul=elf64_ia64 ;;
411ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
412		        targ_emul=elf64_ia64_fbsd
413			targ_extra_emuls="elf64_ia64" ;;
414ia64-*-netbsd*)		targ_emul=elf64_ia64 ;;
415ia64-*-linux*)		targ_emul=elf64_ia64 ;;
416ia64-*-*vms*)		targ_emul=elf64_ia64_vms ;;
417ia64-*-aix*)		targ_emul=elf64_aix
418			;;
419ip2k-*-elf)		targ_emul=elf32ip2k
420			;;
421iq2000-*-elf)           targ_emul=elf32iq2000 ; targ_extra_emuls="elf32iq10"
422			;;
423lm32-*-*linux*)         targ_emul=elf32lm32fd ;;
424lm32-*-*)               targ_emul=elf32lm32 ; targ_extra_emuls="elf32lm32fd"
425                        ;;
426m32c-*-elf | m32c-*-rtems*)
427			targ_emul=elf32m32c
428			;;
429m32r*le-*-elf*)         targ_emul=m32rlelf ;;
430m32r*-*-elf* | m32r*-*-rtems*)
431			targ_emul=m32relf ;;
432m32r*le-*-linux-*)      targ_emul=m32rlelf_linux ;;
433m32r*-*-linux-*)        targ_emul=m32relf_linux
434			;;
435m68hc11-*-*|m6811-*-*)	targ_emul=m68hc11elf
436			targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;;
437m68hc12-*-*|m6812-*-*)	targ_emul=m68hc12elf
438			targ_extra_emuls="m68hc12elfb m68hc11elf m68hc11elfb" ;;
439m68*-sun-sunos[34]*)	targ_emul=sun3 ;;
440m68*-wrs-vxworks*)	targ_emul=sun3 ;;
441m68*-ericsson-ose)	targ_emul=sun3 ;;
442m68*-apple-aux*)	targ_emul=m68kaux ;;
443m68k-sony-*)		targ_emul=news ;;
444m68k-hp-bsd*)		targ_emul=hp300bsd ;;
445m68*-motorola-sysv*)	targ_emul=delta68 ;;
446m68*-*-aout)		targ_emul=m68kaout ;;
447m68*-*-coff)		targ_emul=m68kcoff ;;
448m68*-*-elf)		targ_emul=m68kelf ;;
449m68*-*-hpux*)		targ_emul=hp3hpux ;;
450m68k-*-linux*aout*)	targ_emul=m68klinux
451			targ_extra_emuls=m68kelf
452			tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'` ;;
453m68k-*-linux-*) 	targ_emul=m68kelf
454			targ_extra_emuls=m68klinux
455			tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'` ;;
456m68k-*-uclinux*)	targ_emul=m68kelf ;;
457m68*-*-gnu*)		targ_emul=m68kelf ;;
458m68*-*-netbsd*4k*)	targ_emul=m68k4knbsd
459			targ_extra_emuls="m68knbsd m68kelfnbsd" ;;
460m68*-*-netbsdelf*)	targ_emul=m68kelfnbsd
461			targ_extra_emuls="m68knbsd m68k4knbsd" ;;
462m68*-*-netbsdaout* | m68*-*-netbsd*)
463			targ_emul=m68knbsd
464			targ_extra_emuls="m68kelfnbsd m68k4knbsd" ;;
465m68*-*-psos*)		targ_emul=m68kpsos ;;
466m68*-*-rtemscoff*)	targ_emul=m68kcoff ;;
467m68*-*-rtems*)		targ_emul=m68kelf ;;
468m68*-*-haiku*)		targ_emul=m68kelf
469			targ_extra_emuls=m68kcoff
470			;;
471m8*-*-*)		targ_emul=m88kbcs
472			;;
473mcore-*-pe)		targ_emul=mcorepe ;
474			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
475mcore-*-elf)		targ_emul=elf32mcore
476			;;
477mep-*-elf)		targ_emul=elf32mep ;;
478metag-*-*)		targ_emul=elf32metag ;;
479microblazeel*-linux*)	targ_emul="elf32mbel_linux"
480			targ_extra_emuls="elf32mb_linux"
481			;;
482microblaze*-linux*)	targ_emul="elf32mb_linux"
483			targ_extra_emuls="elf32mbel_linux"
484			;;
485microblazeel*)		targ_emul=elf32microblazeel
486			targ_extra_emuls=elf32microblaze
487			;;
488microblaze*)		targ_emul=elf32microblaze
489			targ_extra_emuls=elf32microblazeel
490			;;
491mips*-sgi-irix5*)	targ_emul=elf32bsmip ;;
492mips*-sgi-irix6*)	targ_emul=elf32bmipn32
493	                targ_extra_emuls="elf32bsmip elf64bmip"
494			targ_extra_libpath=$targ_extra_emuls ;;
495mips*el-*-netbsd*)	targ_emul=elf32ltsmip
496			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
497			;;
498mips*el-*-haiku*)	targ_emul=elf_mipsel_haiku
499			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" 
500			;;
501mips*-*-netbsd*)	targ_emul=elf32btsmip
502			targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
503  			;;
504mips*vr4300el-*-elf*)	targ_emul=elf32l4300 ;;
505mips*vr4300-*-elf*)	targ_emul=elf32b4300 ;;
506mips*vr4100el-*-elf*)	targ_emul=elf32l4300 ;;
507mips*vr4100-*-elf*)	targ_emul=elf32b4300 ;;
508mips*vr5000el-*-elf*)	targ_emul=elf32l4300 ;;
509mips*vr5000-*-elf*)	targ_emul=elf32b4300 ;;
510mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
511			targ_emul=elf32ltsmip
512			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" ;;
513mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
514			targ_emul=elf32btsmip
515			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip" ;;
516mips64*el-ps2-elf*)	targ_emul=elf32lr5900n32
517			targ_extra_emuls="elf32lr5900"
518			targ_extra_libpath=$targ_extra_emuls ;;
519mips*el-ps2-elf*)	targ_emul=elf32lr5900
520			targ_extra_emuls="elf32lr5900n32"
521			targ_extra_libpath=$targ_extra_emuls ;;
522mips*el-*-elf*)		targ_emul=elf32elmip ;;
523mips*-*-elf*)		targ_emul=elf32ebmip ;;
524mips*-*-rtems*)		targ_emul=elf32ebmip ;;
525mips*el-*-vxworks*)	targ_emul=elf32elmipvxworks
526			targ_extra_emuls="elf32ebmipvxworks" ;;
527mips*-*-vxworks*)	targ_emul=elf32ebmipvxworks
528		        targ_extra_emuls="elf32elmipvxworks" ;;
529mips*-*-windiss)	targ_emul=elf32mipswindiss ;;
530mips64*el-*-linux-*)	targ_emul=elf32ltsmipn32
531			targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
532			targ_extra_libpath=$targ_extra_emuls ;;
533mips64*-*-linux-*)	targ_emul=elf32btsmipn32
534			targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
535			targ_extra_libpath=$targ_extra_emuls ;;
536mips*el-*-linux-*)	targ_emul=elf32ltsmip
537			targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
538			targ_extra_libpath=$targ_extra_emuls ;;
539mips*-*-linux-*)	targ_emul=elf32btsmip
540			targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
541			targ_extra_libpath=$targ_extra_emuls ;;
542mips64*el-*-freebsd* | mips64*el-*-kfreebsd*-gnu)
543			targ_emul=elf32ltsmipn32_fbsd
544			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
545			targ_extra_libpath=$targ_extra_emuls ;;
546mips64*-*-freebsd* | mips64*-*-kfreebsd*-gnu)
547			targ_emul=elf32btsmipn32_fbsd
548			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmip_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
549			targ_extra_libpath=$targ_extra_emuls ;;
550mips*el-*-freebsd* | mips*el-*-kfreebsd*-gnu)
551			targ_emul=elf32ltsmip_fbsd
552			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmipn32_fbsd elf32btsmip_fbsd elf32btsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
553			targ_extra_libpath=$targ_extra_emuls ;;
554mips*-*-freebsd* | mips*-*-kfreebsd*-gnu)
555			targ_emul=elf32btsmip_fbsd
556			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf32btsmipn32 elf64ltsmip elf64btsmip elf32ltsmip_fbsd elf32btsmipn32_fbsd elf32ltsmipn32_fbsd elf64ltsmip_fbsd elf64btsmip_fbsd"
557			targ_extra_libpath=$targ_extra_emuls ;;
558mips*-*-sysv4*)         targ_emul=elf32btsmip
559			;;
560mmix-*-*)		targ_emul=mmo
561			targ_extra_emuls=elf64mmix
562			;;
563am33_2.0-*-linux*)	targ_emul=elf32am33lin ;;
564mn10200-*-*)		targ_emul=mn10200 ;;
565mn10300-*-*)		targ_emul=mn10300
566			;;
567mt-*elf)                targ_emul=elf32mt
568			;;
569msp430-*-*)             targ_emul=msp430elf
570			targ_extra_emuls="msp430X"
571			;;
572nds32*le-*-elf*)	targ_emul=nds32elf
573			targ_extra_emuls="nds32elf16m nds32belf nds32belf16m"
574			;;
575nds32*be-*-elf*)	targ_emul=nds32belf
576			targ_extra_emuls="nds32elf nds32elf16m nds32belf16m"
577			;;
578nds32*le-*-linux-gnu*)	targ_emul=nds32elf_linux ;;
579nds32*be-*-linux-gnu*)	targ_emul=nds32belf_linux ;;
580nios2*-*-linux*)	targ_emul=nios2linux ;;
581nios2*-*-*)		targ_emul=nios2elf ;;
582ns32k-pc532-mach* | ns32k-pc532-ux*)  targ_emul=pc532macha ;;
583ns32k-*-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd
584			;;
585or1k-*-elf | or1knd-*-elf)		targ_emul=elf32or1k ;;
586or1k-*-linux* | or1knd-*-linux*)	targ_emul=elf32or1k_linux ;;
587or1k-*-rtems* | or1knd-*-rtems*)	targ_emul=elf32or1k
588			;;
589pdp11-*-*)		targ_emul=pdp11
590			;;
591pjl*-*-*)	        targ_emul=pjlelf
592			targ_extra_emuls="elf_i386 elf_iamcu" ;;
593pj*-*-*)	        targ_emul=pjelf
594			;;
595powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
596			targ_emul=elf32ppc_fbsd
597			targ_extra_emuls="elf32ppc elf32ppcsim"
598			targ_extra_libpath=elf32ppc;
599			tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'` ;;
600powerpc64-*-freebsd*)
601			targ_emul=elf64ppc_fbsd
602			targ_extra_emuls="elf64ppc elf32ppc_fbsd elf32ppc"
603			targ_extra_libpath="elf32ppc_fbsd elf32ppc"
604			tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
605			tdir_elf32ppc_fbsd=$tdir_elf32ppc
606			;;
607powerpc-*-vxworks*)
608			targ_emul=elf32ppcvxworks
609			targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim" ;;
610powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
611  | powerpc*-*-linux* | powerpc*-*-netbsd* | powerpc*-*-openbsd* \
612  | powerpc*-*-solaris* | powerpc*-*-kaos* | powerpc*-*-vxworks*)
613			case "${targ}" in
614			powerpc64*)
615			    targ_emul=elf64ppc
616			    targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
617			    targ_extra_libpath="elf32ppc elf32ppclinux" ;;
618			*linux*)
619			    targ_emul=elf32ppclinux
620			    targ_extra_emuls="elf32ppc elf32ppcsim"
621			    targ_extra_libpath=elf32ppc
622			    targ64_extra_emuls=elf64ppc
623			    targ64_extra_libpath=elf64ppc ;;
624			*)
625			    targ_emul=elf32ppc
626			    targ_extra_emuls="elf32ppclinux elf32ppcsim"
627			    targ_extra_libpath=elf32ppclinux
628			    targ64_extra_emuls=elf64ppc
629			    targ64_extra_libpath=elf64ppc ;;
630			esac
631			td=tdir_elf32ppc
632			td64=tdir_elf64ppc
633			s=s/ppc/lppc/g
634			case "${targ}" in
635			powerpcle-* | powerpc64le-*)
636			    for z in td td64 targ_emul targ_extra_emuls \
637					 targ_extra_libpath targ64_extra_emuls \
638					 targ64_extra_libpath
639			    do
640				eval ${z}=\"\`echo \$${z} \| sed -e $s\`\"
641			    done
642			    s=s/lppc/ppc/g ;;
643			esac
644			# Why oh why did we set tooldir based on target_alias
645			# rather than on target?
646			eval tdir_${targ_emul}="${targ_alias}"
647			cpu=`echo "${targ_alias}" | sed -e 's/-.*//'`
648			rest=`echo "${targ_alias}" | sed -e 's/^[^-]*//'`
649			le=le
650			case "${cpu}" in
651			*little) le=little
652			esac
653			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
654			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}'/;s/be64$/64be/'`"${rest}"
655			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
656			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
657			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
658			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
659			# Now provide the other endian
660			for z in targ_extra_emuls targ_extra_libpath
661			do
662			    eval ${z}=\"\$${z} \`echo ${targ_emul} \$${z} \| sed -e $s\`\"
663			done
664			for z in targ64_extra_emuls targ64_extra_libpath
665			do
666			    eval ${z}=\"\$${z} \`echo \$${z} \| sed -e $s\`\"
667			done
668			td=`echo "${td}" | sed -e $s`
669			td64=`echo "${td64}" | sed -e $s`
670			case "${targ}" in
671			powerpcle-* | powerpc64le-*)
672			    cpu=`echo "${cpu}" | sed -e s/${le}\$//` ;;
673			*)
674			    cpu=`echo "${cpu}" | sed -e s/be\$//`${le} ;;
675			esac
676			ta32=`echo "${cpu}" | sed -e s/64//`"${rest}"
677			ta64=`echo "${cpu}" | sed -e 's/64//;s/$/64/;s/'${le}'64$/64'${le}/`"${rest}"
678			eval test -n \"\$${td}\" || eval ${td}="${ta32}"
679			eval test -n \"\$${td}linux\" || eval ${td}linux="${ta32}"
680			eval test -n \"\$${td}sim\" || eval ${td}sim="${ta32}"
681			eval test -n \"\$${td64}\" || eval ${td64}="${ta64}"
682			;;
683powerpc-*-nto*)         targ_emul=elf32ppcnto ;;
684powerpcle-*-nto*)       targ_emul=elf32lppcnto ;;
685powerpc-*-rtems*)	targ_emul=elf32ppc ;;
686powerpc-*-macos*)	targ_emul=ppcmacos ;;
687powerpc-*-netware*)	targ_emul=ppcnw ;;
688powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
689			targ_emul=ppcpe
690			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
691powerpc-*-aix[5-9]*)	targ_emul=aix5ppc ;;
692powerpc-*-aix*)		targ_emul=aixppc ;;
693powerpc-*-beos*)	targ_emul=aixppc ;;
694powerpc-*-haiku*)	targ_emul=elf32ppchaiku ;;
695powerpc-*-windiss*)	targ_emul=elf32ppcwindiss ;;
696powerpc-*-lynxos*)	targ_emul=ppclynx ;;
697riscv32*-*-*)		targ_emul=elf32lriscv
698			targ_extra_emuls="elf64lriscv"
699			targ_extra_libpath=$targ_extra_emuls ;;
700riscv64*-*-*)		targ_emul=elf64lriscv
701			targ_extra_emuls="elf32lriscv"
702			targ_extra_libpath=$targ_extra_emuls ;;
703rs6000-*-aix[5-9]*)	targ_emul=aix5rs6 ;;
704rs6000-*-aix*)		targ_emul=aixrs6
705			;;
706rl78-*-*)		targ_emul=elf32rl78 ;;
707rx-*-*)			targ_emul=elf32rx ;;
708s390x-*-linux*)         targ_emul=elf64_s390
709			targ_extra_emuls=elf_s390
710			targ_extra_libpath=$targ_extra_emuls
711			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
712s390x-*-tpf*)		targ_emul=elf64_s390
713			tdir_elf_s390=`echo ${targ_alias} | sed -e 's/s390x/s390/'` ;;
714s390-*-linux*)          targ_emul=elf_s390
715			targ64_extra_emuls=elf64_s390
716			targ64_extra_libpath=elf64_s390
717			tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
718			;;
719score-*-elf)            targ_emul=score7_elf
720			targ_extra_emuls=score3_elf ;;
721sh-*-linux*)		targ_emul=shlelf_linux
722			targ_extra_emuls="shelf_linux shlelf_fd shelf_fd"
723			targ_extra_libpath=shelf_linux ;;
724sh64eb-*-linux*)	targ_emul=shelf32_linux
725			targ_extra_emuls="shlelf32_linux" ;;
726sh64-*-linux*)		targ_emul=shlelf32_linux
727			targ_extra_emuls="shelf32_linux"
728			targ_extra_libpath=shelf32_linux ;;
729sh*eb-*-linux*)		targ_emul=shelf_linux
730			targ_extra_emuls="shelf_fd" ;;
731sh*-*-linux*)		targ_emul=shlelf_linux
732			targ_extra_emuls="shlelf_fd" ;;
733sh5le-*-netbsd*)	targ_emul=shlelf32_nbsd
734			targ_extra_emuls="shelf32_nbsd shelf64_nbsd shlelf64_nbsd shelf_nbsd shlelf_nbsd" ;;
735sh5-*-netbsd*)		targ_emul=shelf32_nbsd
736			targ_extra_emuls="shlelf32_nbsd shelf64_nbsd shlelf64_nbsd shelf_nbsd shlelf_nbsd" ;;
737sh64le-*-netbsd*)	targ_emul=shlelf64_nbsd
738			targ_extra_emuls="shelf64_nbsd shelf32_nbsd shlelf32_nbsd shelf_nbsd shlelf_nbsd" ;;
739sh64-*-netbsd*)		targ_emul=shelf64_nbsd
740			targ_extra_emuls="shlelf64_nbsd shelf32_nbsd shlelf32_nbsd shelf_nbsd shlelf_nbsd" ;;
741sh*l*-*-netbsdelf*)	targ_emul=shlelf_nbsd
742			targ_extra_emuls=shelf_nbsd ;;
743sh*-*-netbsdelf*)	targ_emul=shelf_nbsd
744			targ_extra_emuls=shlelf_nbsd ;;
745sh*-*-symbianelf*)	targ_emul=shlsymbian ;;
746shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
747			targ_emul=shlelf
748			targ_extra_emuls="shelf shl sh"	;;
749sh-*-rtemscoff*)	targ_emul=sh; targ_extra_emuls=shl ;;
750sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos*)
751			targ_emul=shelf
752			targ_extra_emuls="shlelf sh shl" ;;
753sh-*-uclinux* | sh[12]-*-uclinux*)
754			targ_emul=shelf_uclinux
755			targ_extra_emuls="shelf shlelf sh shl shelf_fd shlelf_fd" ;;
756sh-*-vxworks)		targ_emul=shelf_vxworks
757			targ_extra_emuls=shlelf_vxworks ;;
758sh-*-nto*)		targ_emul=shelf_nto
759			targ_extra_emuls=shlelf_nto ;;
760sh-*-pe)		targ_emul=shpe ;
761			targ_extra_ofiles="deffilep.o pe-dll.o" ;;
762sh-*-*)			targ_emul=sh; targ_extra_emuls=shl ;;
763sh64le-*-elf*)		targ_emul=shlelf
764			targ_extra_emuls="shelf shlelf32 shelf32 shlelf64 shelf64"
765			targ_extra_libpath=$targ_extra_emuls ;;
766sh64-*-elf*)		targ_emul=shelf
767			targ_extra_emuls="shlelf shelf32 shlelf32 shelf64 shlelf64"
768			targ_extra_libpath=$targ_extra_emuls ;;
769sparc64-*-aout*)	targ_emul=sparcaout ;;
770sparc64-*-elf*)		targ_emul=elf64_sparc ;;
771sparc64-*-rtems*)	targ_emul=elf64_sparc ;;
772sparc-sun-sunos4*) 	targ_emul=sun4 ;;
773sparclite*-*-elf)	targ_emul=elf32_sparc ;;
774sparclite*-*-coff)	targ_emul=coff_sparc ;;
775sparclite*-fujitsu-*)	targ_emul=sparcaout ;;
776sparc*-*-aout)		targ_emul=sparcaout ;;
777sparc*-*-coff)		targ_emul=coff_sparc ;;
778sparc*-*-elf)		targ_emul=elf32_sparc ;;
779sparc*-*-sysv4*)	targ_emul=elf32_sparc ;;
780sparc*-*-vxworks*)	targ_emul=elf32_sparc_vxworks ;;
781sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
782			targ_emul=elf64_sparc_fbsd
783			targ_extra_emuls="elf64_sparc elf32_sparc"
784			targ_extra_libpath=$targ_extra_emuls
785			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`	;;
786sparc*-*-linux*aout*)	targ_emul=sparclinux
787			targ_extra_emuls="elf32_sparc sun4"
788			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
789			tdir_sun4=sparc-sun-sunos4 ;;
790sparc64-*-linux-*)	targ_emul=elf64_sparc
791			targ_extra_emuls="elf32_sparc sparclinux sun4"
792			targ_extra_libpath=elf32_sparc
793			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
794			tdir_sparclinux=${tdir_elf32_sparc}aout
795			tdir_sun4=sparc-sun-sunos4 ;;
796sparc*-*-linux-*)	targ_emul=elf32_sparc
797			targ_extra_emuls="sparclinux elf64_sparc sun4"
798			targ_extra_libpath=elf64_sparc
799			tdir_sparclinux=${targ_alias}aout
800			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`
801			tdir_sun4=sparc-sun-sunos4 ;;
802sparc64-*-netbsd* | sparc64-*-openbsd*)
803			targ_emul=elf64_sparc
804			targ_extra_emuls="elf32_sparc" ;;
805sparc*-*-netbsd*elf*)	targ_emul=elf32_sparc ;;
806sparc*-*-netbsd*)	targ_emul=sparcnbsd ;;
807sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
808			targ_emul=elf32_sparc_sol2
809			targ_extra_emuls=elf32_sparc ;;
810sparc-*-solaris2*)	targ_emul=elf32_sparc_sol2
811			targ_extra_emuls="elf32_sparc elf64_sparc_sol2 elf64_sparc"
812			targ_extra_libpath=$targ_extra_emuls
813			tdir_elf64_sparc=`echo ${targ_alias} | sed -e 's/32//'`	;;
814sparcv9-*-solaris2* | sparc64-*-solaris2*)
815			targ_emul=elf64_sparc_sol2
816			targ_extra_emuls="elf64_sparc elf32_sparc_sol2 elf32_sparc"
817			targ_extra_libpath=$targ_extra_emuls
818			tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'` ;;
819sparc*-*-solaris2*)	targ_emul=elf32_sparc ;;
820sparc*-wrs-vxworks*)	targ_emul=sparcaout ;;
821sparc-*-rtems*)		targ_emul=elf32_sparc
822			;;
823spu-*-elf*)		targ_emul=elf32_spu ;;
824tic30-*-*aout*)		targ_emul=tic30aout ;;
825tic30-*-*coff*)		targ_emul=tic30coff ;;
826tic4x-*-* | c4x-*-*)    targ_emul=tic4xcoff ; targ_extra_emuls="tic3xcoff tic3xcoff_onchip" ;;
827tic54x-*-* | c54x*-*-*)	targ_emul=tic54xcoff ;;
828tic6x-*-elf)		targ_emul=elf32_tic6x_elf_le
829			targ_extra_emuls="elf32_tic6x_elf_be elf32_tic6x_le elf32_tic6x_be"
830			targ_extra_libpath=$targ_extra_emuls
831			;;
832tic6x-*-uclinux)	targ_emul=elf32_tic6x_linux_le
833			targ_extra_emuls="elf32_tic6x_linux_be elf32_tic6x_le elf32_tic6x_be"
834			targ_extra_libpath=$targ_extra_emuls
835			;;
836tic80-*-*)		targ_emul=tic80coff
837			;;
838tilegx-*-*)		targ_emul=elf64tilegx
839			targ_extra_emuls="elf64tilegx_be elf32tilegx elf32tilegx_be"
840			targ_extra_libpath=$targ_extra_emuls ;;
841tilegxbe-*-*)		targ_emul=elf64tilegx_be
842			targ_extra_emuls="elf64tilegx elf32tilegx elf32tilegx_be"
843			targ_extra_libpath=$targ_extra_emuls ;;
844tilepro-*-*)		targ_emul=elf32tilepro ;;
845ft32-*-*)		targ_emul=elf32ft32
846			;;
847v850*-*-*)		targ_emul=v850_rh850
848			targ_extra_emuls=v850
849			;;
850vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
851vax-*-netbsdelf*)	targ_emul=elf32vax
852			targ_extra_emuls=vaxnbsd ;;
853vax-*-netbsdaout* | vax-*-netbsd*)
854			targ_emul=vaxnbsd
855			targ_extra_emuls=elf32vax ;;
856vax-*-linux-*)  	targ_emul=elf32vax
857			;;
858visium-*-elf)		targ_emul=elf32visium
859			;;
860w65-*-*)		targ_emul=w65
861			;;
862xc16x-*-elf)		targ_emul=elf32xc16x
863                        targ_extra_emuls="elf32xc16xl elf32xc16xs"
864                        ;;
865xstormy16-*-*)		targ_emul=elf32xstormy16
866			;;
867xtensa*-*-*)		targ_emul=elf32xtensa
868			;;
869xgate-*-*)  		targ_emul=xgateelf
870			;;
871z80-*-coff)		targ_emul=z80
872			;;
873z8k-*-coff) 		targ_emul=z8002; targ_extra_emuls=z8001
874			;;
875*-*-ieee*)		targ_emul=vanilla
876			;;
877*-tandem-none)		targ_emul=st2000
878			;;
879*)
880  echo 2>&1 "*** ld does not support target ${targ}"
881  echo 2>&1 "*** see ld/configure.tgt for supported targets"
882  exit 1
883
884esac
885
886NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
887case "${target}" in
888
889*-*-dragonfly*)
890  NATIVE_LIB_DIRS='/lib /usr/lib /usr/pkg/lib /usr/local/lib'
891  ;;
892
893*-*-freebsd*)
894  NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
895  ;;
896
897hppa*64*-*-hpux11*)
898  NATIVE_LIB_DIRS=/usr/lib/pa20_64
899  ;;
900
901i[3-7]86-*-sysv4*)
902  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
903  ;;
904
905i[3-7]86-*-solaris*)
906  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
907  ;;
908
909i[3-7]86-pc-interix*)
910  NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
911  ;;
912
913ia64-*-aix*)
914  NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
915  ;;
916
917sparc*-*-solaris2*)
918  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
919  ;;
920
921spu-*-elf*)
922  # This allows to build a pair of PPU/SPU toolchains with common sysroot.
923  NATIVE_LIB_DIRS='/lib'
924  ;;
925
926i[03-9x]86-*-cygwin* | x86_64-*-cygwin*)
927  NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
928  ;;
929
930*-*-linux*)
931  ;;
932
933*-*-netbsd*)
934  ;;
935
936alpha*-*-*)
937  NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
938  ;;
939
940esac
941
942case "${target}" in
943frv-*-* | hppa*-*-* | ia64-*-* | mips*-*-*)
944  # Don't enable -z relro by default since many relro tests fail on these
945  # targets:
946  # FAIL: strip -z relro (relro1)
947  # FAIL: strip -z relro -shared (relro1)
948  # FAIL: objcopy -z relro (relro1)
949  # FAIL: objcopy -z relro -shared (relro1)
950  # FAIL: objcopy -z relro (tdata1)
951  # FAIL: objcopy -shared -z relro (tdata1)
952  # FAIL: objcopy -z relro (tdata2)
953  # FAIL: objcopy -shared -z relro (tdata2)
954  # FAIL: objcopy -z relro (tdata3)
955  # FAIL: objcopy -shared -z relro (tdata3)
956  # FAIL: objcopy -shared -z relro (tbss1)
957  # FAIL: objcopy -shared -z relro (tbss2)
958  # FAIL: objcopy -shared -z relro (tbss3)
959  ;;
960*-*-linux*)
961  if test ${ac_default_ld_z_relro} = unset; then
962    ac_default_ld_z_relro=1
963  fi
964  ;;
965esac
966