2013-06-30 21:28:59 +02:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Common variables for the gcc-initial, gcc-intermediate and gcc-final
|
|
|
|
# packages.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
#
|
|
|
|
# Version, site and source
|
|
|
|
#
|
|
|
|
|
|
|
|
GCC_VERSION = $(call qstrip,$(BR2_GCC_VERSION))
|
|
|
|
|
|
|
|
ifeq ($(BR2_GCC_VERSION_SNAP),y)
|
|
|
|
GCC_SNAP_DATE = $(call qstrip,$(BR2_GCC_SNAP_DATE))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(GCC_SNAP_DATE),)
|
|
|
|
GCC_SITE = ftp://gcc.gnu.org/pub/gcc/snapshots/$(GCC_SNAP_DATE)/
|
|
|
|
else ifeq ($(findstring avr32,$(GCC_VERSION)),avr32)
|
|
|
|
GCC_SITE = ftp://www.at91.com/pub/buildroot/
|
2013-12-05 18:20:49 +01:00
|
|
|
else ifeq ($(BR2_arc),y)
|
|
|
|
GCC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,gcc,$(GCC_VERSION))
|
|
|
|
GCC_SOURCE = gcc-$(GCC_VERSION).tar.gz
|
2014-04-30 00:27:51 +02:00
|
|
|
else
|
2013-06-30 21:28:59 +02:00
|
|
|
GCC_SITE = $(BR2_GNU_MIRROR:/=)/gcc/gcc-$(GCC_VERSION)
|
|
|
|
endif
|
|
|
|
|
2013-12-05 18:20:49 +01:00
|
|
|
GCC_SOURCE ?= gcc-$(GCC_VERSION).tar.bz2
|
2013-06-30 21:28:59 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Xtensa special hook
|
|
|
|
#
|
|
|
|
|
|
|
|
define HOST_GCC_XTENSA_OVERLAY_EXTRACT
|
|
|
|
tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(call qstrip,\
|
|
|
|
$(BR2_XTENSA_CORE_NAME)).tar -C $(@D) --strip-components=1 gcc
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# Apply patches
|
|
|
|
#
|
|
|
|
|
gcc: remove BR2_GCC_SHARED_LIBGCC option
Commit 6b48b4803450 ("add a know to enable/disable building a shared
libgcc"), from october 2006, isn't really as to why a
BR2_GCC_SHARED_LIBGCC option was needed. However, now that gcc has
been converted to the package infrastructure, it causes problems
because the host packages are always being passed --enable-shared
--disable-static, so re-adding --disable-shared on top of that break
things.
Moreover, our tests indicate that both a shared *and* a static version
of libgcc are built, and that linking dynamically and statically a
program that uses libgcc_s gives correct results: dynamically linked
against libgcc_s in the first case, statically linked in the second
case.
Therefore, it appears that this option is no longer necessary, and
removing it has the advantage of fixing the builds of
qemu_mips64_malta_defconfig and qemu_sparc_ss10_defconfig, both of
which had BR2_GCC_SHARED_LIBGCC not enabled.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-07-08 17:59:45 +02:00
|
|
|
ifeq ($(ARCH),powerpc)
|
2013-07-05 10:40:52 +02:00
|
|
|
ifneq ($(BR2_SOFT_FLOAT),)
|
|
|
|
define HOST_GCC_APPLY_POWERPC_PATCH
|
|
|
|
support/scripts/apply-patches.sh $(@D) package/gcc/$(GCC_VERSION) powerpc-link-with-math-lib.patch.conditional
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-06-30 21:28:59 +02:00
|
|
|
define HOST_GCC_APPLY_PATCHES
|
2013-11-11 15:36:36 +01:00
|
|
|
if test -d package/gcc/$(GCC_VERSION); then \
|
|
|
|
support/scripts/apply-patches.sh $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \
|
|
|
|
fi;
|
2013-07-05 10:40:52 +02:00
|
|
|
$(HOST_GCC_APPLY_POWERPC_PATCH)
|
2013-06-30 21:28:59 +02:00
|
|
|
endef
|
|
|
|
|
2013-06-30 21:29:04 +02:00
|
|
|
#
|
|
|
|
# Custom extract command to save disk space
|
|
|
|
#
|
|
|
|
|
|
|
|
define HOST_GCC_EXTRACT_CMDS
|
2013-12-05 18:20:49 +01:00
|
|
|
$(call suitable-extractor,$(GCC_SOURCE)) $(DL_DIR)/$(GCC_SOURCE) | \
|
2013-06-30 21:29:04 +02:00
|
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) \
|
|
|
|
--exclude='libjava/*' \
|
|
|
|
--exclude='libgo/*' \
|
|
|
|
--exclude='gcc/testsuite/*' \
|
|
|
|
--exclude='libstdc++-v3/testsuite/*' \
|
|
|
|
$(TAR_OPTIONS) -
|
|
|
|
mkdir -p $(@D)/libstdc++-v3/testsuite/
|
|
|
|
echo "all:" > $(@D)/libstdc++-v3/testsuite/Makefile.in
|
|
|
|
echo "install:" >> $(@D)/libstdc++-v3/testsuite/Makefile.in
|
|
|
|
endef
|
|
|
|
|
2013-06-30 21:28:59 +02:00
|
|
|
#
|
|
|
|
# Create 'build' directory and configure symlink
|
|
|
|
#
|
|
|
|
|
|
|
|
define HOST_GCC_CONFIGURE_SYMLINK
|
|
|
|
mkdir -p $(@D)/build
|
2013-09-02 18:06:35 +02:00
|
|
|
ln -sf ../configure $(@D)/build/configure
|
2013-06-30 21:28:59 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# Common configuration options
|
|
|
|
#
|
|
|
|
|
|
|
|
HOST_GCC_COMMON_DEPENDENCIES = \
|
|
|
|
host-binutils \
|
|
|
|
host-gmp \
|
2013-09-11 14:12:06 +02:00
|
|
|
host-mpfr \
|
|
|
|
$(if $(BR2_BINFMT_FLAT),host-elf2flt)
|
2013-06-30 21:28:59 +02:00
|
|
|
|
|
|
|
HOST_GCC_COMMON_CONF_OPT = \
|
|
|
|
--target=$(GNU_TARGET_NAME) \
|
|
|
|
--with-sysroot=$(STAGING_DIR) \
|
|
|
|
--disable-__cxa_atexit \
|
|
|
|
--with-gnu-ld \
|
|
|
|
--disable-libssp \
|
|
|
|
--disable-multilib \
|
|
|
|
--with-gmp=$(HOST_DIR)/usr \
|
2013-09-04 16:18:14 +02:00
|
|
|
--with-mpfr=$(HOST_DIR)/usr
|
|
|
|
|
|
|
|
# Don't build documentation. It takes up extra space / build time,
|
|
|
|
# and sometimes needs specific makeinfo versions to work
|
|
|
|
HOST_GCC_COMMON_CONF_ENV = \
|
2013-09-03 15:22:17 +02:00
|
|
|
MAKEINFO=missing
|
2013-06-30 21:28:59 +02:00
|
|
|
|
|
|
|
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43810
|
|
|
|
# Workaround until it's fixed in 4.5.4 or later
|
|
|
|
ifeq ($(ARCH),powerpc)
|
|
|
|
ifeq ($(findstring x4.5.,x$(GCC_VERSION)),x4.5.)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-target-optspace
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --enable-target-optspace
|
|
|
|
endif
|
|
|
|
|
|
|
|
# gcc 4.6.x quadmath requires wchar
|
|
|
|
ifneq ($(BR2_TOOLCHAIN_BUILDROOT_WCHAR),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-libquadmath
|
|
|
|
endif
|
|
|
|
|
2014-05-05 23:17:09 +02:00
|
|
|
# libsanitizer requires wordexp, not in default uClibc config. Also
|
|
|
|
# doesn't build properly with musl.
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_BUILDROOT_UCLIBC)$(BR2_TOOLCHAIN_BUILDROOT_MUSL),y)
|
2014-04-24 03:00:32 +02:00
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-libsanitizer
|
|
|
|
endif
|
|
|
|
|
2013-06-30 21:28:59 +02:00
|
|
|
ifeq ($(BR2_GCC_ENABLE_TLS),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --enable-tls
|
|
|
|
else
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-tls
|
|
|
|
endif
|
|
|
|
|
2013-09-02 18:06:38 +02:00
|
|
|
ifeq ($(BR2_GCC_ENABLE_LIBMUDFLAP),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --enable-libmudflap
|
|
|
|
else
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-libmudflap
|
|
|
|
endif
|
|
|
|
|
2013-06-30 21:28:59 +02:00
|
|
|
ifeq ($(BR2_PTHREADS_NONE),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += \
|
|
|
|
--disable-threads \
|
|
|
|
--disable-libitm \
|
|
|
|
--disable-libatomic
|
|
|
|
else
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --enable-threads
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_GCC_NEEDS_MPC),y)
|
|
|
|
HOST_GCC_COMMON_DEPENDENCIES += host-mpc
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-mpc=$(HOST_DIR)/usr
|
|
|
|
endif
|
|
|
|
|
2014-03-20 23:35:36 +01:00
|
|
|
ifneq ($(BR2_arc)$(BR2_GCC_VERSION_SNAP),)
|
2013-06-30 21:28:59 +02:00
|
|
|
HOST_GCC_COMMON_DEPENDENCIES += host-flex host-bison
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_SOFT_FLOAT),y)
|
|
|
|
# only mips*-*-*, arm*-*-* and sparc*-*-* accept --with-float
|
|
|
|
# powerpc seems to be needing it as well
|
|
|
|
ifeq ($(BR2_arm)$(BR2_armeb)$(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el)$(BR2_powerpc)$(BR2_sparc),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-float=soft
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --disable-decimal-float
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Determine arch/tune/abi/cpu options
|
|
|
|
ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-arch=$(BR2_GCC_TARGET_ARCH)
|
|
|
|
endif
|
|
|
|
ifneq ($(call qstrip,$(BR2_GCC_TARGET_TUNE)),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-tune=$(BR2_GCC_TARGET_TUNE)
|
|
|
|
endif
|
|
|
|
ifneq ($(call qstrip,$(BR2_GCC_TARGET_ABI)),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-abi=$(BR2_GCC_TARGET_ABI)
|
|
|
|
endif
|
2013-07-20 14:52:07 +02:00
|
|
|
# GCC doesn't support --with-cpu for bfin
|
|
|
|
ifeq ($(BR2_bfin),)
|
2013-06-30 21:28:59 +02:00
|
|
|
ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU)),)
|
|
|
|
ifneq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
|
|
|
|
else
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-cpu=$(call qstrip,$(BR2_GCC_TARGET_CPU))
|
|
|
|
endif
|
|
|
|
endif
|
2013-07-20 14:52:07 +02:00
|
|
|
endif
|
2013-06-30 21:28:59 +02:00
|
|
|
|
arch: introduce BR2_GCC_TARGET_{FPU, FLOAT_ABI}
Buildroot already has the BR2_GCC_TARGET_{TUNE,ARCH,ABI,CPU} hidden
kconfig strings that allow per-architecture Config.in files to feed
the appropriate values of --with-{tune,arch,abi-cpu} when building
gcc, or the appropriate flags for the external toolchain wrapper.
This commit has two additional options:
BR2_GCC_TARGET_{FPU,FLOAT_ABI}, that allows to define the
--with-{fpu,float} gcc configure options for the internal backend, or
the -m{fpu,float-abi} options for the flags of the external toolchain
wrapper.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-07-16 10:03:12 +02:00
|
|
|
GCC_TARGET_FPU = $(call qstrip,$(BR2_GCC_TARGET_FPU))
|
|
|
|
ifneq ($(GCC_TARGET_FPU),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-fpu=$(GCC_TARGET_FPU)
|
|
|
|
endif
|
|
|
|
|
|
|
|
GCC_TARGET_FLOAT_ABI = $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
|
|
|
|
ifneq ($(GCC_TARGET_FLOAT_ABI),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-float=$(GCC_TARGET_FLOAT_ABI)
|
|
|
|
endif
|
|
|
|
|
2013-07-16 10:03:22 +02:00
|
|
|
GCC_TARGET_MODE = $(call qstrip,$(BR2_GCC_TARGET_MODE))
|
|
|
|
ifneq ($(GCC_TARGET_MODE),)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += --with-mode=$(GCC_TARGET_MODE)
|
|
|
|
endif
|
|
|
|
|
2013-06-30 21:28:59 +02:00
|
|
|
# Branding works on >= 4.3
|
|
|
|
ifneq ($(findstring x4.2.,x$(GCC_VERSION)),x4.2.)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += \
|
|
|
|
--with-pkgversion="Buildroot $(BR2_VERSION_FULL)" \
|
|
|
|
--with-bugurl="http://bugs.buildroot.net/"
|
|
|
|
endif
|
|
|
|
|
2013-09-02 18:06:38 +02:00
|
|
|
# Enable proper double/long double for SPE ABI
|
2013-06-30 21:28:59 +02:00
|
|
|
ifeq ($(BR2_powerpc_SPE),y)
|
|
|
|
HOST_GCC_COMMON_CONF_OPT += \
|
|
|
|
--enable-e500_double \
|
|
|
|
--with-long-double-128
|
|
|
|
endif
|
|
|
|
|
2013-09-03 10:45:41 +02:00
|
|
|
include $(sort $(wildcard package/gcc/*/*.mk))
|