| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 | diff --git a/Makefile b/Makefileindex a7b7729946..55adae35dd 100644--- a/Makefile+++ b/Makefile@@ -722,13 +722,13 @@ target-finalize: $(PACKAGES) $(TARGET_DIR) host-finalize 	@$(call MESSAGE,"Finalizing target directory") 	$(call per-package-rsync,$(sort $(PACKAGES)),target,$(TARGET_DIR)) 	$(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))-	rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \+	rm -rf $(TARGET_DIR)/usr/share/aclocal \ 		$(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \ 		$(TARGET_DIR)/usr/lib/cmake $(TARGET_DIR)/usr/share/cmake \ 		$(TARGET_DIR)/usr/lib/rpm $(TARGET_DIR)/usr/doc 	find $(TARGET_DIR)/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f 	find $(TARGET_DIR)/lib/ $(TARGET_DIR)/usr/lib/ $(TARGET_DIR)/usr/libexec/ \-		\( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | xargs -0 rm -f+		\( -name '*.la' -o -name '*.prl' \) -print0 | xargs -0 rm -f ifneq ($(BR2_PACKAGE_GDB),y) 	rm -rf $(TARGET_DIR)/usr/share/gdb endifdiff --git a/package/Config.in b/package/Config.inindex e9e8d93d6b..f971bae27b 100644--- a/package/Config.in+++ b/package/Config.in@@ -183,6 +183,7 @@ menu "Development tools" 	source "package/findutils/Config.in" 	source "package/flex/Config.in" 	source "package/gawk/Config.in"+	source "package/gcc/Config.in" 	source "package/gettext/Config.in" 	source "package/gettext-gnu/Config.in" 	source "package/gettext-tiny/Config.in"diff --git a/package/gcc/Config.in b/package/gcc/Config.innew file mode 100644index 0000000000..40cd1730a1--- /dev/null+++ b/package/gcc/Config.in@@ -0,0 +1,21 @@+config BR2_PACKAGE_GCC_TARGET+	bool "gcc"+	depends on BR2_TOOLCHAIN_BUILDROOT+	select BR2_PACKAGE_BINUTILS+	select BR2_PACKAGE_BINUTILS_TARGET+	select BR2_PACKAGE_GMP+	select BR2_PACKAGE_MPFR+	select BR2_PACKAGE_MPC+	help+	  If you want the target system to be able to run+	  binutils/gcc and compile native code, say Y here.++config BR2_EXTRA_TARGET_GCC_CONFIG_OPTIONS+	string "Additional target gcc options"+	default ""+	depends on BR2_PACKAGE_GCC_TARGET+	help+	  Any additional target gcc options you may want to include....+	  Including, but not limited to --disable-checking etc.+	  Refer to */configure in your gcc sources.+diff --git a/package/gcc/gcc-target/gcc-target.hash b/package/gcc/gcc-target/gcc-target.hashnew file mode 120000index 0000000000..7ac9361ab2--- /dev/null+++ b/package/gcc/gcc-target/gcc-target.hash@@ -0,0 +1 @@+../gcc.hash\ No newline at end of filediff --git a/package/gcc/gcc-target/gcc-target.mk b/package/gcc/gcc-target/gcc-target.mknew file mode 100644index 0000000000..56673f390c--- /dev/null+++ b/package/gcc/gcc-target/gcc-target.mk@@ -0,0 +1,78 @@+################################################################################+#+# gcc-target+#+################################################################################++GCC_TARGET_VERSION = $(GCC_VERSION)+GCC_TARGET_SITE = $(GCC_SITE)+GCC_TARGET_SOURCE = $(GCC_SOURCE)++# Use the same archive as gcc-initial and gcc-final+GCC_TARGET_DL_SUBDIR = gcc++GCC_TARGET_DEPENDENCIES = gmp mpfr mpc++# First, we use HOST_GCC_COMMON_MAKE_OPTS to get a lot of correct flags (such as+# the arch, abi, float support, etc.) which are based on the config used to+# build the internal toolchain+GCC_TARGET_CONF_OPTS = $(HOST_GCC_COMMON_CONF_OPTS)+# Then, we modify incorrect flags from HOST_GCC_COMMON_CONF_OPTS+GCC_TARGET_CONF_OPTS += \+	--with-sysroot=/ \+	--with-build-sysroot=$(STAGING_DIR) \+	--disable-__cxa_atexit \+	--with-gmp=$(STAGING_DIR) \+	--with-mpc=$(STAGING_DIR) \+	--with-mpfr=$(STAGING_DIR)+# Then, we force certain flags that may appear in HOST_GCC_COMMON_CONF_OPTS+GCC_TARGET_CONF_OPTS += \+	--disable-libquadmath \+	--disable-libsanitizer \+	--disable-plugin \+	--disable-lto+# Finally, we add some of our own flags+GCC_TARGET_CONF_OPTS += \+	--enable-languages=c \+	--disable-boostrap \+	--disable-libgomp \+	--disable-nls \+	--disable-libmpx \+	--disable-gcov \+	$(EXTRA_TARGET_GCC_CONFIG_OPTIONS)++GCC_TARGET_CONF_ENV = $(HOST_GCC_COMMON_CONF_ENV)++GCC_TARGET_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)++# Install standard C headers (from glibc)+define GCC_TARGET_INSTALL_HEADERS+	find $(TARGET_DIR)/usr/include -perm 0444 -exec chmod u+w {} \;+	cp -r $(STAGING_DIR)/usr/include $(TARGET_DIR)/usr+endef+GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_INSTALL_HEADERS++# Install standard C libraries (from glibc)+GCC_TARGET_GLIBC_LIBS = \+	*crt*.o *_nonshared.a \+	libBrokenLocale.so libanl.so libbfd.so libc.so libcrypt.so libdl.so \+	libm.so libnss_compat.so libnss_db.so libnss_files.so libnss_hesiod.so \+	libpthread.so libresolv.so librt.so libthread_db.so libutil.so++define GCC_TARGET_INSTALL_LIBS+	for libpattern in $(GCC_TARGET_GLIBC_LIBS); do \+		$(call copy_toolchain_lib_root,$$libpattern) ; \+	done+endef+GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_INSTALL_LIBS++# Remove unnecessary files (extra links to gcc binaries, and libgcc which is+# already in `/lib`)+define GCC_TARGET_RM_FILES+	rm -f $(TARGET_DIR)/usr/bin/$(ARCH)-buildroot-linux-gnu-gcc*+	rm -f $(TARGET_DIR)/usr/lib/libgcc_s*.so*+	rm -f $(TARGET_DIR)/usr/$(ARCH)-buildroot-linux-gnu/lib/ldscripts/elf32*+	rm -f $(TARGET_DIR)/usr/$(ARCH)-buildroot-linux-gnu/lib/ldscripts/elf64b*+endef+GCC_TARGET_POST_INSTALL_TARGET_HOOKS += GCC_TARGET_RM_FILES++$(eval $(autotools-package))
 |