diff options
Diffstat (limited to 'toolchain/gcc')
-rw-r--r-- | toolchain/gcc/Makefile | 15 | ||||
-rw-r--r-- | toolchain/gcc/Makefile.inc | 8 | ||||
-rw-r--r-- | toolchain/gcc/patches/4.8.2/abi32.patch | 54 | ||||
-rw-r--r-- | toolchain/gcc/patches/4.8.2/miscompile.sparc | 154 |
4 files changed, 220 insertions, 11 deletions
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile index 6f70bfd12..eee524ba3 100644 --- a/toolchain/gcc/Makefile +++ b/toolchain/gcc/Makefile @@ -28,7 +28,7 @@ GCC_CONFOPTS:= --prefix=$(TOOLCHAIN_DIR)/usr \ --disable-libstdcxx-pch \ --disable-ppl-version-check \ --disable-cloog-version-check \ - --without-system-zlib \ + --with-system-zlib \ --without-ppl \ --without-cloog \ --without-isl \ @@ -45,10 +45,10 @@ endif ifeq ($(ADK_LINUX_X86_64),y) ifeq ($(ADK_x32),y) -GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=mx32 +GCC_FINAL_CONFOPTS+= --with-abi=x32 endif ifeq ($(ADK_32),y) -GCC_FINAL_CONFOPTS+= --enable-multilib --with-multilib-list=m32 +GCC_FINAL_CONFOPTS+= --with-abi=32 endif ifeq ($(ADK_64),y) GCC_FINAL_CONFOPTS+= --disable-biarch --disable-multilib @@ -202,11 +202,18 @@ $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled # remove duplicate tools, convert hardlinks to symlinks set -e; \ cd $(TOOLCHAIN_DIR)/usr/$(GNU_TARGET_NAME)/bin; \ - for app in ar as c++ g++ gcc ld ld.bfd nm objcopy objdump ranlib strip; do \ + for app in ar as c++ g++ gcc ld ld.gold ld.bfd nm objcopy objdump ranlib strip; do \ ln -sf ../../bin/$(GNU_TARGET_NAME)-$${app} $${app}; \ done; (cd $(TOOLCHAIN_DIR)/usr/bin && \ ln -sf $(GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-gcc-${PKG_VERSION}) +ifeq ($(ADK_TOOLCHAIN_USE_GOLD),y) + (cd $(TOOLCHAIN_DIR)/usr/bin && \ + ln -sf $(GNU_TARGET_NAME)-ld.gold $(GNU_TARGET_NAME)-ld) +else + (cd $(TOOLCHAIN_DIR)/usr/bin && \ + ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld) +endif cd $(STAGING_TARGET_DIR)/lib && \ ln -sf libstdc++.so.6.0.18 libstdc++.so && \ ln -sf libstdc++.so.6.0.18 libstdc++.so.6 diff --git a/toolchain/gcc/Makefile.inc b/toolchain/gcc/Makefile.inc index 25e51178a..b441bf03d 100644 --- a/toolchain/gcc/Makefile.inc +++ b/toolchain/gcc/Makefile.inc @@ -2,13 +2,7 @@ # material, please see the LICENCE file in the top-level directory. PKG_NAME:= gcc -ifeq ($(ADK_LINUX_SPARC),y) -PKG_VERSION:= 4.7.3 -PKG_MD5SUM:= 86f428a30379bdee0224e353ee2f999e -else PKG_VERSION:= 4.8.2 -PKG_MD5SUM:= a3d7d63b9cb6b6ea049469a0c4a43c9d -endif +PKG_MD5SUM:= deca88241c1135e2ff9fa5486ab5957b PKG_RELEASE:= 1 PKG_SITES:= ${MASTER_SITE_GNU:=gcc/gcc-${PKG_VERSION}/} -DISTFILES:= $(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/toolchain/gcc/patches/4.8.2/abi32.patch b/toolchain/gcc/patches/4.8.2/abi32.patch new file mode 100644 index 000000000..856d608bd --- /dev/null +++ b/toolchain/gcc/patches/4.8.2/abi32.patch @@ -0,0 +1,54 @@ +diff -Nur gcc-4.8.2.orig/gcc/config/i386/biarch32.h gcc-4.8.2/gcc/config/i386/biarch32.h +--- gcc-4.8.2.orig/gcc/config/i386/biarch32.h 1970-01-01 01:00:00.000000000 +0100 ++++ gcc-4.8.2/gcc/config/i386/biarch32.h 2014-03-23 20:33:52.000000000 +0100 +@@ -0,0 +1,27 @@ ++/* Make configure files to produce biarch compiler defaulting to 32bit mode. ++ This file must be included very first, while the OS specific file later ++ to overwrite otherwise wrong defaults. ++ Copyright (C) 2001-2014 Free Software Foundation, Inc. ++ ++This file is part of GCC. ++ ++GCC is free software; you can redistribute it and/or modify ++it under the terms of the GNU General Public License as published by ++the Free Software Foundation; either version 3, or (at your option) ++any later version. ++ ++GCC is distributed in the hope that it will be useful, ++but WITHOUT ANY WARRANTY; without even the implied warranty of ++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++GNU General Public License for more details. ++ ++Under Section 7 of GPL version 3, you are granted additional ++permissions described in the GCC Runtime Library Exception, version ++3.1, as published by the Free Software Foundation. ++ ++You should have received a copy of the GNU General Public License and ++a copy of the GCC Runtime Library Exception along with this program; ++see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ++<http://www.gnu.org/licenses/>. */ ++ ++#define TARGET_64BIT_DEFAULT 0 +diff -Nur gcc-4.8.2.orig/gcc/config.gcc gcc-4.8.2/gcc/config.gcc +--- gcc-4.8.2.orig/gcc/config.gcc 2013-10-03 02:47:24.000000000 +0200 ++++ gcc-4.8.2/gcc/config.gcc 2014-03-22 13:15:18.000000000 +0100 +@@ -522,6 +522,9 @@ + 64 | m64) + tm_file="i386/biarch64.h ${tm_file}" + ;; ++ 32 | m32) ++ tm_file="i386/biarch32.h ${tm_file}" ++ ;; + x32 | mx32) + tm_file="i386/biarchx32.h ${tm_file}" + ;; +@@ -1343,6 +1346,9 @@ + x32 | mx32) + x86_multilibs="mx32" + ;; ++ 32 | m32) ++ x86_multilibs="m32" ++ ;; + *) + x86_multilibs="m64,m32" + ;; diff --git a/toolchain/gcc/patches/4.8.2/miscompile.sparc b/toolchain/gcc/patches/4.8.2/miscompile.sparc new file mode 100644 index 000000000..4aef2e605 --- /dev/null +++ b/toolchain/gcc/patches/4.8.2/miscompile.sparc @@ -0,0 +1,154 @@ +diff -Nur gcc-4.8.2.orig/gcc/tree-ssa-forwprop.c gcc-4.8.2/gcc/tree-ssa-forwprop.c +--- gcc-4.8.2.orig/gcc/tree-ssa-forwprop.c 2013-02-25 16:31:31.000000000 +0100 ++++ gcc-4.8.2/gcc/tree-ssa-forwprop.c 2014-03-22 19:37:04.797991879 +0100 +@@ -688,6 +688,130 @@ + recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt)); + } + ++ /* DEF_RHS contains the address of the 0th element in an array. ++ USE_STMT uses type of DEF_RHS to compute the address of an ++ arbitrary element within the array. The (variable) byte offset ++ of the element is contained in OFFSET. ++ ++ We walk back through the use-def chains of OFFSET to verify that ++ it is indeed computing the offset of an element within the array ++ and extract the index corresponding to the given byte offset. ++ ++ We then try to fold the entire address expression into a form ++ &array[index]. ++ ++ If we are successful, we replace the right hand side of USE_STMT ++ with the new address computation. */ ++ ++ static bool ++ forward_propagate_addr_into_variable_array_index (tree offset, ++ tree def_rhs, ++ gimple_stmt_iterator *use_stmt_gsi) ++ { ++ tree index, tunit; ++ gimple offset_def, use_stmt = gsi_stmt (*use_stmt_gsi); ++ tree new_rhs, tmp; ++ ++ if (TREE_CODE (TREE_OPERAND (def_rhs, 0)) == ARRAY_REF) ++ tunit = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (def_rhs))); ++ else if (TREE_CODE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))) == ARRAY_TYPE) ++ tunit = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (TREE_TYPE (def_rhs)))); ++ else ++ return false; ++ if (!host_integerp (tunit, 1)) ++ return false; ++ ++ /* Get the offset's defining statement. */ ++ offset_def = SSA_NAME_DEF_STMT (offset); ++ ++ /* Try to find an expression for a proper index. This is either a ++ multiplication expression by the element size or just the ssa name we came ++ along in case the element size is one. In that case, however, we do not ++ allow multiplications because they can be computing index to a higher ++ level dimension (PR 37861). */ ++ if (integer_onep (tunit)) ++ { ++ if (is_gimple_assign (offset_def) ++ && gimple_assign_rhs_code (offset_def) == MULT_EXPR) ++ return false; ++ ++ index = offset; ++ } ++ else ++ { ++ /* The statement which defines OFFSET before type conversion ++ must be a simple GIMPLE_ASSIGN. */ ++ if (!is_gimple_assign (offset_def)) ++ return false; ++ ++ /* The RHS of the statement which defines OFFSET must be a ++ multiplication of an object by the size of the array elements. ++ This implicitly verifies that the size of the array elements ++ is constant. */ ++ if (gimple_assign_rhs_code (offset_def) == MULT_EXPR ++ && TREE_CODE (gimple_assign_rhs2 (offset_def)) == INTEGER_CST ++ && tree_int_cst_equal (gimple_assign_rhs2 (offset_def), tunit)) ++ { ++ /* The first operand to the MULT_EXPR is the desired index. */ ++ index = gimple_assign_rhs1 (offset_def); ++ } ++ /* If we have idx * tunit + CST * tunit re-associate that. */ ++ else if ((gimple_assign_rhs_code (offset_def) == PLUS_EXPR ++ || gimple_assign_rhs_code (offset_def) == MINUS_EXPR) ++ && TREE_CODE (gimple_assign_rhs1 (offset_def)) == SSA_NAME ++ && TREE_CODE (gimple_assign_rhs2 (offset_def)) == INTEGER_CST ++ && (tmp = div_if_zero_remainder (EXACT_DIV_EXPR, ++ gimple_assign_rhs2 (offset_def), ++ tunit)) != NULL_TREE) ++ { ++ gimple offset_def2 = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (offset_def)); ++ if (is_gimple_assign (offset_def2) ++ && gimple_assign_rhs_code (offset_def2) == MULT_EXPR ++ && TREE_CODE (gimple_assign_rhs2 (offset_def2)) == INTEGER_CST ++ && tree_int_cst_equal (gimple_assign_rhs2 (offset_def2), tunit)) ++ { ++ index = fold_build2 (gimple_assign_rhs_code (offset_def), ++ TREE_TYPE (offset), ++ gimple_assign_rhs1 (offset_def2), tmp); ++ } ++ else ++ return false; ++ } ++ else ++ return false; ++ } ++ ++ /* Replace the pointer addition with array indexing. */ ++ index = force_gimple_operand_gsi (use_stmt_gsi, index, true, NULL_TREE, ++ true, GSI_SAME_STMT); ++ if (TREE_CODE (TREE_OPERAND (def_rhs, 0)) == ARRAY_REF) ++ { ++ new_rhs = unshare_expr (def_rhs); ++ TREE_OPERAND (TREE_OPERAND (new_rhs, 0), 1) = index; ++ } ++ else ++ { ++ new_rhs = build4 (ARRAY_REF, TREE_TYPE (TREE_TYPE (TREE_TYPE (def_rhs))), ++ unshare_expr (TREE_OPERAND (def_rhs, 0)), ++ index, integer_zero_node, NULL_TREE); ++ new_rhs = build_fold_addr_expr (new_rhs); ++ if (!useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (use_stmt)), ++ TREE_TYPE (new_rhs))) ++ { ++ new_rhs = force_gimple_operand_gsi (use_stmt_gsi, new_rhs, true, ++ NULL_TREE, true, GSI_SAME_STMT); ++ new_rhs = fold_convert (TREE_TYPE (gimple_assign_lhs (use_stmt)), ++ new_rhs); ++ } ++ } ++ gimple_assign_set_rhs_from_tree (use_stmt_gsi, new_rhs); ++ fold_stmt (use_stmt_gsi); ++ tidy_after_forward_propagate_addr (gsi_stmt (*use_stmt_gsi)); ++ return true; ++ } ++ ++ ++ + /* NAME is a SSA_NAME representing DEF_RHS which is of the form + ADDR_EXPR <whatever>. + +@@ -977,6 +1101,19 @@ + tidy_after_forward_propagate_addr (use_stmt); + return true; + } ++ /* Try to optimize &x[0] p+ OFFSET where OFFSET is defined by ++ converting a multiplication of an index by the size of the ++ array elements, then the result is converted into the proper ++ type for the arithmetic. */ ++ if (TREE_CODE (rhs2) == SSA_NAME ++ && (TREE_CODE (array_ref) != ARRAY_REF ++ || integer_zerop (TREE_OPERAND (array_ref, 1))) ++ && useless_type_conversion_p (TREE_TYPE (name), TREE_TYPE (def_rhs)) ++ /* Avoid problems with IVopts creating PLUS_EXPRs with a ++ different type than their operands. */ ++ && useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (def_rhs))) ++ return forward_propagate_addr_into_variable_array_index (rhs2, def_rhs, ++ use_stmt_gsi); + + return false; + } |