From 5e8e1cdb608499dc620d88af32033adca72e5645 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 27 Jul 2010 18:16:59 +0200 Subject: [PATCH 1/4] target-gcc: Get rid of TARGET_GCC_FLAGS This variable is used only once, so let's just hardcode its value at its call site. Signed-off-by: Thomas Petazzoni --- toolchain/gcc/Makefile.in | 5 ----- toolchain/gcc/gcc-uclibc-4.x.mk | 5 ++++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/toolchain/gcc/Makefile.in b/toolchain/gcc/Makefile.in index 0dcd8035e3..4278bdbcfc 100644 --- a/toolchain/gcc/Makefile.in +++ b/toolchain/gcc/Makefile.in @@ -50,11 +50,6 @@ EXTRA_GCC_CONFIG_OPTIONS+=--with-build-time-tools=$(STAGING_DIR)/$(REAL_GNU_TARG #EXTRA_GCC_CONFIG_OPTIONS+=--with-as=$(TARGET_CROSS)as endif -TARGET_GCC_FLAGS= CFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ - CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ - CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ - BOOT_CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" - ifeq ($(BR2_PACKAGE_GCC_TARGET),y) EXTRA_TARGET_GCC_CONFIG_OPTIONS:= diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk index 081e906c89..cfbe6164d3 100644 --- a/toolchain/gcc/gcc-uclibc-4.x.mk +++ b/toolchain/gcc/gcc-uclibc-4.x.mk @@ -393,7 +393,10 @@ $(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.prepared (cd $(GCC_BUILD_DIR3); rm -rf config.cache; \ $(TARGET_CONFIGURE_OPTS) \ $(TARGET_CONFIGURE_ARGS) \ - $(TARGET_GCC_FLAGS) \ + CFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ + CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ + CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ + BOOT_CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ $(GCC_SRC_DIR)/configure $(QUIET) \ --prefix=/usr \ --build=$(GNU_HOST_NAME) \ From f43054d841c82c121c4fd8c1e6604888233b6d10 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 27 Jul 2010 18:17:26 +0200 Subject: [PATCH 2/4] target-gcc: fix build Now that $(STAGING_DIR)/usr/bin is no longer in the PATH, we need to pass the absolute paths to $(TARGET_CC) when building the target gcc compiler. This commit fixes the target gcc build problem reported on the list. I have successfully been able to build a target gcc for ARM, use it to compile a hello world application on the target and run this application. Signed-off-by: Thomas Petazzoni --- toolchain/gcc/gcc-uclibc-4.x.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk index cfbe6164d3..52b20e9591 100644 --- a/toolchain/gcc/gcc-uclibc-4.x.mk +++ b/toolchain/gcc/gcc-uclibc-4.x.mk @@ -397,6 +397,8 @@ $(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR3)/.prepared CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ BOOT_CFLAGS="$(TARGET_CFLAGS) $(TARGET_SOFT_FLOAT)" \ + GCC_FOR_TARGET="$(TARGET_CC)" \ + CC_FOR_TARGET="$(TARGET_CC)" \ $(GCC_SRC_DIR)/configure $(QUIET) \ --prefix=/usr \ --build=$(GNU_HOST_NAME) \ From 4e62eeed193e2c90bfbca52a28efaa1c2f5cd327 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 27 Jul 2010 18:20:15 +0200 Subject: [PATCH 3/4] target-gcc: no need to strip binaries, remove .la files and doc This is done in a global way by the target-finalize target of the main Makefile. Signed-off-by: Thomas Petazzoni --- toolchain/gcc/gcc-uclibc-4.x.mk | 9 --------- 1 file changed, 9 deletions(-) diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk index 52b20e9591..5dec86c87e 100644 --- a/toolchain/gcc/gcc-uclibc-4.x.mk +++ b/toolchain/gcc/gcc-uclibc-4.x.mk @@ -445,15 +445,6 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled # Remove broken specs file (cross compile flag is set). rm -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/specs - -(cd $(TARGET_DIR)/bin && find -type f | xargs $(STRIPCMD) > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/bin && find -type f | xargs $(STRIPCMD) > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR) && $(STRIPCMD) cc1 cc1plus collect2 > /dev/null 2>&1) - -(cd $(TARGET_DIR)/usr/lib && $(STRIPCMD) libstdc++.so.*.*.* > /dev/null 2>&1) - -(cd $(TARGET_DIR)/lib && $(STRIPCMD) libgcc_s*.so.*.*.* > /dev/null 2>&1) - # - rm -f $(TARGET_DIR)/usr/lib/*.la* - #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ - # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc # Work around problem of missing syslimits.h if [ ! -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/syslimits.h ]; then \ echo "warning: working around missing syslimits.h"; \ From fed6a2a6ea884630a3723d2a49579e63e87ffd57 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Tue, 27 Jul 2010 18:21:44 +0200 Subject: [PATCH 4/4] target-gcc: remove useless copies of gcc When doing the "make install" of target, three identical copies of gcc are installed in $(TARGET_DIR)/usr/bin: 039adcc582c365f12ba6fc5f96098128 arm-unknown-linux-uclibcgnueabi-gcc 039adcc582c365f12ba6fc5f96098128 arm-unknown-linux-uclibcgnueabi-gcc-4.3.5 039adcc582c365f12ba6fc5f96098128 gcc This patch removes the first two copies and keeps only the common "gcc" one. Signed-off-by: Thomas Petazzoni --- toolchain/gcc/gcc-uclibc-4.x.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolchain/gcc/gcc-uclibc-4.x.mk b/toolchain/gcc/gcc-uclibc-4.x.mk index 5dec86c87e..9720ed39b4 100644 --- a/toolchain/gcc/gcc-uclibc-4.x.mk +++ b/toolchain/gcc/gcc-uclibc-4.x.mk @@ -445,6 +445,9 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled # Remove broken specs file (cross compile flag is set). rm -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/specs + # Remove useless copies of gcc + rm -f $(TARGET_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc* + # Work around problem of missing syslimits.h if [ ! -f $(TARGET_DIR)/usr/$(GCC_LIB_SUBDIR)/$(GCC_INCLUDE_DIR)/syslimits.h ]; then \ echo "warning: working around missing syslimits.h"; \