aboutsummaryrefslogtreecommitdiff
path: root/config/gcc.conf
blob: f4c5cb6141cdc68a1620606574676d4cf61e3c7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# If yes, only static linking will be used
static_link="no"

# This is a list of default flags always supplied to configure
if [ x"$use_system_libs" = x"no" ]; then
    default_configure_flags="\
--with-mpc=${local_builds}/destdir/${host} \
--with-mpfr=${local_builds}/destdir/${host} \
--with-gmp=${local_builds}/destdir/${host}"
else
    default_configure_flags=""
fi
default_configure_flags="$default_configure_flags \
--with-gnu-as \
--with-gnu-ld \
"

# top-level flags
default_configure_flags="${default_configure_flags} \
--disable-libmudflap \
--enable-lto \
--enable-shared \
--without-included-gettext \
--enable-nls \
--with-system-zlib \
"

# gcc flags
default_configure_flags="${default_configure_flags} \
--disable-sjlj-exceptions \
--enable-gnu-unique-object \
--enable-linker-build-id \
"

# libstdc++ flags
# C99 is the latest standard, and has improved numerics support, so we want it
# http://en.wikipedia.org/wiki/C99
default_configure_flags="${default_configure_flags} \
--disable-libstdcxx-pch \
--enable-c99 \
--enable-clocale=gnu \
--enable-libstdcxx-debug \
--enable-long-long \
"

# Disable the Graphite loop optimizer as it's being deprecated
default_configure_flags="${default_configure_flags} --with-cloog=no --with-ppl=no --with-isl=no"

# libssp does stack protection
#default_configure_flags="${default_configure_flags} --enable-libssp"

# Used by fortran
# http://gcc.gnu.org/onlinedocs/libquadmath/
# default_configure_flags="${default_configure_flags} --disable-libquadmath"

# Transactional Memory, used for threading
# http://gcc.gnu.org/wiki/TransactionalMemory
#default_configure_flags="${default_configure_flags} --disable-libitm"

# Libatomic is a synchronization library	     
# http://www.hpl.hp.com/research/linux/atomic_ops/
#default_configure_flags="${default_configure_flags} --disable-libatomic"

# Enable multilib for bare-metal, since newlib supports it.
if echo "${gcc_override_configure}" | egrep -q -v 'multilib' ; then
    case ${target} in
	arm*-eabi*)
	    default_configure_flags="${default_configure_flags} --enable-multilib --with-multilib-list=${multilib_list}"
	    ;;
	aarch64*-*elf)
	    default_configure_flags="${default_configure_flags} --enable-multilib"
	    ;;
	*)
	    default_configure_flags="${default_configure_flags} --disable-multilib"
	    ;;
    esac
fi

# Enable errata support
aarch64_errata="--enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419"
case ${target} in
    aarch64*)
	default_configure_flags="${default_configure_flags} ${aarch64_errata}"
	;;
esac

# Default languages
languages="c,c++,fortran,lto"

default_makeflags="MAKEINFOFLAGS=--force"


# Add target specific flags

# We cannot change the defaut cpu/fpu/mode/arch/float settings for
# arm*-eabi* because we use --with-multilib-list=[a|rm]profile: the cases
# below only apply to *linux* configurations.

# floating-point abi/fpu
case ${target} in
    arm*linux-gnueabihf)
	default_configure_flags="${default_configure_flags} --with-float=hard"

	# FPU (no --with-fpu for non-hf configurations, nor AArch64)
	if echo "${gcc_override_configure}" | grep -q -v with-fpu ; then
	    case ${target} in
		armv8l-*linux-gnueabihf)
		    default_configure_flags="${default_configure_flags} --with-fpu=neon-fp-armv8"
		    ;;
		arm*-*linux-gnueabihf)
		    default_configure_flags="${default_configure_flags} --with-fpu=vfpv3-d16"
		    ;;
	    esac
	fi
	;;
    arm*linux-gnueabi)
	default_configure_flags="${default_configure_flags} --with-float=soft"
	;;
esac

# mode (ARM, Thumb, ...)
case ${target} in
    arm*linux*)
	if echo "${gcc_override_configure}" | egrep -q -v 'with-mode' ; then
	    default_configure_flags="${default_configure_flags} --with-mode=thumb"
	fi
	;;
esac

