diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | 0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch | 129 | ||||
-rw-r--r-- | 0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch | 124 | ||||
-rw-r--r-- | PKGBUILD | 22 | ||||
-rw-r--r-- | fix-pr79242.patch | 82 | ||||
-rw-r--r-- | revert-pr71289.patch | 20 |
6 files changed, 230 insertions, 163 deletions
@@ -1,8 +1,8 @@ # Generated by mksrcinfo v8 -# Mon Sep 25 14:52:58 UTC 2017 +# Sun Feb 4 01:41:25 UTC 2018 pkgbase = msp430-elf-gcc-stage1 pkgdesc = The GNU Compiler Collection bootstrap for the msp430-elf target. - pkgver = 7.2.0 + pkgver = 7.3.0 pkgrel = 1 url = http://gcc.gnu.org arch = i686 @@ -20,13 +20,13 @@ pkgbase = msp430-elf-gcc-stage1 options = docs options = !strip source = http://isl.gforge.inria.fr/isl-0.18.tar.bz2 - source = 0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch - source = revert-pr71289.patch - source = ftp://gcc.gnu.org/pub/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz + source = 0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch + source = fix-pr79242.patch + source = ftp://gcc.gnu.org/pub/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.xz sha256sums = 6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b - sha256sums = 28f39dd3ef931d87de1eccf7700406c5b76fa7a6ecf47cfb3f199b33cd1fdf02 - sha256sums = 836ecb799c88b1c4db7e6ef2df72437a8fe162d1a2d3fb395198fba702f7d9d6 - sha256sums = 1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a + sha256sums = 12939e5ba47deecae8c182ad097f7a118c7b70461803b7403b636a18117201f4 + sha256sums = 14dcf8903684634f02da4d9bf73f9d93e39db9c07e0e1d2d7d997b5489bc5ada + sha256sums = 832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c pkgname = msp430-elf-gcc-stage1 diff --git a/0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch b/0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch new file mode 100644 index 000000000000..d618f88f8822 --- /dev/null +++ b/0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch @@ -0,0 +1,129 @@ +From 5437c7ffa48f974c6960a1e308c4cdf0ea0a2648 Mon Sep 17 00:00:00 2001 +From: Jozef Lawrynowicz <jozef.l@somniumtech.com> +Date: Thu, 24 Aug 2017 11:40:04 +0000 +Subject: [PATCH] MSP430: Dont specifically set TYPE_SIZE for __intN types + +2017-08-XX Jozef Lawrynowicz <jozef.l@somniumtech.com> + + PR target/78849 + * gcc/tree.c (build_common_tree_nodes): Dont set TYPE_SIZE for __intN + types. + +gcc/testsuite +2017-08-XX Jozef Lawrynowicz <jozef.l@somniumtech.com> + + PR target/78849 + * gcc.target/msp430/msp430.exp: Remove -pedantic-errors from + DEFAULT_CFLAGS. + * gcc.target/msp430/pr78849.c: New test. +--- + gcc/testsuite/gcc.target/msp430/msp430.exp | 13 +++++--- + gcc/testsuite/gcc.target/msp430/pr78849.c | 50 ++++++++++++++++++++++++++++++ + gcc/tree.c | 2 -- + 3 files changed, 59 insertions(+), 6 deletions(-) + create mode 100644 gcc/testsuite/gcc.target/msp430/pr78849.c + +diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp +index e54d531..3be8711 100644 +--- a/gcc/testsuite/gcc.target/msp430/msp430.exp ++++ b/gcc/testsuite/gcc.target/msp430/msp430.exp +@@ -24,10 +24,15 @@ if { ![istarget msp430-*-*] } then { + # Load support procs. + load_lib gcc-dg.exp + +-# If a testcase doesn't have special options, use these. ++# The '-pedantic-errors' option in the global variable DEFAULT_CFLAGS that is ++# set by other drivers causes an error when the __int20 type is used, so remove ++# this option from DEFAULT_CFLAGS for the msp430 tests. + global DEFAULT_CFLAGS +-if ![info exists DEFAULT_CFLAGS] then { +- set DEFAULT_CFLAGS "" ++if [info exists DEFAULT_CFLAGS] then { ++ set MSP430_DEFAULT_CFLAGS \ ++ [ string map { "-pedantic-errors" "" } $DEFAULT_CFLAGS ] ++} else { ++ set MSP430_DEFAULT_CFLAGS "" + } + + # Initialize `dg'. +@@ -35,7 +40,7 @@ dg-init + + # Main loop. + dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ +- "" $DEFAULT_CFLAGS ++ "" $MSP430_DEFAULT_CFLAGS + + # All done. + dg-finish +diff --git a/gcc/testsuite/gcc.target/msp430/pr78849.c b/gcc/testsuite/gcc.target/msp430/pr78849.c +new file mode 100644 +index 0000000..f70f0bb +--- /dev/null ++++ b/gcc/testsuite/gcc.target/msp430/pr78849.c +@@ -0,0 +1,50 @@ ++/* { dg-do compile } */ ++/* { dg-final { scan-assembler ".size.*instance.*52" } } */ ++ ++struct t_inner ++{ ++ __int20 a; ++ char val1; ++ __int20 b[3]; ++ char val2; ++}; ++ ++struct t_full ++{ ++ __int20 array[2]; ++ char val1; ++ struct t_inner bb[2]; ++ char val2; ++}; ++ ++struct t_full instance = ++{ ++ { ++ 4231, ++ 3212, ++ }, ++ 5, ++ { ++ { ++ 87680, ++ 20, ++ { ++ 2534, ++ 3, ++ 41, ++ }, ++ 55, ++ }, ++ { ++ 567, ++ 4, ++ { ++ 43522, ++ 5433, ++ 454, ++ }, ++ 88, ++ }, ++ }, ++ 8, ++}; +diff --git a/gcc/tree.c b/gcc/tree.c +index 4f56892..1c085ba 100644 +--- a/gcc/tree.c ++++ b/gcc/tree.c +@@ -9526,8 +9526,6 @@ build_common_tree_nodes (bool signed_char) + { + int_n_trees[i].signed_type = make_signed_type (int_n_data[i].bitsize); + int_n_trees[i].unsigned_type = make_unsigned_type (int_n_data[i].bitsize); +- TYPE_SIZE (int_n_trees[i].signed_type) = bitsize_int (int_n_data[i].bitsize); +- TYPE_SIZE (int_n_trees[i].unsigned_type) = bitsize_int (int_n_data[i].bitsize); + + if (int_n_data[i].bitsize > LONG_LONG_TYPE_SIZE + && int_n_enabled_p[i]) +-- +1.8.3.1 + diff --git a/0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch b/0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch deleted file mode 100644 index 688d8d1ce39a..000000000000 --- a/0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 81ee936dcdde4f4a7d4036479dbbff77da1e72bb Mon Sep 17 00:00:00 2001 -From: Jozef Lawrynowicz <jozef.l@somniumtech.com> -Date: Wed, 12 Apr 2017 14:45:45 +0000 -Subject: [PATCH] Use GET_MODE_BITSIZE when setting TYPE_SIZE - -2017-05-XX Jozef Lawrynowicz <jozef.l@somniumtech.com> - - gcc/ - PR target/78849 - * stor-layout.c (initialize_sizetypes): Use GET_MODE_BITSIZE when setting TYPE_SIZE. - * tree.c (build_common_tree_nodes): Likewise. - - gcc/testsuite - PR target/78849 - * gcc.target/msp430/pr78849.c: New test. - * gcc.target/msp430/msp430.exp: Remove -pedantic-errors option from DEFAULT_CFLAGS. ---- - gcc/stor-layout.c | 5 +++-- - gcc/testsuite/gcc.target/msp430/msp430.exp | 13 +++++++++---- - gcc/testsuite/gcc.target/msp430/pr78849.c | 21 +++++++++++++++++++++ - gcc/tree.c | 6 ++++-- - 4 files changed, 37 insertions(+), 8 deletions(-) - create mode 100644 gcc/testsuite/gcc.target/msp430/pr78849.c - -diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c -index 10e9a32..1dbaba0 100644 ---- a/gcc/stor-layout.c -+++ b/gcc/stor-layout.c -@@ -2602,13 +2602,14 @@ initialize_sizetypes (void) - /* Now layout both types manually. */ - SET_TYPE_MODE (sizetype, smallest_mode_for_size (precision, MODE_INT)); - SET_TYPE_ALIGN (sizetype, GET_MODE_ALIGNMENT (TYPE_MODE (sizetype))); -- TYPE_SIZE (sizetype) = bitsize_int (precision); -+ TYPE_SIZE (sizetype) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (sizetype))); - TYPE_SIZE_UNIT (sizetype) = size_int (GET_MODE_SIZE (TYPE_MODE (sizetype))); - set_min_and_max_values_for_integral_type (sizetype, precision, UNSIGNED); - - SET_TYPE_MODE (bitsizetype, smallest_mode_for_size (bprecision, MODE_INT)); - SET_TYPE_ALIGN (bitsizetype, GET_MODE_ALIGNMENT (TYPE_MODE (bitsizetype))); -- TYPE_SIZE (bitsizetype) = bitsize_int (bprecision); -+ TYPE_SIZE (bitsizetype) -+ = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (bitsizetype))); - TYPE_SIZE_UNIT (bitsizetype) - = size_int (GET_MODE_SIZE (TYPE_MODE (bitsizetype))); - set_min_and_max_values_for_integral_type (bitsizetype, bprecision, UNSIGNED); -diff --git a/gcc/testsuite/gcc.target/msp430/msp430.exp b/gcc/testsuite/gcc.target/msp430/msp430.exp -index e54d531..ce5c3dc 100644 ---- a/gcc/testsuite/gcc.target/msp430/msp430.exp -+++ b/gcc/testsuite/gcc.target/msp430/msp430.exp -@@ -24,10 +24,15 @@ if { ![istarget msp430-*-*] } then { - # Load support procs. - load_lib gcc-dg.exp - --# If a testcase doesn't have special options, use these. -+# The '-pedantic-errors' option in the global variable DEFAULT_CFLAGS that is -+# set by other drivers causes an error when the __int20 type is used, so remove -+# this option from DEFAULT_CFLAGS for the msp430 tests. - global DEFAULT_CFLAGS --if ![info exists DEFAULT_CFLAGS] then { -- set DEFAULT_CFLAGS "" -+if [info exists DEFAULT_CFLAGS] then { -+ set MSP430_DEFAULT_CFLAGS \ -+ [ string map { "-pedantic-errors" "" } $DEFAULT_CFLAGS ] -+} else { -+ set MSP430_DEFAULT_CFLAGS "" - } - - # Initialize `dg'. -@@ -35,7 +40,7 @@ dg-init - - # Main loop. - dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \ -- "" $DEFAULT_CFLAGS -+ "" $MSP430_DEFAULT_CFLAGS - - # All done. - dg-finish -diff --git a/gcc/testsuite/gcc.target/msp430/pr78849.c b/gcc/testsuite/gcc.target/msp430/pr78849.c -new file mode 100644 -index 0000000..97792e9 ---- /dev/null -+++ b/gcc/testsuite/gcc.target/msp430/pr78849.c -@@ -0,0 +1,21 @@ -+/* { dg-do link } */ -+ -+struct s_1 -+{ -+ __int20 array[2]; -+ char elem; -+}; -+ -+struct s_1 instance = -+{ -+ { -+ 0, -+ 1, -+ }, -+ 2 -+}; -+ -+int main (void) -+{ -+ return 0; -+} -diff --git a/gcc/tree.c b/gcc/tree.c -index 72dbba4..12f2635 100644 ---- a/gcc/tree.c -+++ b/gcc/tree.c -@@ -10285,8 +10285,10 @@ build_common_tree_nodes (bool signed_char) - { - int_n_trees[i].signed_type = make_signed_type (int_n_data[i].bitsize); - int_n_trees[i].unsigned_type = make_unsigned_type (int_n_data[i].bitsize); -- TYPE_SIZE (int_n_trees[i].signed_type) = bitsize_int (int_n_data[i].bitsize); -- TYPE_SIZE (int_n_trees[i].unsigned_type) = bitsize_int (int_n_data[i].bitsize); -+ TYPE_SIZE (int_n_trees[i].signed_type) -+ = bitsize_int (GET_MODE_BITSIZE (int_n_data[i].m)); -+ TYPE_SIZE (int_n_trees[i].unsigned_type) -+ = bitsize_int (GET_MODE_BITSIZE (int_n_data[i].m)); - - if (int_n_data[i].bitsize > LONG_LONG_TYPE_SIZE - && int_n_enabled_p[i]) --- -1.8.3.1 - @@ -2,7 +2,7 @@ _target="msp430-elf" pkgname=${_target}-gcc-stage1 -pkgver=7.2.0 +pkgver=7.3.0 _islver=0.18 pkgrel=1 pkgdesc="The GNU Compiler Collection bootstrap for the ${_target} target." @@ -12,13 +12,13 @@ url="http://gcc.gnu.org" depends=("${_target}-binutils>=2.25" 'libmpc' 'elfutils') options=('staticlibs' '!buildflags' '!libtool' '!emptydirs' 'zipman' 'docs' '!strip') source=(http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2 - 0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch - revert-pr71289.patch + 0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch + fix-pr79242.patch ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-${pkgver}.tar.xz) sha256sums=('6b8b0fd7f81d0a957beb3679c81bbb34ccc7568d5682844d8924424a0dadcb1b' - '28f39dd3ef931d87de1eccf7700406c5b76fa7a6ecf47cfb3f199b33cd1fdf02' - '836ecb799c88b1c4db7e6ef2df72437a8fe162d1a2d3fb395198fba702f7d9d6' - '1cf7adf8ff4b5aa49041c8734bbcf1ad18cc4c94d0029aae0f4e48841088479a') + '12939e5ba47deecae8c182ad097f7a118c7b70461803b7403b636a18117201f4' + '14dcf8903684634f02da4d9bf73f9d93e39db9c07e0e1d2d7d997b5489bc5ada' + '832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c') prepare() { # add isl into tree @@ -30,12 +30,12 @@ prepare() { [[ -d gcc-build ]] && rm -rf gcc-build mkdir gcc-build - # Until pr79242 is resolved, revert pr71289. Yes, the underlying bug is still - # there, but I do not have the time to investigate it and fix it at the - # moment. Patches/comments are welcome. - patch -p1 < ../revert-pr71289.patch + # Preliminary fix for pr79242. Without this newlib fails to compile for + # MSP430X cores with an ICE. The patch has been around in the GCC mailing + # list for a while, not sure why it has not been added to trunk. + patch -p1 < ../fix-pr79242.patch # while we are at it, fix pr78849 - patch -p1 < ../0001-Use-GET_MODE_BITSIZE-when-setting-TYPE_SIZE.patch + patch -p1 < ../0001-MSP430-Dont-specifically-set-TYPE_SIZE-for-__intN-ty.patch } build() { diff --git a/fix-pr79242.patch b/fix-pr79242.patch new file mode 100644 index 000000000000..90fac2b6c17a --- /dev/null +++ b/fix-pr79242.patch @@ -0,0 +1,82 @@ +diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c +index 710a97b..c1f0d5b 100644 +--- a/gcc/config/msp430/msp430.c ++++ b/gcc/config/msp430/msp430.c +@@ -905,6 +905,8 @@ msp430_hard_regno_nregs (int regno ATTRIBUTE_UNUSED, + { + if (mode == PSImode && msp430x) + return 1; ++ if (mode == CPSImode && msp430x) ++ return 2; + return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) + / UNITS_PER_WORD); + } +@@ -927,6 +929,8 @@ msp430_hard_regno_nregs_with_padding (int regno ATTRIBUTE_UNUSED, + { + if (mode == PSImode) + return 2; ++ if (mode == CPSImode) ++ return 4; + return msp430_hard_regno_nregs (regno, mode); + } + +diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi +index b02e5a1..ebe2a63 100644 +--- a/gcc/doc/rtl.texi ++++ b/gcc/doc/rtl.texi +@@ -1291,10 +1291,11 @@ point values. The floating point values are in @code{QFmode}, + @findex CDImode + @findex CTImode + @findex COImode +-@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode ++@findex CPSImode ++@item CQImode, CHImode, CSImode, CDImode, CTImode, COImode, CPSImode + These modes stand for a complex number represented as a pair of integer + values. The integer values are in @code{QImode}, @code{HImode}, +-@code{SImode}, @code{DImode}, @code{TImode}, and @code{OImode}, ++@code{SImode}, @code{DImode}, @code{TImode}, @code{OImode}, and @code{PSImode}, + respectively. + + @findex BND32mode +diff --git a/gcc/genmodes.c b/gcc/genmodes.c +index e56c08b..2af6556 100644 +--- a/gcc/genmodes.c ++++ b/gcc/genmodes.c +@@ -116,6 +116,7 @@ complex_class (enum mode_class c) + switch (c) + { + case MODE_INT: return MODE_COMPLEX_INT; ++ case MODE_PARTIAL_INT: return MODE_COMPLEX_INT; + case MODE_FLOAT: return MODE_COMPLEX_FLOAT; + default: + error ("no complex class for class %s", mode_class_names[c]); +diff --git a/gcc/machmode.def b/gcc/machmode.def +index afe6851..6c84488 100644 +--- a/gcc/machmode.def ++++ b/gcc/machmode.def +@@ -243,6 +243,7 @@ UACCUM_MODE (UTA, 16, 64, 64); /* 64.64 */ + + /* Complex modes. */ + COMPLEX_MODES (INT); ++COMPLEX_MODES (PARTIAL_INT); + COMPLEX_MODES (FLOAT); + + /* Decimal floating point modes. */ +diff --git a/gcc/testsuite/gcc.target/msp430/pr79242.c b/gcc/testsuite/gcc.target/msp430/pr79242.c +new file mode 100644 +index 0000000..d7ff8d3 +--- /dev/null ++++ b/gcc/testsuite/gcc.target/msp430/pr79242.c +@@ -0,0 +1,11 @@ ++/* { dg-do compile } */ ++/* { dg-skip-if "" { "*-*-*" } { "-mcpu=msp430" "-msmall" } { "" } } */ ++/* { dg-options "-mcpu=msp430x" } */ ++ ++typedef _Complex __int20 C; ++ ++C ++foo (C x, C y) ++{ ++ return x + y; ++} + diff --git a/revert-pr71289.patch b/revert-pr71289.patch deleted file mode 100644 index 298386e65d1e..000000000000 --- a/revert-pr71289.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -rupN gcc-7.1.0-pristine/gcc/match.pd gcc-7.1.0-modified/gcc/match.pd ---- gcc-7.1.0-pristine/gcc/match.pd 2017-04-04 05:06:04.000000000 -0400 -+++ gcc-7.1.0-modified/gcc/match.pd 2017-07-26 10:46:14.079911462 -0400 -@@ -3071,16 +3071,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) - && types_match (TREE_TYPE (@0), TREE_TYPE (@1))) - (out (imagpart @2) { build_zero_cst (TREE_TYPE (@0)); })))) - --/* For unsigned operands, -1 / B < A checks whether A * B would overflow. -- Simplify it to __builtin_mul_overflow (A, B, <unused>). */ --(for cmp (lt ge) -- out (ne eq) -- (simplify -- (cmp:c (trunc_div:s integer_all_onesp @1) @0) -- (if (TYPE_UNSIGNED (TREE_TYPE (@0)) && !VECTOR_TYPE_P (TREE_TYPE (@0))) -- (with { tree t = TREE_TYPE (@0), cpx = build_complex_type (t); } -- (out (imagpart (IFN_MUL_OVERFLOW:cpx @0 @1)) { build_zero_cst (t); }))))) -- - /* Simplification of math builtins. These rules must all be optimizations - as well as IL simplifications. If there is a possibility that the new - form could be a pessimization, the rule should go in the canonicalization |