6 --with-headers=$(TOOLCHAIN_DIR)/include \
7 --disable-libsanitizer \
8 --enable-languages=$(TARGET_LANGUAGES) \
11 --with-slibdir=$(TOOLCHAIN_DIR)/lib \
13 --with-libelf=$(TOPDIR)/staging_dir/host
16 GCC_MAKE += gcc_cv_libc_provides_ssp=yes
19 ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
21 --enable-sjlj-exceptions
24 define CleanupToolchain
25 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)
26 # Important! Required for limits.h to be fixed.
27 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
28 ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
29 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
30 ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
31 $(if $(CONFIG_ARCH_64BIT),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
36 mkdir -p $(GCC_BUILD_DIR)
37 (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
42 ifeq ($(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yy)
44 # link crtX.o for gotools
45 mkdir -p $(GCC_BUILD_DIR)/gotools
46 $(foreach crt, i 1 n, ln -sf ../../glibc-dev/lib/crt$(crt).o $(GCC_BUILD_DIR)/gotools/ ; )
52 +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all
56 for app in $(TOOLCHAIN_DIR)/bin/$(OPTIMIZE_FOR_CPU)*-{gcc,gcc-*,g++}; do \
57 [ -e $$$$app ] || continue; \
58 old_base=$$$$(basename $$$$app); \
59 new_base=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-$$$${old_base##$(OPTIMIZE_FOR_CPU)-}; \
60 sed -e "s/@CC_BASE@/$$$$old_base/" \
61 -e 's/@EXTRA_ARCH_OPTS@/$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_OPTS))/' \
62 ../files/alternate-arch-cc.in > \
63 $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
64 chmod a+x $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
70 $(_SINGLE)$(GCC_MAKE) -C $(GCC_BUILD_DIR) install
71 # Set up the symlinks to enable lying about target name.
73 (cd $(TOOLCHAIN_DIR); \
74 ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
76 for app in $(REAL_GNU_TARGET_NAME)-* ; do \
78 $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
81 $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch))
82 $(RM) $(TOOLCHAIN_DIR)/lib/libiberty.a
83 $(SCRIPT_DIR)/patch-specs.sh "$(TOOLCHAIN_DIR)"
86 $(eval $(call HostBuild))