# ARCH/CPU
case ${target} in
    armv8l-*linux-gnueabihf)
	if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then
	    default_configure_flags="${default_configure_flags} --with-arch=armv8-a"
	fi
	;;
    arm*-*linux-gnueabi*)
	if echo "${gcc_override_configure}" | egrep -q -v 'with-cpu|with-tune' ; then
	    default_configure_flags="${default_configure_flags} --with-tune=cortex-a9"
	fi
	if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then
	    default_configure_flags="${default_configure_flags} --with-arch=armv7-a"
	fi
	;;
    aarch64*)
	if echo "${gcc_override_configure}" | egrep -q -v 'with-arch|with-cpu' ; then
	    default_configure_flags="${default_configure_flags} --with-arch=armv8-a"
	fi
	;;
esac

# Add target OS specific flags
case ${target} in
    # bare metal targets don't support threads.
    arm*-eabi*|aarch64*elf)
	default_configure_flags="${default_configure_flags} --enable-threads=no --disable-multiarch"
        languages="c,c++,lto"
	;;
    *linux*)
	# --enable-libstdcxx-time=yes requires a compiler able to link
	# --without flags such as --specs, which is not the case for
	# --aarch64-elf. That's why we enable this for *linux* targets
	# --only.
	default_configure_flags="${default_configure_flags} --enable-threads=posix --enable-multiarch --enable-libstdcxx-time=yes"
	# Enable GNU IFUNCs starting with GCC6 toolchains.
	# Previous toolchains remove this setting from their configurations.
	# This is only supported by glibc, so assume it's only for linux
	# targets. (this is not true if one builds a toolchain for *linux*
	# target and forces newlib as libc)
	default_configure_flags="${default_configure_flags} --enable-gnu-indirect-function"
	;;
esac

# Other
case ${target} in
    *-mingw32)
	languages="c,c++"
	# Cygwin doesn't support GCC plugins
	default_configure_flags="${default_configure_flags} --disable-plugins"
	;;
    powerpc*-eabi|ppc)
        default_configure_flags="${default_configure_flags}"
        languages="c,c++,lto"
        ;;
esac

stage1_flags=""
stage2_flags=""

# When building a cross-compiler, we first build a minimal stage1
# compiler with many features disabled, then a full-featured stage2
# compiler.
if test x"${build}" != x"${target}"; then
   # stage1_flags are used to build the initial C compiler, which is
   # used to compile the C library. We disable most everything, as the
   # second GCC build will be able to use the C library built with the
   # first GCC build.
   stage1_flags="$stage1_flags --disable-libssp --disable-libquadmath --disable-threads --without-headers --with-newlib --disable-libmudflap --disable-decimal-float --disable-libgomp --disable-libatomic --disable-libsanitizer --disable-plugins --disable-libitm --enable-languages=c,c++ --disable-libstdcxx --disable-libvtv --disable-shared"

    case ${clibrary} in
	glibc|eglibc)
	    stage1_flags="$stage1_flags --with-glibc-version=2.18"
	    # Convention for cross-toolchains is to install Glibc into
	    # libc/ directory inside sysroot.
	    # Set GCC's sysroot flag to $sysroot/libc so that the compiler
	    # can find C library's headers and libraries.  GCC will search
	    # $sysroot automatically anyway, since that's where it installs
	    # compiler libraries.
	    stage2_flags="--with-sysroot=${sysroots}/libc"
	    ;;
	newlib)
	    # bare metal targets don't support threads.
	    stage2_flags="--with-sysroot=${sysroots} --with-newlib"
	    ;;
	*)
	    fixme "\${clibrary} not specified."
	    ;;
    esac

    if test x"${with_languages}" != x"default"; then
	languages="${with_languages}"
    fi
else
    # Native builds are easy, so build almost everything
    if test x"${with_languages}" != x"default"; then
	languages="${with_languages}"
    else
	languages="c,c++,go,objc,fortran"
    fi
fi	 

# When building for a mingw host, supply pre-built libiconv and use GCC's
# internal zlib (otherwise no zlib to build against).
mingw_extraconf="--with-libiconv-prefix=${local_builds}/destdir/${host}/usr --with-system-zlib=no"

# stage2 flags are used for native builds too
if test x"${release}" = x; then
    stage2_flags="${stage2_flags} --enable-checking=yes"
else
    stage2_flags="${stage2_flags} --enable-checking=release"
fi

stage1_flags="$stage1_flags --disable-bootstrap"
if test x"${bootstrap}" = x"yes"; then
    stage2_flags="${stage2_flags} --enable-bootstrap"
else
    stage2_flags="${stage2_flags} --disable-bootstrap"
fi

# Add --with-build-config=<config>
if test x"${build_config}" != x; then
    stage2_flags="${stage2_flags} --with-build-config=${build_config}"
fi

stage2_flags="${stage2_flags} --enable-languages=${languages}"


# Add the overrides
default_configure_flags="${default_configure_flags} ${gcc_override_configure}"

# This is a list of default flags always supplied to "make check".
runtest_flags=""