1 ################################################################################
3 # Common variables for the gcc-initial and gcc-final packages.
5 ################################################################################
8 # Version, site and source
11 GCC_VERSION
= $(call qstrip
,$(BR2_GCC_VERSION
))
14 GCC_SITE
= $(call github
,foss-for-synopsys-dwc-arc-processors
,gcc
,$(GCC_VERSION
))
15 GCC_SOURCE
= gcc-
$(GCC_VERSION
).
tar.gz
17 GCC_SITE
= $(BR2_GNU_MIRROR
:/=)/gcc
/gcc-
$(GCC_VERSION
)
20 GCC_SOURCE ?
= gcc-
$(GCC_VERSION
).
tar.bz2
26 HOST_GCC_XTENSA_OVERLAY_TAR
= $(BR2_XTENSA_OVERLAY_DIR
)/xtensa_
$(call qstrip
,$(BR2_XTENSA_CORE_NAME
)).
tar
28 define HOST_GCC_XTENSA_OVERLAY_EXTRACT
29 tar xf
$(HOST_GCC_XTENSA_OVERLAY_TAR
) -C
$(@D
) --strip-components
=1 gcc
36 ifeq ($(ARCH
),powerpc
)
37 ifneq ($(BR2_SOFT_FLOAT
),)
38 define HOST_GCC_APPLY_POWERPC_PATCH
39 $(APPLY_PATCHES
) $(@D
) package
/gcc
/$(GCC_VERSION
) 1000-powerpc-link-with-math-lib.patch.conditional
44 define HOST_GCC_APPLY_PATCHES
45 if
test -d package
/gcc
/$(GCC_VERSION
); then \
46 $(APPLY_PATCHES
) $(@D
) package
/gcc
/$(GCC_VERSION
) \
*.patch
; \
48 $(HOST_GCC_APPLY_POWERPC_PATCH
)
53 gcc
/testsuite
/* libstdc
++-v3
/testsuite
/*
55 define HOST_GCC_FAKE_TESTSUITE
56 mkdir
-p
$(@D
)/libstdc
++-v3
/testsuite
/
57 echo
"all:" > $(@D
)/libstdc
++-v3
/testsuite
/Makefile.in
58 echo
"install:" >> $(@D
)/libstdc
++-v3
/testsuite
/Makefile.in
62 # Create 'build' directory and configure symlink
65 define HOST_GCC_CONFIGURE_SYMLINK
67 ln
-sf ..
/configure
$(@D
)/build
/configure
71 # Common configuration options
74 HOST_GCC_COMMON_DEPENDENCIES
= \
78 $(if
$(BR2_BINFMT_FLAT
),host-elf2flt
)
80 HOST_GCC_COMMON_CONF_OPTS
= \
81 --target
=$(GNU_TARGET_NAME
) \
82 --with-sysroot
=$(STAGING_DIR
) \
83 --disable-__cxa_atexit \
87 --with-gmp
=$(HOST_DIR
)/usr \
88 --with-mpfr
=$(HOST_DIR
)/usr \
89 --with-pkgversion
="Buildroot $(BR2_VERSION_FULL)" \
90 --with-bugurl
="http://bugs.buildroot.net/"
92 # Don't build documentation. It takes up extra space / build time,
93 # and sometimes needs specific makeinfo versions to work
94 HOST_GCC_COMMON_CONF_ENV
= \
97 GCC_COMMON_TARGET_CFLAGS
= $(TARGET_CFLAGS
)
98 GCC_COMMON_TARGET_CXXFLAGS
= $(TARGET_CXXFLAGS
)
100 # Propagate options used for target software building to GCC target libs
101 HOST_GCC_COMMON_CONF_ENV
+= CFLAGS_FOR_TARGET
="$(GCC_COMMON_TARGET_CFLAGS)"
102 HOST_GCC_COMMON_CONF_ENV
+= CXXFLAGS_FOR_TARGET
="$(GCC_COMMON_TARGET_CXXFLAGS)"
104 # libitm needs sparc V9+
105 ifeq ($(BR2_sparc_v8
)$(BR2_sparc_leon3
),y
)
106 HOST_GCC_COMMON_CONF_OPTS
+= --disable-libitm
109 # gcc 4.6.x quadmath requires wchar
110 ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR
),y
)
111 HOST_GCC_COMMON_CONF_OPTS
+= --disable-libquadmath
114 # libsanitizer requires wordexp, not in default uClibc config. Also
115 # doesn't build properly with musl.
116 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC
)$(BR2_TOOLCHAIN_BUILDROOT_MUSL
),y
)
117 HOST_GCC_COMMON_CONF_OPTS
+= --disable-libsanitizer
120 # libsanitizer is broken for SPARC
121 # https://bugs.busybox.net/show_bug.cgi?id=7951
122 ifeq ($(BR2_sparc
)$(BR2_sparc64
),y
)
123 HOST_GCC_COMMON_CONF_OPTS
+= --disable-libsanitizer
126 ifeq ($(BR2_GCC_ENABLE_TLS
),y
)
127 HOST_GCC_COMMON_CONF_OPTS
+= --enable-tls
129 HOST_GCC_COMMON_CONF_OPTS
+= --disable-tls
132 ifeq ($(BR2_GCC_ENABLE_LTO
),y
)
133 HOST_GCC_COMMON_CONF_OPTS
+= --enable-plugins
--enable-lto
136 ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP
),y
)
137 HOST_GCC_COMMON_CONF_OPTS
+= --enable-libmudflap
139 HOST_GCC_COMMON_CONF_OPTS
+= --disable-libmudflap
142 ifeq ($(BR2_PTHREADS_NONE
),y
)
143 HOST_GCC_COMMON_CONF_OPTS
+= \
148 HOST_GCC_COMMON_CONF_OPTS
+= --enable-threads
151 ifeq ($(BR2_GCC_NEEDS_MPC
),y
)
152 HOST_GCC_COMMON_DEPENDENCIES
+= host-mpc
153 HOST_GCC_COMMON_CONF_OPTS
+= --with-mpc
=$(HOST_DIR
)/usr
156 ifeq ($(BR2_GCC_ENABLE_GRAPHITE
),y
)
157 HOST_GCC_COMMON_DEPENDENCIES
+= host-isl
158 HOST_GCC_COMMON_CONF_OPTS
+= --with-isl
=$(HOST_DIR
)/usr
159 # gcc 5 doesn't need cloog any more, see
160 # https://gcc.gnu.org/gcc-5/changes.html
161 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_5
),)
162 HOST_GCC_COMMON_DEPENDENCIES
+= host-cloog
163 HOST_GCC_COMMON_CONF_OPTS
+= --with-cloog
=$(HOST_DIR
)/usr
166 HOST_GCC_COMMON_CONF_OPTS
+= --without-isl
--without-cloog
170 HOST_GCC_COMMON_DEPENDENCIES
+= host-flex host-bison
173 ifeq ($(BR2_SOFT_FLOAT
),y
)
174 # only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float
175 # powerpc seems to be needing it as well
176 ifeq ($(BR2_arm
)$(BR2_armeb
)$(BR2_mips
)$(BR2_mipsel
)$(BR2_mips64
)$(BR2_mips64el
)$(BR2_powerpc
)$(BR2_sparc
),y
)
177 HOST_GCC_COMMON_CONF_OPTS
+= --with-float
=soft
181 ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE
),y
)
182 HOST_GCC_COMMON_CONF_OPTS
+= --disable-decimal-float
185 # Determine arch/tune/abi/cpu options
186 ifneq ($(call qstrip
,$(BR2_GCC_TARGET_ARCH
)),)
187 HOST_GCC_COMMON_CONF_OPTS
+= --with-arch
=$(BR2_GCC_TARGET_ARCH
)
189 ifneq ($(call qstrip
,$(BR2_GCC_TARGET_ABI
)),)
190 HOST_GCC_COMMON_CONF_OPTS
+= --with-abi
=$(BR2_GCC_TARGET_ABI
)
192 ifneq ($(call qstrip
,$(BR2_GCC_TARGET_CPU
)),)
193 ifneq ($(call qstrip
,$(BR2_GCC_TARGET_CPU_REVISION
)),)
194 HOST_GCC_COMMON_CONF_OPTS
+= --with-cpu
=$(call qstrip
,$(BR2_GCC_TARGET_CPU
)-$(BR2_GCC_TARGET_CPU_REVISION
))
196 HOST_GCC_COMMON_CONF_OPTS
+= --with-cpu
=$(call qstrip
,$(BR2_GCC_TARGET_CPU
))
200 GCC_TARGET_FPU
= $(call qstrip
,$(BR2_GCC_TARGET_FPU
))
201 ifneq ($(GCC_TARGET_FPU
),)
202 HOST_GCC_COMMON_CONF_OPTS
+= --with-fpu
=$(GCC_TARGET_FPU
)
205 GCC_TARGET_FLOAT_ABI
= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
206 ifneq ($(GCC_TARGET_FLOAT_ABI
),)
207 HOST_GCC_COMMON_CONF_OPTS
+= --with-float
=$(GCC_TARGET_FLOAT_ABI
)
210 GCC_TARGET_MODE
= $(call qstrip
,$(BR2_GCC_TARGET_MODE
))
211 ifneq ($(GCC_TARGET_MODE
),)
212 HOST_GCC_COMMON_CONF_OPTS
+= --with-mode
=$(GCC_TARGET_MODE
)
215 # Enable proper double/long double for SPE ABI
216 ifeq ($(BR2_powerpc_SPE
),y
)
217 HOST_GCC_COMMON_CONF_OPTS
+= \
218 --enable-e500_double \
219 --with-long-double-128
222 HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_CROSS_PATH_SUFFIX
='".br_real"'
224 # For gcc-initial, we need to tell gcc that the C library will be
225 # providing the ssp support, as it can't guess it since the C library
226 # hasn't been built yet.
228 # For gcc-final, the gcc logic to detect whether SSP support is
229 # available or not in the C library is not working properly for
230 # uClibc, so let's be explicit as well.
231 HOST_GCC_COMMON_MAKE_OPTS
= \
232 gcc_cv_libc_provides_ssp
=$(if
$(BR2_TOOLCHAIN_HAS_SSP
),yes
,no
)
234 ifeq ($(BR2_CCACHE
),y
)
235 HOST_GCC_COMMON_CCACHE_HASH_FILES
+= $(DL_DIR
)/$(GCC_SOURCE
)
236 # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and
237 # unversioned patches unconditionally
238 HOST_GCC_COMMON_CCACHE_HASH_FILES
+= \
240 package
/gcc
/$(GCC_VERSION
)/*.patch \
241 $(addsuffix $((PKG
)_RAWNAME
)/$(GCC_VERSION
)/*.patch
,$(call qstrip
,$(BR2_GLOBAL_PATCH_DIR
))) \
242 $(addsuffix $((PKG
)_RAWNAME
)/*.patch
,$(call qstrip
,$(BR2_GLOBAL_PATCH_DIR
)))))
243 ifeq ($(BR2_xtensa
),y
)
244 HOST_GCC_COMMON_CCACHE_HASH_FILES
+= $(HOST_GCC_XTENSA_OVERLAY_TAR
)
246 ifeq ($(ARCH
),powerpc
)
247 ifneq ($(BR2_SOFT_FLOAT
),)
248 HOST_GCC_COMMON_CCACHE_HASH_FILES
+= package
/gcc
/$(GCC_VERSION
)/1000-powerpc-link-with-math-lib.patch.conditional
252 # _CONF_OPTS contains some references to the absolute path of $(HOST_DIR)
253 # and a reference to the Buildroot git revision (BR2_VERSION_FULL),
254 # so substitute those away.
255 HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS
+= -DBR_CCACHE_HASH
=\"`\
256 printf '%s\n' $(subst $(HOST_DIR),@HOST_DIR@,\
257 $(subst --with-pkgversion="Buildroot $(BR2_VERSION_FULL)",,$($(PKG)_CONF_OPTS))) \
258 | sha256sum - $(HOST_GCC_COMMON_CCACHE_HASH_FILES) \
259 | cut -c -64 | tr -d '\n'`\"
262 # The LTO support in gcc creates wrappers for ar, ranlib and nm which load
263 # the lto plugin. These wrappers are called *-gcc-ar, *-gcc-ranlib, and
264 # *-gcc-nm and should be used instead of the real programs when -flto is
265 # used. However, we should not add the toolchain wrapper for them, and they
266 # match the *cc-* pattern. Therefore, an additional case is added for *-ar,
268 # Avoid that a .br_real is symlinked a second time.
269 # Also create <arch>-linux-<tool> symlinks.
270 define HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
271 $(Q
)cd
$(HOST_DIR
)/usr
/bin
; \
272 for i in
$(GNU_TARGET_NAME
)-*; do \
276 *-ar|
*-ranlib|
*-nm
) \
277 ln
-snf
$$i $(ARCH
)-linux
$${i
##$(GNU_TARGET_NAME)}; \
279 *cc|
*cc-
*|
*++|
*++-*|
*cpp) \
281 mv
$$i $$i.br_real
; \
282 ln
-sf toolchain-wrapper
$$i; \
283 ln
-sf toolchain-wrapper
$(ARCH
)-linux
$${i
##$(GNU_TARGET_NAME)}; \
284 ln
-snf
$$i.br_real
$(ARCH
)-linux
$${i
##$(GNU_TARGET_NAME)}.br_real; \
287 ln
-snf
$$i $(ARCH
)-linux
$${i
##$(GNU_TARGET_NAME)}; \
294 include $(sort $(wildcard package
/gcc
/*/*.mk
))