1*56bb7041Schristos# configure.tgt -- target configuration for gold  -*- sh -*-
2*56bb7041Schristos
3*56bb7041Schristos# Copyright (C) 2006-2020 Free Software Foundation, Inc.
4*56bb7041Schristos# Written by Ian Lance Taylor <iant@google.com>.
5*56bb7041Schristos
6*56bb7041Schristos# This file is part of gold.
7*56bb7041Schristos
8*56bb7041Schristos# This program is free software; you can redistribute it and/or modify
9*56bb7041Schristos# it under the terms of the GNU General Public License as published by
10*56bb7041Schristos# the Free Software Foundation; either version 3 of the License, or
11*56bb7041Schristos# (at your option) any later version.
12*56bb7041Schristos
13*56bb7041Schristos# This program is distributed in the hope that it will be useful,
14*56bb7041Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
15*56bb7041Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*56bb7041Schristos# GNU General Public License for more details.
17*56bb7041Schristos
18*56bb7041Schristos# You should have received a copy of the GNU General Public License
19*56bb7041Schristos# along with this program; if not, write to the Free Software
20*56bb7041Schristos# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21*56bb7041Schristos# MA 02110-1301, USA.
22*56bb7041Schristos
23*56bb7041Schristos# This script handles target configuration for gold.  This is shell
24*56bb7041Schristos# code invoked by the autoconf generated configure script.  Putting
25*56bb7041Schristos# this in a separate file lets us skip running autoconf when modifying
26*56bb7041Schristos# target specific information.
27*56bb7041Schristos
28*56bb7041Schristos# This file switches on the shell variable ${targ}, which is a
29*56bb7041Schristos# canonicalized GNU configuration triplet.  It sets the following
30*56bb7041Schristos# shell variables:
31*56bb7041Schristos
32*56bb7041Schristos# targ_obj               object file to include in the link, with no extension
33*56bb7041Schristos# targ_extra_obj         extra object file to include
34*56bb7041Schristos# targ_machine           ELF machine code for this target
35*56bb7041Schristos# targ_size              size of this target--32 or 64
36*56bb7041Schristos# targ_extra_size        extra targ_size setting for the target
37*56bb7041Schristos# targ_big_endian        whether the target is big-endian--true or false
38*56bb7041Schristos# targ_extra_big_endian  extra targ_big_endian setting for the target
39*56bb7041Schristos# targ_osabi		 EI_OSABI value
40*56bb7041Schristos
41*56bb7041Schristos# If the target is not recognized targ_obj is set to "UNKNOWN".
42*56bb7041Schristos
43*56bb7041Schristostarg_extra_obj=
44*56bb7041Schristostarg_machine=
45*56bb7041Schristostarg_size=
46*56bb7041Schristostarg_extra_size=
47*56bb7041Schristostarg_big_endian=
48*56bb7041Schristostarg_extra_big_endian=
49*56bb7041Schristostarg_osabi=ELFOSABI_NONE
50*56bb7041Schristoscase "$targ" in
51*56bb7041Schristosi?86-*)
52*56bb7041Schristos  targ_obj=i386
53*56bb7041Schristos  targ_machine=EM_386
54*56bb7041Schristos  targ_size=32
55*56bb7041Schristos  targ_big_endian=false
56*56bb7041Schristos  case "$targ" in
57*56bb7041Schristos  i?86-*-freebsd*)
58*56bb7041Schristos    targ_osabi=ELFOSABI_FREEBSD
59*56bb7041Schristos    ;;
60*56bb7041Schristos  esac
61*56bb7041Schristos  ;;
62*56bb7041Schristosx86_64*)
63*56bb7041Schristos  targ_obj=x86_64
64*56bb7041Schristos  targ_extra_obj=i386
65*56bb7041Schristos  targ_machine=EM_X86_64
66*56bb7041Schristos  targ_size=64
67*56bb7041Schristos  targ_extra_size=32
68*56bb7041Schristos  targ_big_endian=false
69*56bb7041Schristos  case "$targ" in
70*56bb7041Schristos  x86_64-*-freebsd*)
71*56bb7041Schristos    targ_osabi=ELFOSABI_FREEBSD
72*56bb7041Schristos    ;;
73*56bb7041Schristos  esac
74*56bb7041Schristos  ;;
75*56bb7041Schristostilegx*)
76*56bb7041Schristos  targ_obj=tilegx
77*56bb7041Schristos  targ_machine=EM_TILEGX
78*56bb7041Schristos  targ_size=64
79*56bb7041Schristos  targ_extra_size=32
80*56bb7041Schristos  targ_big_endian=false
81*56bb7041Schristos  targ_extra_big_endian=true
82*56bb7041Schristos  ;;
83*56bb7041Schristossparc-*)
84*56bb7041Schristos  targ_obj=sparc
85*56bb7041Schristos  targ_machine=EM_SPARC
86*56bb7041Schristos  targ_size=32
87*56bb7041Schristos  targ_extra_size=64
88*56bb7041Schristos  targ_big_endian=true
89*56bb7041Schristos  targ_extra_big_endian=false
90*56bb7041Schristos  ;;
91*56bb7041Schristossparc64-*)
92*56bb7041Schristos  targ_obj=sparc
93*56bb7041Schristos  targ_machine=EM_SPARCV9
94*56bb7041Schristos  targ_size=64
95*56bb7041Schristos  targ_extra_size=32
96*56bb7041Schristos  targ_big_endian=true
97*56bb7041Schristos  targ_extra_big_endian=false
98*56bb7041Schristos  ;;
99*56bb7041Schristospowerpc-*)
100*56bb7041Schristos  targ_obj=powerpc
101*56bb7041Schristos  targ_machine=EM_PPC
102*56bb7041Schristos  targ_size=32
103*56bb7041Schristos  targ_extra_size=64
104*56bb7041Schristos  targ_big_endian=true
105*56bb7041Schristos  targ_extra_big_endian=false
106*56bb7041Schristos  ;;
107*56bb7041Schristospowerpcle-*)
108*56bb7041Schristos  targ_obj=powerpc
109*56bb7041Schristos  targ_machine=EM_PPC
110*56bb7041Schristos  targ_size=32
111*56bb7041Schristos  targ_extra_size=64
112*56bb7041Schristos  targ_big_endian=false
113*56bb7041Schristos  targ_extra_big_endian=true
114*56bb7041Schristos  ;;
115*56bb7041Schristospowerpc64-*)
116*56bb7041Schristos  targ_obj=powerpc
117*56bb7041Schristos  targ_machine=EM_PPC64
118*56bb7041Schristos  targ_size=64
119*56bb7041Schristos  targ_extra_size=32
120*56bb7041Schristos  targ_big_endian=true
121*56bb7041Schristos  targ_extra_big_endian=false
122*56bb7041Schristos  ;;
123*56bb7041Schristospowerpc64le-*)
124*56bb7041Schristos  targ_obj=powerpc
125*56bb7041Schristos  targ_machine=EM_PPC64
126*56bb7041Schristos  targ_size=64
127*56bb7041Schristos  targ_extra_size=32
128*56bb7041Schristos  targ_big_endian=false
129*56bb7041Schristos  targ_extra_big_endian=true
130*56bb7041Schristos  ;;
131*56bb7041Schristosarmeb*-*-*|armbe*-*-*)
132*56bb7041Schristos targ_obj=arm
133*56bb7041Schristos targ_extra_obj=arm-reloc-property
134*56bb7041Schristos targ_machine=EM_ARM
135*56bb7041Schristos targ_size=32
136*56bb7041Schristos targ_big_endian=true
137*56bb7041Schristos targ_extra_big_endian=false
138*56bb7041Schristos ;;
139*56bb7041Schristosarm*-*-*)
140*56bb7041Schristos targ_obj=arm
141*56bb7041Schristos targ_extra_obj=arm-reloc-property
142*56bb7041Schristos targ_machine=EM_ARM
143*56bb7041Schristos targ_size=32
144*56bb7041Schristos targ_big_endian=false
145*56bb7041Schristos targ_extra_big_endian=true
146*56bb7041Schristos ;;
147*56bb7041Schristosaarch64*-*)
148*56bb7041Schristos targ_obj=aarch64
149*56bb7041Schristos targ_extra_obj=aarch64-reloc-property
150*56bb7041Schristos targ_machine=EM_AARCH64
151*56bb7041Schristos targ_size=64
152*56bb7041Schristos targ_extra_size=32
153*56bb7041Schristos targ_big_endian=false
154*56bb7041Schristos targ_extra_big_endian=true
155*56bb7041Schristos ;;
156*56bb7041Schristosmips*el*-*-*|mips*le*-*-*)
157*56bb7041Schristos targ_obj=mips
158*56bb7041Schristos targ_machine=EM_MIPS_RS3_LE
159*56bb7041Schristos targ_size=32
160*56bb7041Schristos targ_big_endian=false
161*56bb7041Schristos targ_extra_big_endian=true
162*56bb7041Schristos ;;
163*56bb7041Schristosmips*-*-*)
164*56bb7041Schristos targ_obj=mips
165*56bb7041Schristos targ_machine=EM_MIPS
166*56bb7041Schristos targ_size=32
167*56bb7041Schristos targ_big_endian=true
168*56bb7041Schristos targ_extra_big_endian=false
169*56bb7041Schristos ;;
170*56bb7041Schristoss390-*-*)
171*56bb7041Schristos targ_obj=s390
172*56bb7041Schristos targ_machine=EM_S390
173*56bb7041Schristos targ_size=32
174*56bb7041Schristos targ_big_endian=true
175*56bb7041Schristos targ_extra_big_endian=false
176*56bb7041Schristos ;;
177*56bb7041Schristoss390x-*-*)
178*56bb7041Schristos targ_obj=s390
179*56bb7041Schristos targ_machine=EM_S390
180*56bb7041Schristos targ_size=64
181*56bb7041Schristos targ_big_endian=true
182*56bb7041Schristos targ_extra_big_endian=false
183*56bb7041Schristos ;;
184*56bb7041Schristos*)
185*56bb7041Schristos  targ_obj=UNKNOWN
186*56bb7041Schristos  ;;
187*56bb7041Schristosesac
188