From abdd6e0f137779db37d864248e5704ace1786c76 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 28 Jun 2007 07:30:25 +0000 Subject: [PATCH] replace gcc 4.2 snapshot with 4.2.0 release (sync patches with uclibc buildroot), adjust gcc makefile for PATCH_DIR changes SVN-Revision: 7753 --- toolchain/gcc/Config.in | 4 +- toolchain/gcc/Config.version | 2 +- toolchain/gcc/Makefile | 7 - .../{4.2 => 4.2.0}/100-uclibc-conf.patch | 20 --- .../103-uclibc-conf-noupstream.patch | 0 .../{4.2 => 4.2.0}/200-uclibc-locale.patch | 0 .../203-uclibc-locale-no__x.patch | 0 .../204-uclibc-locale-wchar_fix.patch | 0 .../205-uclibc-locale-update.patch | 0 .../{4.2 => 4.2.0}/300-libstdc++-pic.patch | 0 .../301-missing-execinfo_h.patch | 0 .../{4.2 => 4.2.0}/302-c99-snprintf.patch | 0 .../303-c99-complex-ugly-hack.patch | 0 .../{4.2 => 4.2.0}/304-index_macro.patch | 0 .../4.2.0/305-libmudflap-susv3-legacy.patch | 49 ++++++ .../4.2.0/306-libstdc++-namespace.patch | 36 +++++ .../4.2.0/402-libbackend_dep_gcov-iov.h.patch | 13 ++ .../{4.2 => 4.2.0}/800-arm-bigendian.patch | 0 .../4.2.0/904-flatten-switch-stmt-00.patch | 153 ++++++++++++++++++ 19 files changed, 254 insertions(+), 30 deletions(-) rename toolchain/gcc/patches/{4.2 => 4.2.0}/100-uclibc-conf.patch (88%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/103-uclibc-conf-noupstream.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/200-uclibc-locale.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/203-uclibc-locale-no__x.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/204-uclibc-locale-wchar_fix.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/205-uclibc-locale-update.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/300-libstdc++-pic.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/301-missing-execinfo_h.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/302-c99-snprintf.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/303-c99-complex-ugly-hack.patch (100%) rename toolchain/gcc/patches/{4.2 => 4.2.0}/304-index_macro.patch (100%) create mode 100644 toolchain/gcc/patches/4.2.0/305-libmudflap-susv3-legacy.patch create mode 100644 toolchain/gcc/patches/4.2.0/306-libstdc++-namespace.patch create mode 100644 toolchain/gcc/patches/4.2.0/402-libbackend_dep_gcov-iov.h.patch rename toolchain/gcc/patches/{4.2 => 4.2.0}/800-arm-bigendian.patch (100%) create mode 100644 toolchain/gcc/patches/4.2.0/904-flatten-switch-stmt-00.patch diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index ffbf9dec5b..fccb7acdc2 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -14,9 +14,9 @@ choice depends !LINUX_2_4 bool "gcc 4.1.2" - config GCC_VERSION_4_2 + config GCC_VERSION_4_2_0 depends !LINUX_2_4 - bool "gcc 4.2 (20060709)" + bool "gcc 4.2.0" endchoice diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index 1b817237b5..440b482652 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -8,7 +8,7 @@ config GCC_VERSION default "4.1.0" if GCC_VERSION_4_1_0 default "4.1.1" if GCC_VERSION_4_1_1 default "4.1.2" if GCC_VERSION_4_1_2 - default "4.2" if GCC_VERSION_4_2 + default "4.2.0" if GCC_VERSION_4_2_0 default "3.4.6-nonmips" if GCC_VERSION_3_4_6_nonmips default "4.1.2" diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index d0b6658143..b5502bcefa 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -23,16 +23,10 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gcc PKG_VERSION:=$(strip $(subst ",, $(CONFIG_GCC_VERSION)))#")) -ifeq ($(PKG_VERSION),4.2) -PKG_VERSION:=20060709 -PKG_SOURCE_URL:=http://downloads.openwrt.org/sources -PATCH_DIR=./patches/4.2 -else PATCH_DIR=./patches/$(PKG_VERSION) PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \ http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \ ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION) -endif PKG_SOURCE:=gcc-$(PKG_VERSION).tar.bz2 PKG_MD5SUM:=unknown @@ -122,7 +116,6 @@ endef define Build/Prepare $(call Build/Prepare/Default) - $(SCRIPT_DIR)/patch-kernel.sh $(PKG_BUILD_DIR) $(PATCH_DIR) \*.patch $(SED) 's,\(version_string.. = "[0-9\.]*\).*\(";\),\1 (OpenWrt-2.0)\2,' $(PKG_BUILD_DIR)/gcc/version.c $(SED) 's,\(bug_report_url.. = "\).*\(";\),\1\2,' $(PKG_BUILD_DIR)/gcc/version.c (cd $(PKG_BUILD_DIR)/libstdc++-v3; autoconf;); diff --git a/toolchain/gcc/patches/4.2/100-uclibc-conf.patch b/toolchain/gcc/patches/4.2.0/100-uclibc-conf.patch similarity index 88% rename from toolchain/gcc/patches/4.2/100-uclibc-conf.patch rename to toolchain/gcc/patches/4.2.0/100-uclibc-conf.patch index a874fca506..4243ff7b91 100644 --- a/toolchain/gcc/patches/4.2/100-uclibc-conf.patch +++ b/toolchain/gcc/patches/4.2.0/100-uclibc-conf.patch @@ -35,26 +35,6 @@ lt_cv_deplibs_check_method=pass_all ;; -@@ -99523,7 +99523,7 @@ - - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - cat >>confdefs.h <<\_ACEOF ---- gcc/libstdc++-v3/crossconfig.m4 -+++ gcc/libstdc++-v3/crossconfig.m4 -@@ -161,7 +161,7 @@ - AC_DEFINE(HAVE_INT64_T) - case "$target" in - *-uclinux*) -- # Don't enable LFS with uClibc -+ # Don't enable LFS with uClinux - ;; - *) - AC_DEFINE(_GLIBCXX_USE_LFS) --- gcc/zlib/configure +++ gcc/zlib/configure @@ -3422,7 +3422,7 @@ diff --git a/toolchain/gcc/patches/4.2/103-uclibc-conf-noupstream.patch b/toolchain/gcc/patches/4.2.0/103-uclibc-conf-noupstream.patch similarity index 100% rename from toolchain/gcc/patches/4.2/103-uclibc-conf-noupstream.patch rename to toolchain/gcc/patches/4.2.0/103-uclibc-conf-noupstream.patch diff --git a/toolchain/gcc/patches/4.2/200-uclibc-locale.patch b/toolchain/gcc/patches/4.2.0/200-uclibc-locale.patch similarity index 100% rename from toolchain/gcc/patches/4.2/200-uclibc-locale.patch rename to toolchain/gcc/patches/4.2.0/200-uclibc-locale.patch diff --git a/toolchain/gcc/patches/4.2/203-uclibc-locale-no__x.patch b/toolchain/gcc/patches/4.2.0/203-uclibc-locale-no__x.patch similarity index 100% rename from toolchain/gcc/patches/4.2/203-uclibc-locale-no__x.patch rename to toolchain/gcc/patches/4.2.0/203-uclibc-locale-no__x.patch diff --git a/toolchain/gcc/patches/4.2/204-uclibc-locale-wchar_fix.patch b/toolchain/gcc/patches/4.2.0/204-uclibc-locale-wchar_fix.patch similarity index 100% rename from toolchain/gcc/patches/4.2/204-uclibc-locale-wchar_fix.patch rename to toolchain/gcc/patches/4.2.0/204-uclibc-locale-wchar_fix.patch diff --git a/toolchain/gcc/patches/4.2/205-uclibc-locale-update.patch b/toolchain/gcc/patches/4.2.0/205-uclibc-locale-update.patch similarity index 100% rename from toolchain/gcc/patches/4.2/205-uclibc-locale-update.patch rename to toolchain/gcc/patches/4.2.0/205-uclibc-locale-update.patch diff --git a/toolchain/gcc/patches/4.2/300-libstdc++-pic.patch b/toolchain/gcc/patches/4.2.0/300-libstdc++-pic.patch similarity index 100% rename from toolchain/gcc/patches/4.2/300-libstdc++-pic.patch rename to toolchain/gcc/patches/4.2.0/300-libstdc++-pic.patch diff --git a/toolchain/gcc/patches/4.2/301-missing-execinfo_h.patch b/toolchain/gcc/patches/4.2.0/301-missing-execinfo_h.patch similarity index 100% rename from toolchain/gcc/patches/4.2/301-missing-execinfo_h.patch rename to toolchain/gcc/patches/4.2.0/301-missing-execinfo_h.patch diff --git a/toolchain/gcc/patches/4.2/302-c99-snprintf.patch b/toolchain/gcc/patches/4.2.0/302-c99-snprintf.patch similarity index 100% rename from toolchain/gcc/patches/4.2/302-c99-snprintf.patch rename to toolchain/gcc/patches/4.2.0/302-c99-snprintf.patch diff --git a/toolchain/gcc/patches/4.2/303-c99-complex-ugly-hack.patch b/toolchain/gcc/patches/4.2.0/303-c99-complex-ugly-hack.patch similarity index 100% rename from toolchain/gcc/patches/4.2/303-c99-complex-ugly-hack.patch rename to toolchain/gcc/patches/4.2.0/303-c99-complex-ugly-hack.patch diff --git a/toolchain/gcc/patches/4.2/304-index_macro.patch b/toolchain/gcc/patches/4.2.0/304-index_macro.patch similarity index 100% rename from toolchain/gcc/patches/4.2/304-index_macro.patch rename to toolchain/gcc/patches/4.2.0/304-index_macro.patch diff --git a/toolchain/gcc/patches/4.2.0/305-libmudflap-susv3-legacy.patch b/toolchain/gcc/patches/4.2.0/305-libmudflap-susv3-legacy.patch new file mode 100644 index 0000000000..374b1f8659 --- /dev/null +++ b/toolchain/gcc/patches/4.2.0/305-libmudflap-susv3-legacy.patch @@ -0,0 +1,49 @@ +Index: gcc-4.2/libmudflap/mf-hooks2.c +=================================================================== +--- gcc-4.2/libmudflap/mf-hooks2.c (revision 119834) ++++ gcc-4.2/libmudflap/mf-hooks2.c (working copy) +@@ -427,7 +427,7 @@ + { + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region"); +- bzero (s, n); ++ memset (s, 0, n); + } + + +@@ -437,7 +437,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src"); + MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest"); +- bcopy (src, dest, n); ++ memmove (dest, src, n); + } + + +@@ -447,7 +447,7 @@ + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg"); + MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg"); +- return bcmp (s1, s2, n); ++ return n == 0 ? 0 : memcmp (s1, s2, n); + } + + +@@ -456,7 +456,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region"); +- return index (s, c); ++ return strchr (s, c); + } + + +@@ -465,7 +465,7 @@ + size_t n = strlen (s); + TRACE ("%s\n", __PRETTY_FUNCTION__); + MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region"); +- return rindex (s, c); ++ return strrchr (s, c); + } + + /* XXX: stpcpy, memccpy */ diff --git a/toolchain/gcc/patches/4.2.0/306-libstdc++-namespace.patch b/toolchain/gcc/patches/4.2.0/306-libstdc++-namespace.patch new file mode 100644 index 0000000000..69587ca63a --- /dev/null +++ b/toolchain/gcc/patches/4.2.0/306-libstdc++-namespace.patch @@ -0,0 +1,36 @@ +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 13:06:56.000000000 +0100 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/messages_members.h 2006-12-22 15:23:41.000000000 +0100 +@@ -32,7 +32,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + #ifdef __UCLIBC_MJN3_ONLY__ + #warning fix prototypes for *textdomain funcs + #endif +@@ -115,3 +116,4 @@ + this->_S_create_c_locale(this->_M_c_locale_messages, __s); + } + } ++} +diff -rup gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h +--- gcc-4.2.orig/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 13:06:56.000000000 +0100 ++++ gcc-4.2/libstdc++-v3/config/locale/uclibc/time_members.h 2006-12-22 15:20:31.000000000 +0100 +@@ -33,7 +33,8 @@ + // + + // Written by Benjamin Kosnik +- ++namespace std ++{ + template + __timepunct<_CharT>::__timepunct(size_t __refs) + : facet(__refs), _M_data(NULL), _M_c_locale_timepunct(NULL), +@@ -74,3 +75,4 @@ + delete _M_data; + _S_destroy_c_locale(_M_c_locale_timepunct); + } ++} diff --git a/toolchain/gcc/patches/4.2.0/402-libbackend_dep_gcov-iov.h.patch b/toolchain/gcc/patches/4.2.0/402-libbackend_dep_gcov-iov.h.patch new file mode 100644 index 0000000000..0bf115c45d --- /dev/null +++ b/toolchain/gcc/patches/4.2.0/402-libbackend_dep_gcov-iov.h.patch @@ -0,0 +1,13 @@ +Index: gcc-4.2/gcc/Makefile.in +=================================================================== +--- gcc-4.2/gcc/Makefile.in (revision 121758) ++++ gcc-4.2/gcc/Makefile.in (working copy) +@@ -2658,7 +2658,7 @@ mips-tdump.o : mips-tdump.c $(CONFIG_H) + # FIXME: writing proper dependencies for this is a *LOT* of work. + libbackend.o : $(OBJS-common:.o=.c) $(out_file) \ + insn-config.h insn-flags.h insn-codes.h insn-constants.h \ +- insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) ++ insn-attr.h $(DATESTAMP) $(BASEVER) $(DEVPHASE) gcov-iov.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \ + -DTARGET_NAME=\"$(target_noncanonical)\" \ + -DLOCALEDIR=\"$(localedir)\" \ diff --git a/toolchain/gcc/patches/4.2/800-arm-bigendian.patch b/toolchain/gcc/patches/4.2.0/800-arm-bigendian.patch similarity index 100% rename from toolchain/gcc/patches/4.2/800-arm-bigendian.patch rename to toolchain/gcc/patches/4.2.0/800-arm-bigendian.patch diff --git a/toolchain/gcc/patches/4.2.0/904-flatten-switch-stmt-00.patch b/toolchain/gcc/patches/4.2.0/904-flatten-switch-stmt-00.patch new file mode 100644 index 0000000000..8fac37c4df --- /dev/null +++ b/toolchain/gcc/patches/4.2.0/904-flatten-switch-stmt-00.patch @@ -0,0 +1,153 @@ +Hi, + +The attached patch makes sure that we create smaller object code for +simple switch statements. We just make sure to flatten the switch +statement into an if-else chain, basically. + +This fixes a size-regression as compared to gcc-3.4, as can be seen +below. + +2007-04-15 Bernhard Fischer <..> + + * stmt.c (expand_case): Do not create a complex binary tree when + optimizing for size but rather use the simple ordered list. + (emit_case_nodes): do not emit jumps to the default_label when + optimizing for size. + +Not regtested so far. +Comments? + +Attached is the test switch.c mentioned below. + +$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do +gcc-$i -DCHAIN -Os -o switch-CHAIN-$i.o -c switch.c ;done +$ for i in 2.95 3.3 3.4 4.0 4.1 4.2.orig-HEAD 4.3.orig-HEAD 4.3-HEAD;do +gcc-$i -UCHAIN -Os -o switch-$i.o -c switch.c ;done + +$ size switch-*.o + text data bss dec hex filename + 169 0 0 169 a9 switch-2.95.o + 115 0 0 115 73 switch-3.3.o + 103 0 0 103 67 switch-3.4.o + 124 0 0 124 7c switch-4.0.o + 124 0 0 124 7c switch-4.1.o + 124 0 0 124 7c switch-4.2.orig-HEAD.o + 95 0 0 95 5f switch-4.3-HEAD.o + 124 0 0 124 7c switch-4.3.orig-HEAD.o + 166 0 0 166 a6 switch-CHAIN-2.95.o + 111 0 0 111 6f switch-CHAIN-3.3.o + 95 0 0 95 5f switch-CHAIN-3.4.o + 95 0 0 95 5f switch-CHAIN-4.0.o + 95 0 0 95 5f switch-CHAIN-4.1.o + 95 0 0 95 5f switch-CHAIN-4.2.orig-HEAD.o + 95 0 0 95 5f switch-CHAIN-4.3-HEAD.o + 95 0 0 95 5f switch-CHAIN-4.3.orig-HEAD.o + + +Content-Type: text/x-diff; charset=us-ascii +Content-Disposition: attachment; filename="gcc-4.3.gcc-flatten-switch-stmt.00.diff" + +Index: gcc-4.2.0/gcc/stmt.c +=================================================================== +--- gcc-4.2.0.orig/gcc/stmt.c (revision 123843) ++++ gcc-4.2.0/gcc/stmt.c (working copy) +@@ -2517,7 +2517,11 @@ expand_case (tree exp) + use_cost_table + = (TREE_CODE (orig_type) != ENUMERAL_TYPE + && estimate_case_costs (case_list)); +- balance_case_nodes (&case_list, NULL); ++ /* When optimizing for size, we want a straight list to avoid ++ jumps as much as possible. This basically creates an if-else ++ chain. */ ++ if (!optimize_size) ++ balance_case_nodes (&case_list, NULL); + emit_case_nodes (index, case_list, default_label, index_type); + emit_jump (default_label); + } +@@ -3075,6 +3079,7 @@ emit_case_nodes (rtx index, case_node_pt + { + if (!node_has_low_bound (node, index_type)) + { ++ if (!optimize_size) /* don't jl to the .default_label. */ + emit_cmp_and_jump_insns (index, + convert_modes + (mode, imode, + + +Content-Type: text/x-csrc; charset=us-ascii +Content-Disposition: attachment; filename="switch.c" + +int +commutative_tree_code (int code) +{ +#define CASE(val, ret) case val:/* __asm__("# val="#val ",ret="#ret);*/ return ret; +#ifndef CHAIN + switch (code) + { +# if 1 + CASE(1,3) + CASE(3,2) + CASE(5,8) + CASE(7,1) + CASE(33,4) + CASE(44,9) + CASE(55,10) + CASE(66,-1) + CASE(77,99) + CASE(666,0) +# else + case 1: + return 3; + case 3: + return 2; + case 5: + return 8; + case 7: + return 1; + case 33: + return 4; + case 44: + return 9; + case 55: + return 10; + case 66: + return -1; + case 77: + return 99; + case 666: + return 0; +# endif + default: + break; + } + return 4711; + +#else + if (code == 1) + return 3; + else if (code == 3) + return 2; + else if (code == 5) + return 8; + else if (code == 7) + return 1; + else if (code == 33) + return 4; + else if (code == 44) + return 9; + else if (code == 55) + return 10; + else if (code == 66) + return -1; + else if (code == 77) + return 99; + else if (code == 666) + return 0; + else + return 4711; +#endif +} + + +--AhhlLboLdkugWU4S-- + -- 2.30.2