summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorABDULLATIF Mouhamadi2017-05-22 23:17:02 +0200
committerABDULLATIF Mouhamadi2017-05-22 23:17:02 +0200
commitba2850f48602d49f223ad6499566d81a4e6b0351 (patch)
tree5693e289509159c9e4da1f2eef905b67653a6aaa
downloadaur-gcc-msp430.tar.gz
first commit
-rw-r--r--.SRCINFO33
-rw-r--r--0001_gcc-doc-texinfo-5.0.patch101
-rw-r--r--PKGBUILD119
-rw-r--r--gperf-inlines.patch126
-rw-r--r--ira-int.h-segmentation-fault.patch18
-rw-r--r--msp430-gcc-4.6.3-20120406-sf3540953.patch80
-rw-r--r--msp430-gcc-4.6.3-20120406-sf3559978.patch68
-rw-r--r--patch-gcc46-texi.diff28
-rw-r--r--patch-gcc_cp_cfns.h22
9 files changed, 595 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..619500764c1d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,33 @@
+pkgbase = gcc-msp430
+ pkgdesc = GNU toolchain for the TI MSP430 processor
+ pkgver = 4.6.3
+ pkgrel = 1
+ url = http://sourceforge.net/projects/mspgcc/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ makedepends = binutils-msp430
+ depends = elfutils
+ depends = libmpc
+ options = !strip
+ options = !emptydirs
+ options = !libtool
+ source = http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-20120406.tar.bz2
+ source = http://ftpmirror.gnu.org/gcc/gcc-4.6.3/gcc-4.6.3.tar.bz2
+ source = msp430-gcc-4.6.3-20120406-sf3540953.patch::http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3540953.patch/download
+ source = msp430-gcc-4.6.3-20120406-sf3559978.patch::http://sourceforge.net/projects/mspgcc/files/Patches/LTS/20120406/msp430-gcc-4.6.3-20120406-sf3559978.patch/download
+ source = 0001_gcc-doc-texinfo-5.0.patch
+ source = patch-gcc_cp_cfns.h
+ source = patch-gcc46-texi.diff
+ source = ira-int.h-segmentation-fault.patch
+ sha1sums = cc96a7233f0b1d2c106eff7db6fc00e4ed9039a8
+ sha1sums = ce317ca5c8185b58bc9300182b534608c578637f
+ sha1sums = 9de4e74d8ceb2005409e03bf671e619f2e060082
+ sha1sums = 3721d13fd9a19df60fe356e082e6cea4ea637dbc
+ sha1sums = 0f5e63dc6a689976014c6cc87d5be28eb4ee922b
+ sha1sums = 007b353cf1bb10f11759169027ad49259527e607
+ sha1sums = 3372d92b1b422f64ce53fe0c73883513ea3478d1
+ sha1sums = 4d59f1a5b9a0c76393fb4709196d579f0aa40812
+
+pkgname = gcc-msp430
+
diff --git a/0001_gcc-doc-texinfo-5.0.patch b/0001_gcc-doc-texinfo-5.0.patch
new file mode 100644
index 000000000000..831b30537d88
--- /dev/null
+++ b/0001_gcc-doc-texinfo-5.0.patch
@@ -0,0 +1,101 @@
+diff --git c/gcc/doc/cppopts.texi i/gcc/doc/cppopts.texi
+index 5212478..52d5997 100644
+--- c/gcc/doc/cppopts.texi
++++ i/gcc/doc/cppopts.texi
+@@ -769,7 +769,7 @@ Replacement: [ ] @{ @} # \ ^ | ~
+ Enable special code to work around file systems which only permit very
+ short file names, such as MS-DOS@.
+
+-@itemx --help
++@item --help
+ @itemx --target-help
+ @opindex help
+ @opindex target-help
+diff --git c/gcc/doc/generic.texi i/gcc/doc/generic.texi
+index 5874c55..79af22f 100644
+--- c/gcc/doc/generic.texi
++++ i/gcc/doc/generic.texi
+@@ -1415,13 +1415,13 @@ generate these expressions anyhow, if it can tell that strictness does
+ not matter. The type of the operands and that of the result are
+ always of @code{BOOLEAN_TYPE} or @code{INTEGER_TYPE}.
+
+-@itemx POINTER_PLUS_EXPR
++@item POINTER_PLUS_EXPR
+ This node represents pointer arithmetic. The first operand is always
+ a pointer/reference type. The second operand is always an unsigned
+ integer type compatible with sizetype. This is the only binary
+ arithmetic operand that can operate on pointer types.
+
+-@itemx PLUS_EXPR
++@item PLUS_EXPR
+ @itemx MINUS_EXPR
+ @itemx MULT_EXPR
+ These nodes represent various binary arithmetic operations.
+diff --git c/gcc/doc/invoke.texi i/gcc/doc/invoke.texi
+index 4ed31b6..c071595 100644
+--- c/gcc/doc/invoke.texi
++++ i/gcc/doc/invoke.texi
+@@ -165,7 +165,7 @@ in the following sections.
+ -pipe -pass-exit-codes @gol
+ -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
+ --version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
+--fdump-ada-spec@r{[}-slim@r{]}} -fdump-go-spec=@var{file}
++-fdump-ada-spec@r{[}-slim@r{]} -fdump-go-spec=@var{file}}
+
+ @item C Language Options
+ @xref{C Dialect Options,,Options Controlling C Dialect}.
+@@ -5085,11 +5085,11 @@ Dump after duplicating the computed gotos.
+ @option{-fdump-rtl-ce3} enable dumping after the three
+ if conversion passes.
+
+-@itemx -fdump-rtl-cprop_hardreg
++@item -fdump-rtl-cprop_hardreg
+ @opindex fdump-rtl-cprop_hardreg
+ Dump after hard register copy propagation.
+
+-@itemx -fdump-rtl-csa
++@item -fdump-rtl-csa
+ @opindex fdump-rtl-csa
+ Dump after combining stack adjustments.
+
+@@ -5100,11 +5100,11 @@ Dump after combining stack adjustments.
+ @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
+ the two common sub-expression elimination passes.
+
+-@itemx -fdump-rtl-dce
++@item -fdump-rtl-dce
+ @opindex fdump-rtl-dce
+ Dump after the standalone dead code elimination passes.
+
+-@itemx -fdump-rtl-dbr
++@item -fdump-rtl-dbr
+ @opindex fdump-rtl-dbr
+ Dump after delayed branch scheduling.
+
+@@ -5149,7 +5149,7 @@ Dump after the initialization of the registers.
+ @opindex fdump-rtl-initvals
+ Dump after the computation of the initial value sets.
+
+-@itemx -fdump-rtl-into_cfglayout
++@item -fdump-rtl-into_cfglayout
+ @opindex fdump-rtl-into_cfglayout
+ Dump after converting to cfglayout mode.
+
+@@ -5179,7 +5179,7 @@ Dump after removing redundant mode switches.
+ @opindex fdump-rtl-rnreg
+ Dump after register renumbering.
+
+-@itemx -fdump-rtl-outof_cfglayout
++@item -fdump-rtl-outof_cfglayout
+ @opindex fdump-rtl-outof_cfglayout
+ Dump after converting from cfglayout mode.
+
+@@ -5191,7 +5191,7 @@ Dump after the peephole pass.
+ @opindex fdump-rtl-postreload
+ Dump after post-reload optimizations.
+
+-@itemx -fdump-rtl-pro_and_epilogue
++@item -fdump-rtl-pro_and_epilogue
+ @opindex fdump-rtl-pro_and_epilogue
+ Dump after generating the function pro and epilogues.
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..ab32934a5101
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,119 @@
+# Contributor: ABDULLATIF <bourou01dev@gmail.com>
+
+pkgname=gcc-msp430
+pkgver=4.6.3
+pkgrel=1
+pkgdesc="GNU toolchain for the TI MSP430 processor"
+arch=('i686' 'x86_64')
+url="http://sourceforge.net/projects/mspgcc/"
+license=('GPL')
+makedepends=('binutils-msp430')
+depends=('elfutils' 'libmpc')
+options=(!strip !emptydirs !libtool)
+
+_mspgcc_ver=20120406
+_gnu_mirror="http://ftpmirror.gnu.org"
+_sf_base="http://sourceforge.net/projects/mspgcc/files"
+_patches_base="${_sf_base}/Patches/LTS/${_mspgcc_ver}"
+
+_patches=(msp430-gcc-${pkgver}-20120406-sf3540953.patch
+ msp430-gcc-${pkgver}-20120406-sf3559978.patch)
+
+source=("http://sourceforge.net/projects/mspgcc/files/mspgcc/mspgcc-${_mspgcc_ver}.tar.bz2"
+ "${_gnu_mirror}/gcc/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
+ "${_patches[0]}::${_patches_base}/${_patches[0]}/download"
+ "${_patches[1]}::${_patches_base}/${_patches[1]}/download"
+ "0001_gcc-doc-texinfo-5.0.patch"
+ "patch-gcc_cp_cfns.h"
+ "patch-gcc46-texi.diff"
+ "ira-int.h-segmentation-fault.patch")
+sha1sums=('cc96a7233f0b1d2c106eff7db6fc00e4ed9039a8'
+ 'ce317ca5c8185b58bc9300182b534608c578637f'
+ '9de4e74d8ceb2005409e03bf671e619f2e060082'
+ '3721d13fd9a19df60fe356e082e6cea4ea637dbc'
+ '0f5e63dc6a689976014c6cc87d5be28eb4ee922b'
+ '007b353cf1bb10f11759169027ad49259527e607'
+ '3372d92b1b422f64ce53fe0c73883513ea3478d1'
+ '4d59f1a5b9a0c76393fb4709196d579f0aa40812')
+
+_builddir=build
+
+
+
+prepare() {
+ cd "${srcdir}/gcc-${pkgver}"
+
+ # https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=avr-gcc-atmel
+ # https://bugs.archlinux.org/task/34629
+ sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure gcc/configure
+
+
+ #https://github.com/DragonFlyBSD/DPorts/issues/136
+ patch -p0 < "${srcdir}/patch-gcc_cp_cfns.h"
+
+ #https://trac.macports.org/ticket/53076
+ #The attached patch patch-gcc46-texi.diff fixed the gcc46 build with texinfo 6.3 by repairing minor errors in ./gcc/doc/gcc.texi.
+ patch -p0 < "${srcdir}/patch-gcc46-texi.diff"
+
+
+ #https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54638
+ #https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=191606
+ patch -p0 < "${srcdir}/ira-int.h-segmentation-fault.patch"
+
+ #export CFLAGS="-O2 -pipe"
+ #export CXXFLAGS="-O2 -pipe"
+
+ _patch_name="msp430-gcc-${pkgver}-${_mspgcc_ver}.patch"
+ (cd "${srcdir}/gcc-${pkgver}" &&
+ patch -p1 < "${srcdir}/mspgcc-${_mspgcc_ver}/${_patch_name}" &&
+ patch -p1 < "${srcdir}/0001_gcc-doc-texinfo-5.0.patch" &&
+ for patch in ${_patches[@]} ; do
+ msg "Applying ${patch}"
+ patch -p1 < "${srcdir}/${patch}"
+ done)
+
+ rm -frv ${_builddir}
+ mkdir -p ${_builddir} && cd ${_builddir}
+}
+
+
+build() {
+ cd ${srcdir}/gcc-${pkgver}/${_builddir}
+ CFLAGS="-Os -g0 -s" "${srcdir}/gcc-${pkgver}/configure" \
+ CFLAGS_FOR_TARGET="-Os" \
+ --prefix=/usr \
+ --infodir=/usr/share/info \
+ --mandir=/usr/share/man \
+ --disable-libssp \
+ --disable-nls \
+ --target=msp430 \
+ --enable-languages=c,c++ \
+ --with-gnu-as \
+ --with-gnu-ld \
+ --with-as=/usr/bin/msp430-as \
+ --with-ld=/usr/bin/msp430-ld \
+ --with-pkgversion="mspgcc_${_mspgcc_ver}"
+ make
+}
+
+package() {
+ cd ${srcdir}/gcc-${pkgver}/${_builddir}
+ make DESTDIR=${pkgdir} install
+
+ rm -f ${pkgdir}/usr/lib/libiberty.a
+ rm -rf ${pkgdir}/usr/share/man/man7
+ rm -rf ${pkgdir}/usr/share/info
+
+ msg "Stripping debugging symbols from binaries"
+ local binary
+ find ${pkgdir} -type f 2>/dev/null | while read binary ; do
+ case "$(file -biz "$binary")" in
+ *compressed-encoding*) # Skip compressed binarys
+ ;;
+ *application/x-executable*) # Binaries
+ /usr/bin/strip "$binary" >/dev/null 2>&1 ;;
+ esac
+ done
+}
+
+# vim:set sts=2 ts=2 sw=2 et:
diff --git a/gperf-inlines.patch b/gperf-inlines.patch
new file mode 100644
index 000000000000..f8f147a12bcc
--- /dev/null
+++ b/gperf-inlines.patch
@@ -0,0 +1,126 @@
+Index: gcc/cp/Make-lang.in
+===================================================================
+--- gcc/cp/Make-lang.in (revision 233574)
++++ gcc/cp/Make-lang.in (working copy)
+@@ -111,7 +111,7 @@ else
+ # deleting the $(srcdir)/cp/cfns.h file.
+ $(srcdir)/cp/cfns.h:
+ endif
+- gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
++ gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
+ $(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
+
+ #
+Index: gcc/cp/cfns.gperf
+===================================================================
+--- gcc/cp/cfns.gperf (revision 233574)
++++ gcc/cp/cfns.gperf (working copy)
+@@ -1,3 +1,5 @@
++%language=C++
++%define class-name libc_name
+ %{
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+
+@@ -16,14 +18,6 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ %}
+ %%
+ # The standard C library functions, for feeding to gperf; the result is used
+Index: gcc/cp/cfns.h
+===================================================================
+--- gcc/cp/cfns.h (revision 233574)
++++ gcc/cp/cfns.h (working copy)
+@@ -1,5 +1,5 @@
+-/* ANSI-C code produced by gperf version 3.0.3 */
+-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf */
++/* C++ code produced by gperf version 3.0.4 */
++/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf */
+
+ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+@@ -28,7 +28,7 @@
+ #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+ #endif
+
+-#line 1 "cfns.gperf"
++#line 3 "cfns.gperf"
+
+ /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
+
+@@ -47,26 +47,19 @@ for more details.
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+-#ifdef __GNUC__
+-__inline
+-#endif
+-static unsigned int hash (const char *, unsigned int);
+-#ifdef __GNUC__
+-__inline
+-#endif
+-const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+
+-#ifdef __GNUC__
+-__inline
+-#else
+-#ifdef __cplusplus
+-inline
+-#endif
+-#endif
+-static unsigned int
+-hash (register const char *str, register unsigned int len)
++class libc_name
+ {
++private:
++ static inline unsigned int hash (const char *str, unsigned int len);
++public:
++ static const char *libc_name_p (const char *str, unsigned int len);
++};
++
++inline unsigned int
++libc_name::hash (register const char *str, register unsigned int len)
++{
+ static const unsigned short asso_values[] =
+ {
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+@@ -122,14 +115,8 @@ along with GCC; see the file COPYING3. If not see
+ return hval + asso_values[(unsigned char)str[len - 1]];
+ }
+
+-#ifdef __GNUC__
+-__inline
+-#ifdef __GNUC_STDC_INLINE__
+-__attribute__ ((__gnu_inline__))
+-#endif
+-#endif
+ const char *
+-libc_name_p (register const char *str, register unsigned int len)
++libc_name::libc_name_p (register const char *str, register unsigned int len)
+ {
+ enum
+ {
+Index: gcc/cp/except.c
+===================================================================
+--- gcc/cp/except.c (revision 233574)
++++ gcc/cp/except.c (working copy)
+@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
+ unless the system headers are playing rename tricks, and if
+ they are, we don't want to be confused by them. */
+ id = DECL_NAME (fn);
+- return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
++ return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
++ IDENTIFIER_LENGTH (id));
+ }
+
+ /* Returns nonzero if an exception of type FROM will be caught by a \ No newline at end of file
diff --git a/ira-int.h-segmentation-fault.patch b/ira-int.h-segmentation-fault.patch
new file mode 100644
index 000000000000..9335b5ec68fc
--- /dev/null
+++ b/ira-int.h-segmentation-fault.patch
@@ -0,0 +1,18 @@
+--- gcc/ira-int.h 2011-01-03 21:52:22.000000000 +0100
++++ gcc/ira-int.h.new 2017-05-03 00:57:50.111256000 +0200
+@@ -1123,8 +1123,13 @@
+ ira_allocno_object_iter_cond (ira_allocno_object_iterator *i, ira_allocno_t a,
+ ira_object_t *o)
+ {
+- *o = ALLOCNO_OBJECT (a, i->n);
+- return i->n++ < ALLOCNO_NUM_OBJECTS (a);
++ int n = i->n++;
++ if (n < ALLOCNO_NUM_OBJECTS (a))
++ {
++ *o = ALLOCNO_OBJECT (a, n);
++ return true;
++ }
++ return false;
+ }
+
+ /* Loop over all objects associated with allocno A. In each
diff --git a/msp430-gcc-4.6.3-20120406-sf3540953.patch b/msp430-gcc-4.6.3-20120406-sf3540953.patch
new file mode 100644
index 000000000000..a151d2a48d94
--- /dev/null
+++ b/msp430-gcc-4.6.3-20120406-sf3540953.patch
@@ -0,0 +1,80 @@
+From 6d30e786948e4edee30cc10d0233a0b47a5f7d9b Mon Sep 17 00:00:00 2001
+From: "Peter A. Bigot" <pabigot@users.sourceforge.net>
+Date: Thu, 12 Jul 2012 14:32:16 -0500
+Subject: [PATCH] SF 3540953 fram applications overwrite bsl/jtag passwords
+
+No MSP430 chip has more than 25 valid interrupts, and they are assigned from
+the top down. The FRAM chips use lower words in the interrupt vector to
+hold BSL and JTAG passwords, and having real addresses in those locations
+has been shown to result in problems accessing BSL and JTAG. Leave the low
+32 words erased; this matches as-delivered MSP430FR5739 content for those
+addresses.
+---
+ gcc/config/msp430/crt0ivtbl.S | 44 +++++++++++++++++++++++++++++++++++++++-
+ 1 files changed, 42 insertions(+), 2 deletions(-)
+
+diff --git a/gcc/config/msp430/crt0ivtbl.S b/gcc/config/msp430/crt0ivtbl.S
+index 696f6aa..bd1931c 100644
+--- a/gcc/config/msp430/crt0ivtbl.S
++++ b/gcc/config/msp430/crt0ivtbl.S
+@@ -32,6 +32,7 @@ __br_unexpected_:
+
+ DEFINE_IVTABLE INTERRUPT_VECTOR_COUNT
+
++#if 32 >= INTERRUPT_VECTOR_COUNT
+ INITIALIZE_ISR_SLOT 0
+ INITIALIZE_ISR_SLOT 1
+ INITIALIZE_ISR_SLOT 2
+@@ -65,8 +66,47 @@ DEFINE_IVTABLE INTERRUPT_VECTOR_COUNT
+ INITIALIZE_ISR_SLOT 29
+ INITIALIZE_ISR_SLOT 30
+ #endif /* 16 < INTERRUPT_VECTOR_COUNT */
+-#if 32 < INTERRUPT_VECTOR_COUNT
+- INITIALIZE_ISR_SLOT 31
++#else /* 32 >= INTERRUPT_VECTOR_COUNT */
++/* SF 3540953 fram applications overwrite bsl/jtag passwords
++ *
++ * No MSP430 chip has more than 25 valid interrupts, and they are assigned from
++ * the top down. The FRAM chips use lower words in the interrupt vector to
++ * hold BSL and JTAG passwords, and having real addresses in those locations
++ * has been shown to result in problems accessing BSL and JTAG. Leave the low
++ * 32 words erased; this matches as-delivered MSP430FR5739 content for those
++ * addresses. */
++ .word 0xffff ; 0
++ .word 0xffff ; 1
++ .word 0xffff ; 2
++ .word 0xffff ; 3
++ .word 0xffff ; 4
++ .word 0xffff ; 5
++ .word 0xffff ; 6
++ .word 0xffff ; 7
++ .word 0xffff ; 8
++ .word 0xffff ; 9
++ .word 0xffff ; 10
++ .word 0xffff ; 11
++ .word 0xffff ; 12
++ .word 0xffff ; 13
++ .word 0xffff ; 14
++ .word 0xffff ; 15
++ .word 0xffff ; 16
++ .word 0xffff ; 17
++ .word 0xffff ; 18
++ .word 0xffff ; 19
++ .word 0xffff ; 20
++ .word 0xffff ; 21
++ .word 0xffff ; 22
++ .word 0xffff ; 23
++ .word 0xffff ; 24
++ .word 0xffff ; 25
++ .word 0xffff ; 26
++ .word 0xffff ; 27
++ .word 0xffff ; 28
++ .word 0xffff ; 29
++ .word 0xffff ; 30
++ .word 0xffff ; 31
+ INITIALIZE_ISR_SLOT 32
+ INITIALIZE_ISR_SLOT 33
+ INITIALIZE_ISR_SLOT 34
+--
+1.7.7.6
+
diff --git a/msp430-gcc-4.6.3-20120406-sf3559978.patch b/msp430-gcc-4.6.3-20120406-sf3559978.patch
new file mode 100644
index 000000000000..81affdc1f6ff
--- /dev/null
+++ b/msp430-gcc-4.6.3-20120406-sf3559978.patch
@@ -0,0 +1,68 @@
+From 44f96cdfe3c2afed8b2d386ceda2665e0f28cb9c Mon Sep 17 00:00:00 2001
+From: "Peter A. Bigot" <pabigot@users.sourceforge.net>
+Date: Mon, 10 Sep 2012 17:08:04 -0500
+Subject: [PATCH] SF 3559978 broken volatile peephole optimization
+
+Pattern improperly passed arbitrary operand where indirect read was intended
+---
+ gcc/config/msp430/peephole.md | 12 ++++++------
+ gcc/testsuite/gcc.target/msp430/sf3559978.c | 15 +++++++++++++++
+ 2 files changed, 21 insertions(+), 6 deletions(-)
+ create mode 100644 gcc/testsuite/gcc.target/msp430/sf3559978.c
+
+diff --git a/gcc/config/msp430/peephole.md b/gcc/config/msp430/peephole.md
+index 907c615..60b8302 100644
+--- a/gcc/config/msp430/peephole.md
++++ b/gcc/config/msp430/peephole.md
+@@ -79,21 +79,21 @@
+ "")
+
+ ;; Assignment to volatile memory through a cast constant pointer
+-;; mov #c1, r0; mov &m3, r2; op4 g5, r2; mov r2, @r0 => op g4, &c1 [r0 dead, r2 dead]
+-; see testsuite vwa4.c
++;; mov #c1, r0; mov @r0, r2; op3 g4, r2; mov r2, @r0 => op3 g4, &c1 [r0 dead, r2 dead]
++; see testsuite vwa4.c, sf3559978.c
+ (define_peephole2
+ [(set (match_operand 0 "pmode_register_operand" "")
+ (match_operand 1 "immediate_operand" ""))
+ (set (match_operand:INTRegModes 2 "register_operand" "")
+- (match_operand:<MODE> 3 "nonimmediate_operand" ""))
++ (mem:<MODE> (match_dup 0)))
+ (set (match_dup 2)
+- (match_operator:<MODE> 4 "msp430_rmw_operator"
++ (match_operator:<MODE> 3 "msp430_rmw_operator"
+ [(match_dup 2)
+- (match_operand:<MODE> 5 "general_operand" "")]))
++ (match_operand:<MODE> 4 "general_operand" "")]))
+ (set (mem:<MODE> (match_dup 0)) (match_dup 2))]
+ "peep2_reg_dead_p (4, operands[0]) && peep2_reg_dead_p (4, operands[2])"
+ [(set (mem:<MODE> (match_dup 1))
+- (match_op_dup 4 [(mem:<MODE> (match_dup 1)) (match_dup 5)]))]
++ (match_op_dup 3 [(mem:<MODE> (match_dup 1)) (match_dup 4)]))]
+ "")
+
+
+diff --git a/gcc/testsuite/gcc.target/msp430/sf3559978.c b/gcc/testsuite/gcc.target/msp430/sf3559978.c
+new file mode 100644
+index 0000000..8801ddc
+--- /dev/null
++++ b/gcc/testsuite/gcc.target/msp430/sf3559978.c
+@@ -0,0 +1,15 @@
++/* { dg-do compile } */
++/* { dg-options "-Os" } */
++
++static volatile struct sTransmitBuffer {
++ volatile char * head;
++ volatile char * tail;
++ char buffer[256];
++ unsigned int wake_when_available;
++} txBuffer;
++
++void initialize ()
++{
++ txBuffer.tail = txBuffer.buffer; /* { dg-final { scan-assembler "mov\t#txBuffer\\+2, r15\n\tmov\tr15, r14\n\tadd\t#2, r14\n\tmov\tr14, @r15\n" } } */
++}
++
+--
+1.7.7.6
+
diff --git a/patch-gcc46-texi.diff b/patch-gcc46-texi.diff
new file mode 100644
index 000000000000..783ee871d04e
--- /dev/null
+++ b/patch-gcc46-texi.diff
@@ -0,0 +1,28 @@
+--- ./gcc/doc/gcc.texi.orig 2017-03-01 16:56:48.000000000 -0800
++++ ./gcc/doc/gcc.texi 2017-03-01 17:03:38.000000000 -0800
+@@ -86,9 +86,15 @@
+ @item GNU Press
+ @tab Website: www.gnupress.org
+ @item a division of the
+-@tab General: @tex press@@gnu.org @end tex
++@tab General:
++@tex
++press@@gnu.org
++@end tex
+ @item Free Software Foundation
+-@tab Orders: @tex sales@@gnu.org @end tex
++@tab Orders:
++@tex
++sales@@gnu.org
++@end tex
+ @item 51 Franklin Street, Fifth Floor
+ @tab Tel 617-542-5942
+ @item Boston, MA 02110-1301 USA
+@@ -108,6 +114,7 @@
+ @sp 1
+ @insertcopying
+ @end titlepage
++
+ @summarycontents
+ @contents
+ @page
diff --git a/patch-gcc_cp_cfns.h b/patch-gcc_cp_cfns.h
new file mode 100644
index 000000000000..79d3dcf3a9fc
--- /dev/null
+++ b/patch-gcc_cp_cfns.h
@@ -0,0 +1,22 @@
+--- gcc/cp/cfns.h.orig 2015-02-13 08:27:46.000000000 +0200
++++ gcc/cp/cfns.h 2015-02-13 10:23:53.000000000 +0200
+@@ -53,6 +53,9 @@
+ static unsigned int hash (const char *, unsigned int);
+ #ifdef __GNUC__
+ __inline
++#ifdef __GNUC_STDC_INLINE__
++__attribute__ ((__gnu_inline__))
++#endif
+ #endif
+ const char * libc_name_p (const char *, unsigned int);
+ /* maximum key range = 391, duplicates = 0 */
+@@ -96,7 +99,7 @@
+ 400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
+ 400, 400, 400, 400, 400, 400, 400
+ };
+- register int hval = len;
++ register int hval = (int)len;
+
+ switch (hval)
+ {
+