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
+endif
+
HOST_GCC_INITIAL_CONF_OPT = \
$(HOST_GCC_COMMON_CONF_OPT) \
--enable-languages=c \
--disable-shared \
--without-headers \
+ --disable-threads \
--with-newlib \
--disable-largefile \
--disable-nls \
HOST_GCC_INITIAL_CONF_ENV = \
$(HOST_GCC_COMMON_CONF_ENV)
-HOST_GCC_INITIAL_MAKE_OPT = all-gcc
-HOST_GCC_INITIAL_INSTALL_OPT = install-gcc
+# 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_OPT = $(if $(BR2_TOOLCHAIN_HAS_SSP),gcc_cv_libc_provides_ssp=yes) all-gcc all-target-libgcc
+HOST_GCC_INITIAL_INSTALL_OPT = install-gcc install-target-libgcc
$(eval $(host-autotools-package))
$(SHELL) $(@D)/$(GLIBC_SRC_SUBDIR)/configure \
ac_cv_path_BASH_SHELL=/bin/bash \
libc_cv_forced_unwind=yes \
+ libc_cv_ssp=no \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
endef
$(eval $(autotools-package))
-
-# Before (e)glibc is built, we must have the second stage cross-compiler
-$(GLIBC_TARGET_BUILD): | host-gcc-intermediate