[cross-gcc] Update to gcc-4.7.0. Add patches to fix SH64 compilation. Build separate SH and SH64 compilers.
David Howells
dhowells at fedoraproject.org
Wed May 30 17:14:19 UTC 2012
commit ca46b252dceb314392cbef62c28310157d316c7d
Author: David Howells <dhowells at redhat.com>
Date: Wed May 30 18:12:04 2012 +0100
Update to gcc-4.7.0.
Add patches to fix SH64 compilation.
Build separate SH and SH64 compilers.
.gitignore | 2 +-
cross-gcc.spec | 41 ++++++++++++++++++------
gcc47-sh64-fix1.patch | 84 +++++++++++++++++++++++++++++++++++++++++++++++++
gcc47-sh64-fix2.patch | 43 +++++++++++++++++++++++++
gcc47-sh64-fix3.patch | 37 +++++++++++++++++++++
sources | 2 +-
6 files changed, 197 insertions(+), 12 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 62aa1a7..938d94e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-/gcc-4.7.0-RC-20120302.tar.bz2
+/gcc-4.7.0.tar.bz2
diff --git a/cross-gcc.spec b/cross-gcc.spec
index 5ba9bbe..8af62d8 100644
--- a/cross-gcc.spec
+++ b/cross-gcc.spec
@@ -16,7 +16,8 @@
%define build_mn10300 %{build_all}
%define build_powerpc64 %{build_all}
%define build_s390x %{build_all}
-%define build_sh4 %{build_all}
+%define build_sh %{build_all}
+%define build_sh64 %{build_all}
%define build_sparc64 %{build_all}
%define build_tile %{build_all}
%define build_x86_64 %{build_all}
@@ -27,7 +28,6 @@
# gcc doesn't build
%define build_microblaze 0
-%define build_sh64 0
# 32-bit packages we don't build as we can use the 64-bit package instead
%define build_hppa 0
@@ -35,7 +35,7 @@
%define build_mips 0
%define build_powerpc 0
%define build_s390 0
-%define build_sh 0
+%define build_sh4 0
%define build_sparc 0
# gcc doesn't support
@@ -45,13 +45,12 @@
%define build_unicore32 0
# % global DATE 20120206
-%global DATE RC-20120302
-%global SVNREV 183946
+# % global SVNREV 183946
%global gcc_version 4.7.0
# Note, gcc_release must be integer, if you want to add suffixes to
# %{release}, append them after %{gcc_release} on Release: line.
-%global gcc_release 0.11.4
+%global gcc_release 1
Summary: Cross C compiler
Name: cross-gcc
@@ -65,7 +64,7 @@ URL: http://gcc.gnu.org
# following commands to generate the tarball:
# svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_6-branch@%{SVNREV} gcc-%{version}-%{DATE}
# tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2
-Source0: gcc-%{version}-%{DATE}.tar.bz2
+Source0: gcc-%{version}.tar.bz2
Patch0: gcc47-hack.patch
Patch1: gcc47-c++-builtin-redecl.patch
@@ -81,6 +80,9 @@ Patch11: gcc47-pr38757.patch
Patch13: gcc47-no-add-needed.patch
Patch14: gcc47-ppl-0.10.patch
Patch15: gcc47-libitm-fno-exceptions.patch
+Patch81: gcc47-sh64-fix1.patch
+Patch82: gcc47-sh64-fix2.patch
+Patch83: gcc47-sh64-fix3.patch
Patch100: cross-intl-filename.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -170,7 +172,7 @@ the number of packages. \
###############################################################################
%prep
-%define srcdir gcc-%{version}-%{DATE}
+%define srcdir gcc-%{version}
%setup -q -n %{srcdir} -c
cd %{srcdir}
@@ -190,6 +192,9 @@ cd %{srcdir}
%patch14 -p0 -b .ppl-0.10~
%endif
%patch15 -p0 -b .libitm-fno-exceptions~
+%patch81 -p0 -b .sh64_1~
+%patch82 -p0 -b .sh64_2~
+%patch83 -p0 -b .sh64_3~
%patch100 -p0 -b .cross-intl~
sed -i -e 's/4\.7\.0/4.7.0/' gcc/BASE-VER
@@ -295,7 +300,7 @@ function config_target () {
openrisc-*) target=or32-linux;;
parisc-*) target=hppa-linux;;
score-*) target=score-elf;;
- sh64-*) target=sh64-elf;;
+ sh64-*) target=sh64-linux;;
sh-*) target=sh-linux ;;
tile-*) target=tilegx-linux;;
v850-*) target=v850e-linux;;
@@ -306,6 +311,7 @@ function config_target () {
echo $arch: target is $target
#export CFLAGS="$RPM_OPT_FLAGS"
+ CONFIG_FLAGS=
COPT=
case $arch in
powerpc-*|powerpc64-*)
@@ -314,6 +320,15 @@ function config_target () {
s390-*)
COPT="--with-arch=z9-109 --with-tune=z10 --enable-decimal-float"
;;
+ sh4-*)
+ COPT="--with-arch_32=sh"
+ ;;
+ sh-*)
+ CONFIG_FLAGS=--with-multilib-list=m1,m2,m2e,m4,m4-single,m4-single-only,m2a,m2a-single
+ ;;
+ sh64-*)
+ CONFIG_FLAGS=--with-multilib-list=m5-32media,m5-32media-nofpu,m5-compact,m5-compact-nofpu,m5-64media,m5-64media-nofpu
+ ;;
sparc-*)
COPT="--with-long-double-128 --disable-linux-futex"
;;
@@ -374,7 +389,8 @@ function config_target () {
--enable-nls \
--with-system-zlib \
--with-bugurl=http://bugzilla.redhat.com/bugzilla/ \
- --enable-obsolete
+ --enable-obsolete \
+ $CONFIG_FLAGS
%if 0
--libdir=%{_libdir} # we want stuff in /usr/lib/gcc/ not /usr/lib64/gcc
--with-sysroot=%{_prefix}/$target/sys-root
@@ -616,6 +632,11 @@ rm -rf %{buildroot}
%do_files xtensa-linux-gnu %{build_xtensa}
%changelog
+* Wed May 30 2012 David Howells <dhowells at redhat.com> - 4.7.0-1
+- Update to gcc-4.7.0.
+- Add patches to fix SH64 compilation.
+- Build separate SH and SH64 compilers.
+
* Thu Mar 22 2012 David Howells <dhowells at redhat.com> - 4.7.0-0.11.4
- Add missing BuildRequires
diff --git a/gcc47-sh64-fix1.patch b/gcc47-sh64-fix1.patch
new file mode 100644
index 0000000..8a86221
--- /dev/null
+++ b/gcc47-sh64-fix1.patch
@@ -0,0 +1,84 @@
+commit ed7397872c54f5a264a2c24e6310575d4fbfb3cb
+Author: kkojima <kkojima at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat Mar 3 23:16:08 2012 +0000
+
+ * config/sh/sh.c (shiftcosts): Return MAX_COST when the first
+ operand is CONST_INT. Take COSTS_N_INSNS into account.
+ (sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value
+ of shiftcosts.
+
+
+
+ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184865 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git gcc/ChangeLog gcc/ChangeLog
+index a9edea9..c29a3e7 100644
+--- gcc/ChangeLog
++++ gcc/ChangeLog
+@@ -1,3 +1,10 @@
++2012-03-03 Kaz Kojima <kkojima at gcc.gnu.org>
++
++ * config/sh/sh.c (shiftcosts): Return MAX_COST when the first
++ operand is CONST_INT. Take COSTS_N_INSNS into account.
++ (sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value
++ of shiftcosts.
++
+ 2012-03-22 Release Manager
+
+ * GCC 4.7.0 released.
+diff --git gcc/config/sh/sh.c gcc/config/sh/sh.c
+index 00258f4..1b7eaae 100644
+--- gcc/config/sh/sh.c
++++ gcc/config/sh/sh.c
+@@ -2828,22 +2828,26 @@ shiftcosts (rtx x)
+ {
+ int value;
+
++ /* There is no pattern for constant first operand. */
++ if (CONST_INT_P (XEXP (x, 0)))
++ return MAX_COST;
++
+ if (TARGET_SHMEDIA)
+- return 1;
++ return COSTS_N_INSNS (1);
+
+ if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
+ {
+ if (GET_MODE (x) == DImode
+ && CONST_INT_P (XEXP (x, 1))
+ && INTVAL (XEXP (x, 1)) == 1)
+- return 2;
++ return COSTS_N_INSNS (2);
+
+ /* Everything else is invalid, because there is no pattern for it. */
+ return MAX_COST;
+ }
+ /* If shift by a non constant, then this will be expensive. */
+ if (!CONST_INT_P (XEXP (x, 1)))
+- return SH_DYNAMIC_SHIFT_COST;
++ return COSTS_N_INSNS (SH_DYNAMIC_SHIFT_COST);
+
+ /* Otherwise, return the true cost in instructions. Cope with out of range
+ shift counts more or less arbitrarily. */
+@@ -2855,10 +2859,10 @@ shiftcosts (rtx x)
+ /* If SH3, then we put the constant in a reg and use shad. */
+ if (cost > 1 + SH_DYNAMIC_SHIFT_COST)
+ cost = 1 + SH_DYNAMIC_SHIFT_COST;
+- return cost;
++ return COSTS_N_INSNS (cost);
+ }
+ else
+- return shift_insns[value];
++ return COSTS_N_INSNS (shift_insns[value]);
+ }
+
+ /* Return the cost of an AND/XOR/IOR operation. */
+@@ -3091,7 +3095,7 @@ sh_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+- *total = COSTS_N_INSNS (shiftcosts (x));
++ *total = shiftcosts (x);
+ return true;
+
+ case DIV:
diff --git a/gcc47-sh64-fix2.patch b/gcc47-sh64-fix2.patch
new file mode 100644
index 0000000..4c549f3
--- /dev/null
+++ b/gcc47-sh64-fix2.patch
@@ -0,0 +1,43 @@
+commit 3d7c07413a9de7a1bd1f87258e015c8a300e387b
+Author: kkojima <kkojima at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat Mar 3 23:19:07 2012 +0000
+
+ * config/sh/sh.c (sh_dwarf_register_span): Don't apply
+ DBX_REGISTER_NUMBER.
+
+
+
+ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184866 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git gcc/ChangeLog gcc/ChangeLog
+index c29a3e7..b9fb44d 100644
+--- gcc/ChangeLog
++++ gcc/ChangeLog
+@@ -1,5 +1,10 @@
+ 2012-03-03 Kaz Kojima <kkojima at gcc.gnu.org>
+
++ * config/sh/sh.c (sh_dwarf_register_span): Don't apply
++ DBX_REGISTER_NUMBER.
++
++2012-03-03 Kaz Kojima <kkojima at gcc.gnu.org>
++
+ * config/sh/sh.c (shiftcosts): Return MAX_COST when the first
+ operand is CONST_INT. Take COSTS_N_INSNS into account.
+ (sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value
+diff --git gcc/config/sh/sh.c gcc/config/sh/sh.c
+index 1b7eaae..94c2b66 100644
+--- gcc/config/sh/sh.c
++++ gcc/config/sh/sh.c
+@@ -8162,10 +8162,8 @@ sh_dwarf_register_span (rtx reg)
+ return
+ gen_rtx_PARALLEL (VOIDmode,
+ gen_rtvec (2,
+- gen_rtx_REG (SFmode,
+- DBX_REGISTER_NUMBER (regno+1)),
+- gen_rtx_REG (SFmode,
+- DBX_REGISTER_NUMBER (regno))));
++ gen_rtx_REG (SFmode, regno + 1),
++ gen_rtx_REG (SFmode, regno)));
+ }
+
+ static enum machine_mode
diff --git a/gcc47-sh64-fix3.patch b/gcc47-sh64-fix3.patch
new file mode 100644
index 0000000..6ed7006
--- /dev/null
+++ b/gcc47-sh64-fix3.patch
@@ -0,0 +1,37 @@
+commit 0f4929a3d0d3db386dac2df96b920a0895552828
+Author: kkojima <kkojima at 138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Sat Mar 3 23:20:34 2012 +0000
+
+ * config/sh/sh.md (abssi2): Add TARGET_SH1 condition.
+
+
+
+ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184867 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git gcc/ChangeLog gcc/ChangeLog
+index b9fb44d..b3a394a 100644
+--- gcc/ChangeLog
++++ gcc/ChangeLog
+@@ -1,5 +1,9 @@
+ 2012-03-03 Kaz Kojima <kkojima at gcc.gnu.org>
+
++ * config/sh/sh.md (abssi2): Add TARGET_SH1 condition.
++
++2012-03-03 Kaz Kojima <kkojima at gcc.gnu.org>
++
+ * config/sh/sh.c (sh_dwarf_register_span): Don't apply
+ DBX_REGISTER_NUMBER.
+
+diff --git gcc/config/sh/sh.md gcc/config/sh/sh.md
+index 56a0f3c..6a25b9d 100644
+--- gcc/config/sh/sh.md
++++ gcc/config/sh/sh.md
+@@ -4462,7 +4462,7 @@ label:
+ [(set (match_operand:SI 0 "arith_reg_dest" "")
+ (abs:SI (match_operand:SI 1 "arith_reg_operand" "")))
+ (clobber (reg:SI T_REG))]
+- ""
++ "TARGET_SH1"
+ "")
+
+ (define_insn_and_split "*abssi2"
diff --git a/sources b/sources
index 3969550..88f8413 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-4e179c2f1a50664abf57764430edb48f gcc-4.7.0-RC-20120302.tar.bz2
+2a0f1d99fda235c29d40b561f81d9a77 gcc-4.7.0.tar.bz2
More information about the scm-commits
mailing list