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 define HOST_GCC_XTENSA_OVERLAY_EXTRACT
27 tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(call qstrip,\
28 $(BR2_XTENSA_CORE_NAME)).tar -C $(@D) --strip-components=1 gcc
35 ifeq ($(ARCH),powerpc)
36 ifneq ($(BR2_SOFT_FLOAT),)
37 define HOST_GCC_APPLY_POWERPC_PATCH
38 $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) 1000-powerpc-link-with-math-lib.patch.conditional
43 define HOST_GCC_APPLY_PATCHES
44 if test -d package/gcc/$(GCC_VERSION); then \
45 $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \
47 $(HOST_GCC_APPLY_POWERPC_PATCH)
51 # Custom extract command to save disk space
54 define HOST_GCC_EXTRACT_CMDS
55 $(call suitable-extractor,$(GCC_SOURCE)) $(DL_DIR)/$(GCC_SOURCE) | \
56 $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) \
57 --exclude='libjava/*' \
59 --exclude='gcc/testsuite/*' \
60 --exclude='libstdc++-v3/testsuite/*' \
62 mkdir -p $(@D)/libstdc++-v3/testsuite/
63 echo "all:" > $(@D)/libstdc++-v3/testsuite/Makefile.in
64 echo "install:" >> $(@D)/libstdc++-v3/testsuite/Makefile.in
68 # Create 'build' directory and configure symlink
71 define HOST_GCC_CONFIGURE_SYMLINK
73 ln -sf ../configure $(@D)/build/configure
77 # Common configuration options
80 HOST_GCC_COMMON_DEPENDENCIES = \
84 $(if $(BR2_BINFMT_FLAT),host-elf2flt)
86 HOST_GCC_COMMON_CONF_OPTS = \
87 --target=$(GNU_TARGET_NAME) \
88 --with-sysroot=$(STAGING_DIR) \
89 --disable-__cxa_atexit \
93 --with-gmp=$(HOST_DIR)/usr \
94 --with-mpfr=$(HOST_DIR)/usr \
95 --with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \
96 --with-bugurl="http://bugs.buildroot.net/"
98 # Don't build documentation. It takes up extra space / build time,
99 # and sometimes needs specific makeinfo versions to work
100 HOST_GCC_COMMON_CONF_ENV = \
103 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
104 # Workaround until it's fixed in 4.5.4 or later
105 ifeq ($(ARCH),powerpc)
106 ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
107 HOST_GCC_COMMON_CONF_OPTS += --disable-target-optspace
110 HOST_GCC_COMMON_CONF_OPTS += --enable-target-optspace
113 # libitm needs sparc V9+
114 ifeq ($(BR2_sparc_v8)$(BR2_sparc_leon3),y)
115 HOST_GCC_COMMON_CONF_OPTS += --disable-libitm
118 # gcc 4.6.x quadmath requires wchar
119 ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
120 HOST_GCC_COMMON_CONF_OPTS += --disable-libquadmath
123 # libsanitizer requires wordexp, not in default uClibc config. Also
124 # doesn't build properly with musl.
125 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_TOOLCHAIN_BUILDROOT_MUSL),y)
126 HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
129 # libsanitizer is broken for SPARC
130 # https://bugs.busybox.net/show_bug.cgi?id=7951
131 ifeq ($(BR2_sparc),y)
132 HOST_GCC_COMMON_CONF_OPTS += --disable-libsanitizer
135 ifeq ($(BR2_GCC_ENABLE_TLS),y)
136 HOST_GCC_COMMON_CONF_OPTS += --enable-tls
138 HOST_GCC_COMMON_CONF_OPTS += --disable-tls
141 ifeq ($(BR2_GCC_ENABLE_LTO),y)
142 HOST_GCC_COMMON_CONF_OPTS += --enable-plugins --enable-lto
145 ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y)
146 HOST_GCC_COMMON_CONF_OPTS += --enable-libmudflap
148 HOST_GCC_COMMON_CONF_OPTS += --disable-libmudflap
151 ifeq ($(BR2_PTHREADS_NONE),y)
152 HOST_GCC_COMMON_CONF_OPTS += \
157 HOST_GCC_COMMON_CONF_OPTS += --enable-threads
160 ifeq ($(BR2_GCC_NEEDS_MPC),y)
161 HOST_GCC_COMMON_DEPENDENCIES += host-mpc
162 HOST_GCC_COMMON_CONF_OPTS += --with-mpc=$(HOST_DIR)/usr
165 ifeq ($(BR2_GCC_ENABLE_GRAPHITE),y)
166 HOST_GCC_COMMON_DEPENDENCIES += host-isl host-cloog
167 HOST_GCC_COMMON_CONF_OPTS += --with-isl=$(HOST_DIR)/usr --with-cloog=$(HOST_DIR)/usr
169 HOST_GCC_COMMON_CONF_OPTS += --without-isl --without-cloog
173 HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison
176 ifeq ($(BR2_SOFT_FLOAT),y)
177 # only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float
178 # powerpc seems to be needing it as well
179 ifeq ($(BR2_arm)$(BR2_armeb)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),y)
180 HOST_GCC_COMMON_CONF_OPTS += --with-float=soft
184 ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
185 HOST_GCC_COMMON_CONF_OPTS += --disable-decimal-float
188 # Determine arch/tune/abi/cpu options
189 ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
190 HOST_GCC_COMMON_CONF_OPTS += --with-arch=$(BR2_GCC_TARGET_ARCH)
192 ifneq ($(call qstrip,$(BR2_GCC_TARGET_ABI)),)
193 HOST_GCC_COMMON_CONF_OPTS += --with-abi=$(BR2_GCC_TARGET_ABI)
195 ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
196 ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
197 HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
199 HOST_GCC_COMMON_CONF_OPTS += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU))
203 GCC_TARGET_FPU = $(call qstrip,$(BR2_GCC_TARGET_FPU))
204 ifneq ($(GCC_TARGET_FPU),)
205 HOST_GCC_COMMON_CONF_OPTS += --with-fpu=$(GCC_TARGET_FPU)
208 GCC_TARGET_FLOAT_ABI = $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
209 ifneq ($(GCC_TARGET_FLOAT_ABI),)
210 HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI)
213 GCC_TARGET_MODE = $(call qstrip,$(BR2_GCC_TARGET_MODE))
214 ifneq ($(GCC_TARGET_MODE),)
215 HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE)
218 # Enable proper double/long double for SPE ABI
219 ifeq ($(BR2_powerpc_SPE),y)
220 HOST_GCC_COMMON_CONF_OPTS += \
221 --enable-e500_double \
222 --with-long-double-128
225 include $(sort $(wildcard package/gcc/*/*.mk))