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