6 --with-headers=$(TOOLCHAIN_DIR)/include \
7 --enable-languages=$(TARGET_LANGUAGES) \
10 --with-slibdir=$(TOOLCHAIN_DIR)/lib \
12 --with-libelf=$(TOPDIR)/staging_dir/host
14 ifndef CONFIG_USE_GLIBC
15 GCC_CONFIGURE += --disable-libsanitizer
19 GCC_MAKE += gcc_cv_libc_provides_ssp=yes
22 ifneq ($(CONFIG_SJLJ_EXCEPTIONS),)
24 --enable-sjlj-exceptions
27 define CleanupToolchain
28 $(INSTALL_DIR) $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)
29 # Important! Required for limits.h to be fixed.
30 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
31 ln -sf ../include $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/sys-include
32 rm -rf $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
33 ln -sf ../lib $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib
34 $(if $(CONFIG_ARCH_64BIT),ln -sf ../lib64 $(TOOLCHAIN_DIR)/$(REAL_GNU_TARGET_NAME)/lib64)
39 mkdir -p $(GCC_BUILD_DIR)
40 (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
45 ifeq ($(CONFIG_USE_GLIBC)$(CONFIG_INSTALL_GCCGO),yy)
47 # link crtX.o for gotools
48 mkdir -p $(GCC_BUILD_DIR)/gotools
49 $(foreach crt, i 1 n, ln -sf ../../glibc-dev/lib/crt$(crt).o $(GCC_BUILD_DIR)/gotools/ ; )
55 +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all
59 for app in $(TOOLCHAIN_DIR)/bin/$(OPTIMIZE_FOR_CPU)*-{gcc,gcc-*,g++}; do \
60 [ -e $$$$app ] || continue; \
61 old_base=$$$$(basename $$$$app); \
62 new_base=$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_NAME))-$$$${old_base##$(OPTIMIZE_FOR_CPU)-}; \
63 sed -e "s/@CC_BASE@/$$$$old_base/" \
64 -e 's/@EXTRA_ARCH_OPTS@/$(call qstrip,$(CONFIG_EXTRA_TARGET_ARCH_OPTS))/' \
65 ../files/alternate-arch-cc.in > \
66 $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
67 chmod a+x $(TOOLCHAIN_DIR)/bin/$$$$new_base; \
73 +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) install
74 # Set up the symlinks to enable lying about target name.
76 (cd $(TOOLCHAIN_DIR); \
77 ln -sf $(REAL_GNU_TARGET_NAME) $(GNU_TARGET_NAME); \
79 for app in $(REAL_GNU_TARGET_NAME)-* ; do \
81 $(GNU_TARGET_NAME)$$$${app##$(REAL_GNU_TARGET_NAME)}; \
84 $(if $(CONFIG_EXTRA_TARGET_ARCH),$(call SetupExtraArch))
85 $(RM) $(TOOLCHAIN_DIR)/lib/libiberty.a
86 $(SCRIPT_DIR)/patch-specs.sh "$(TOOLCHAIN_DIR)"
89 $(eval $(call HostBuild))