919c06c282
We have a toolchain wrapper for external toolchain, but it is also beneficial for internal toolchains, for the following reasons: 1. It can make sure that BR2_TARGET_OPTIMIZATION is passed to the compiler even if a package's build system doesn't honor CFLAGS. 2. It allows us to do the unsafe path check (i.e. -I/usr/include) without patching gcc. 3. It makes it simpler to implement building each package with a separate staging directory (per-package staging). 4. It makes it simpler to implement a compiler hash check for ccache. The wrapper is reused from the external toolchain. A third CROSS_PATH_ option is added to the wrapper: in this case, the real executable is in the same directory, with the extension .real. The creation of the simple symlinks is merged with the creation of the wrapper symlinks, otherwise part of the -gcc-ar handling logic would have to be repeated. The complex case-condition could be refactored with the one for the external toolchain, but then it becomes even more complex because they each have special corner cases. For example, the internal toolchain has to handle *.real to avoid creating an extra indirection after host-gcc-{final,initial}-rebuild. Instead of creating the .real files, it would also have been possible to install the internal toolchain in $(HOST_DIR)/opt, similar to what we do for the external toolchain. However, then we would also have to copy things to the sysroot and do more of the magic that the external toolchain is doing. So keeping it in $(HOST_DIR)/usr/bin is much simpler. Note that gcc-initial has to be wrapped as well, because it is used for building libc and we want to apply the same magic when building libc. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Cc: Fabio Porcedda <fabio.porcedda@gmail.com> Cc: Jérôme Oufella <jerome.oufella@savoirfairelinux.com> Reviewed-by: Romain Naour <romain.naour@openwide.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
70 lines
2.4 KiB
Makefile
70 lines
2.4 KiB
Makefile
################################################################################
|
|
#
|
|
# gcc-initial
|
|
#
|
|
################################################################################
|
|
|
|
GCC_INITIAL_VERSION = $(GCC_VERSION)
|
|
GCC_INITIAL_SITE = $(GCC_SITE)
|
|
GCC_INITIAL_SOURCE = $(GCC_SOURCE)
|
|
|
|
HOST_GCC_INITIAL_DEPENDENCIES = $(HOST_GCC_COMMON_DEPENDENCIES)
|
|
|
|
HOST_GCC_INITIAL_EXTRACT_CMDS = $(HOST_GCC_EXTRACT_CMDS)
|
|
|
|
ifneq ($(call qstrip, $(BR2_XTENSA_CORE_NAME)),)
|
|
HOST_GCC_INITIAL_POST_EXTRACT_HOOKS += HOST_GCC_XTENSA_OVERLAY_EXTRACT
|
|
endif
|
|
|
|
HOST_GCC_INITIAL_POST_PATCH_HOOKS += HOST_GCC_APPLY_PATCHES
|
|
|
|
# gcc doesn't support in-tree build, so we create a 'build'
|
|
# subdirectory in the gcc sources, and build from there.
|
|
HOST_GCC_INITIAL_SUBDIR = build
|
|
|
|
HOST_GCC_INITIAL_PRE_CONFIGURE_HOOKS += HOST_GCC_CONFIGURE_SYMLINK
|
|
|
|
# gcc on ARC has a bug: in its libgcc, even when no C library is
|
|
# available (--with-newlib is passed, and therefore inhibit_libc is
|
|
# defined), it tries to use the C library for the libgmon
|
|
# library. Since it's not needed in gcc-initial, we disabled it here.
|
|
ifeq ($(BR2_GCC_VERSION_4_8_ARC),y)
|
|
define HOST_GCC_INITIAL_DISABLE_LIBGMON
|
|
$(SED) 's/crtbeginS.o libgmon.a crtg.o/crtbeginS.o crtg.o/' \
|
|
$(@D)/libgcc/config.host
|
|
endef
|
|
HOST_GCC_INITIAL_POST_PATCH_HOOKS += HOST_GCC_INITIAL_DISABLE_LIBGMON
|
|
HOST_GCC_INITIAL_POST_RSYNC_HOOKS += HOST_GCC_INITIAL_DISABLE_LIBGMON
|
|
endif
|
|
|
|
HOST_GCC_INITIAL_CONF_OPTS = \
|
|
$(HOST_GCC_COMMON_CONF_OPTS) \
|
|
--enable-languages=c \
|
|
--disable-shared \
|
|
--without-headers \
|
|
--disable-threads \
|
|
--with-newlib \
|
|
--disable-largefile \
|
|
--disable-nls \
|
|
$(call qstrip,$(BR2_EXTRA_GCC_CONFIG_OPTIONS))
|
|
|
|
HOST_GCC_INITIAL_CONF_ENV = \
|
|
$(HOST_GCC_COMMON_CONF_ENV)
|
|
|
|
# We need to tell gcc that the C library will be providing the ssp
|
|
# support, as it can't guess it since the C library hasn't been built
|
|
# yet (we're gcc-initial).
|
|
HOST_GCC_INITIAL_MAKE_OPTS = $(if $(BR2_TOOLCHAIN_HAS_SSP),gcc_cv_libc_provides_ssp=yes) all-gcc
|
|
HOST_GCC_INITIAL_INSTALL_OPTS = install-gcc
|
|
|
|
ifeq ($(BR2_GCC_SUPPORTS_FINEGRAINEDMTUNE),y)
|
|
HOST_GCC_INITIAL_MAKE_OPTS += all-target-libgcc
|
|
HOST_GCC_INITIAL_INSTALL_OPTS += install-target-libgcc
|
|
endif
|
|
|
|
HOST_GCC_INITIAL_TOOLCHAIN_WRAPPER_ARGS += $(HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS)
|
|
HOST_GCC_INITIAL_POST_BUILD_HOOKS += TOOLCHAIN_BUILD_WRAPPER
|
|
HOST_GCC_INITIAL_POST_INSTALL_HOOKS += HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
|
|
|
|
$(eval $(host-autotools-package))
|