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