summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorABDULLATIF Mouhamadi2017-05-24 01:24:14 +0200
committerABDULLATIF Mouhamadi2017-05-24 01:24:14 +0200
commitc7319c9a7fbc00c70bb104ab852eb4182ba6e36e (patch)
tree05f2d0142cd2c4b43754b6e026f706a50d28aab4
downloadaur-gcc-avr-tinyos.tar.gz
first commit
-rw-r--r--.SRCINFO53
-rw-r--r--10-gcc-4.1.2-c-incpath.patch28
-rw-r--r--11-gcc-4.1.2-exec-prefix.patch85
-rw-r--r--20-gcc-4.1.2-libiberty-Makefile.in.patch12
-rw-r--r--30-gcc-4.1.2-binary-constants.patch144
-rw-r--r--31-gcc-4.1.2-isr-alias.patch12
-rw-r--r--40-gcc-4.1.2-bug-28902.patch12
-rw-r--r--42-gcc-4.1.2-bug-31137.patch18
-rw-r--r--43-gcc-4.1.2-bug-19087.patch10
-rw-r--r--44-gcc-4.1.2-bug-30289.patch20
-rw-r--r--45-gcc-4.1.2-bug-18989.patch15
-rw-r--r--46-gcc-4.1.2-bug-30483.patch21
-rw-r--r--50-gcc-4.1.2-newdevices.patch307
-rw-r--r--51-gcc-4.1.2-atmega256x.patch499
-rw-r--r--PKGBUILD116
-rw-r--r--rfa1.patch41
16 files changed, 1393 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..74c476c465e5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,53 @@
+pkgbase = gcc-avr-tinyos
+ pkgdesc = The GNU avr Compiler Collection with TinyOS patches
+ pkgver = 4.1.2
+ pkgrel = 1
+ url = http://gcc.gnu.org/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ license = LGPL
+ license = custom
+ depends = binutils-avr-tinyos
+ depends = gcc-libs
+ depends = libmpc
+ provides = gcc-avr
+ options = staticlibs
+ options = !ccache
+ options = !distcc
+ options = !emptydirs
+ options = !libtool
+ options = !strip
+ source = http://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2
+ source = 10-gcc-4.1.2-c-incpath.patch
+ source = 11-gcc-4.1.2-exec-prefix.patch
+ source = 20-gcc-4.1.2-libiberty-Makefile.in.patch
+ source = 30-gcc-4.1.2-binary-constants.patch
+ source = 31-gcc-4.1.2-isr-alias.patch
+ source = 40-gcc-4.1.2-bug-28902.patch
+ source = 42-gcc-4.1.2-bug-31137.patch
+ source = 43-gcc-4.1.2-bug-19087.patch
+ source = 44-gcc-4.1.2-bug-30289.patch
+ source = 45-gcc-4.1.2-bug-18989.patch
+ source = 46-gcc-4.1.2-bug-30483.patch
+ source = 50-gcc-4.1.2-newdevices.patch
+ source = 51-gcc-4.1.2-atmega256x.patch
+ source = rfa1.patch
+ md5sums = a4a3eb15c96030906d8494959eeda23c
+ md5sums = 61116f5b61b3bbec9af326fd3b460281
+ md5sums = a69568f43093e4fde729b562c46d5ba0
+ md5sums = 802a403cf49540df0e27c5aa8d00e749
+ md5sums = 97f3b27945783b93c9e681e5d874c056
+ md5sums = e70f0e54d7492f0e82813fe75764d356
+ md5sums = 2344927824632eaecb7176156b20c1c8
+ md5sums = 3442ea03c04e626088c51f31af3329cf
+ md5sums = 137de4bfd8b94c96ac546b8967964aa8
+ md5sums = c3835d0d0229c0b2fb14d097afe19a16
+ md5sums = e3e5916ce4a286e03ec6275035f19dfd
+ md5sums = 42a8f2a38f9570dba800a179b5d55b43
+ md5sums = 3f4fc9108b63ffa9ccda033ff139883a
+ md5sums = 5be152a40f9e27832590482f7cb5e5de
+ md5sums = f068e5b046bcf07715306f38b1e3c9a2
+
+pkgname = gcc-avr-tinyos
+
diff --git a/10-gcc-4.1.2-c-incpath.patch b/10-gcc-4.1.2-c-incpath.patch
new file mode 100644
index 000000000000..2f628ceed4c1
--- /dev/null
+++ b/10-gcc-4.1.2-c-incpath.patch
@@ -0,0 +1,28 @@
+--- gcc/c-incpath.c.orig 2005-11-30 14:27:58.607093300 -0700
++++ gcc/c-incpath.c 2005-11-30 14:28:20.450983100 -0700
+@@ -331,13 +331,18 @@
+ cpp_dir *p;
+
+ #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+- /* Convert all backslashes to slashes. The native CRT stat()
+- function does not recognize a directory that ends in a backslash
+- (unless it is a drive root dir, such "c:\"). Forward slashes,
+- trailing or otherwise, cause no problems for stat(). */
+- char* c;
+- for (c = path; *c; c++)
+- if (*c == '\\') *c = '/';
++ /* Remove unnecessary trailing slashes. On some versions of MS
++ Windows, trailing _forward_ slashes cause no problems for stat().
++ On newer versions, stat() does not recognise a directory that ends
++ in a '\\' or '/', unless it is a drive root dir, such as "c:/",
++ where it is obligatory. */
++ int pathlen = strlen (path);
++ char* end = path + pathlen - 1;
++ /* Preserve the lead '/' or lead "c:/". */
++ char* start = path + (pathlen > 2 && path[1] == ':' ? 3 : 1);
++
++ for (; end > start && IS_DIR_SEPARATOR (*end); end--)
++ *end = 0;
+ #endif
+
+ p = xmalloc (sizeof (cpp_dir));
diff --git a/11-gcc-4.1.2-exec-prefix.patch b/11-gcc-4.1.2-exec-prefix.patch
new file mode 100644
index 000000000000..2dd428a739e9
--- /dev/null
+++ b/11-gcc-4.1.2-exec-prefix.patch
@@ -0,0 +1,85 @@
+diff -Nbaur gcc-4.1.1/gcc/gcc.c gcc-4.1.1-arm/gcc/gcc.c
+--- gcc/gcc.c Wed May 17 19:38:58 2006
++++ gcc/gcc.c Mon Jun 5 06:58:56 2006
+@@ -3250,8 +3250,6 @@
+ gcc_libexec_prefix = make_relative_prefix (argv[0],
+ standard_bindir_prefix,
+ standard_libexec_prefix);
+- if (gcc_exec_prefix)
+- putenv (concat ("GCC_EXEC_PREFIX=", gcc_exec_prefix, NULL));
+ }
+ else
+ gcc_libexec_prefix = make_relative_prefix (gcc_exec_prefix,
+@@ -6148,10 +6146,21 @@
+
+ /* We need to check standard_exec_prefix/just_machine_suffix/specs
+ for any override of as, ld and libraries. */
++ if ( gcc_exec_prefix )
++ {
++ specs_file = alloca (strlen (gcc_exec_prefix)
++ + strlen (just_machine_suffix) + sizeof ("specs"));
++
++ strcpy (specs_file, gcc_exec_prefix);
++ } else {
++
+ specs_file = alloca (strlen (standard_exec_prefix)
+ + strlen (just_machine_suffix) + sizeof ("specs"));
+
+ strcpy (specs_file, standard_exec_prefix);
++
++ }
++
+ strcat (specs_file, just_machine_suffix);
+ strcat (specs_file, "specs");
+ if (access (specs_file, R_OK) == 0)
+diff -Nbaur gcc-4.1.1/gcc/prefix.c gcc-4.1.1-arm/gcc/prefix.c
+--- gcc/prefix.c Sat Jun 25 03:02:01 2005
++++ gcc/prefix.c Mon Jun 5 06:58:56 2006
+@@ -246,13 +246,16 @@
+ The returned string is always malloc-ed, and the caller is
+ responsible for freeing it. */
+
++
++static const char *old_prefix = PREFIX;
++
+ char *
+ update_path (const char *path, const char *key)
+ {
+ char *result, *p;
+- const int len = strlen (std_prefix);
++ const int len = strlen (old_prefix);
+
+- if (! strncmp (path, std_prefix, len)
++ if (! strncmp (path, old_prefix, len)
+ && (IS_DIR_SEPARATOR(path[len])
+ || path[len] == '\0')
+ && key != 0)
+@@ -354,4 +357,6 @@
+ set_std_prefix (const char *prefix, int len)
+ {
+ std_prefix = save_string (prefix, len);
++
++ putenv (concat ("GCC_EXEC_PREFIX=", std_prefix, NULL));
+ }
+diff -Nbaur gcc-4.1.1/gcc/toplev.c gcc-4.1.1-arm/gcc/toplev.c
+--- gcc/toplev.c Sat Feb 4 22:13:20 2006
++++ gcc/toplev.c Mon Jun 5 06:58:56 2006
+@@ -82,6 +82,7 @@
+ #include "value-prof.h"
+ #include "alloc-pool.h"
+ #include "tree-mudflap.h"
++#include "prefix.h"
+
+ #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO)
+ #include "dwarf2out.h"
+@@ -1434,6 +1435,10 @@
+ progname = p;
+
+ xmalloc_set_program_name (progname);
++
++ p = getenv("GCC_EXEC_PREFIX");
++ if (p && strlen(p)) set_std_prefix (p, strlen(p));
++
+
+ hex_init ();
+
diff --git a/20-gcc-4.1.2-libiberty-Makefile.in.patch b/20-gcc-4.1.2-libiberty-Makefile.in.patch
new file mode 100644
index 000000000000..0e0b3ce31173
--- /dev/null
+++ b/20-gcc-4.1.2-libiberty-Makefile.in.patch
@@ -0,0 +1,12 @@
+--- libiberty/Makefile.in.orig Mon Sep 26 22:55:10 2005
++++ libiberty/Makefile.in Wed Mar 22 22:13:44 2006
+@@ -275,7 +275,8 @@
+ @MAINT@ echo stamp > stamp-functions
+
+ INSTALL_DEST = @INSTALL_DEST@
+-install: install_to_$(INSTALL_DEST) install-subdir
++#install: install_to_$(INSTALL_DEST) install-subdir
++install:
+
+ install_to_libdir: all
+ ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
diff --git a/30-gcc-4.1.2-binary-constants.patch b/30-gcc-4.1.2-binary-constants.patch
new file mode 100644
index 000000000000..3f21cb6fdbaf
--- /dev/null
+++ b/30-gcc-4.1.2-binary-constants.patch
@@ -0,0 +1,144 @@
+--- ./gcc/doc/extend.texi.orig Sat Aug 6 15:26:27 2005
++++ ./gcc/doc/extend.texi Mon Aug 22 00:14:05 2005
+@@ -79,6 +79,7 @@
+ * Pragmas:: Pragmas accepted by GCC.
+ * Unnamed Fields:: Unnamed struct/union fields within structs/unions.
+ * Thread-Local:: Per-thread variables.
++* Binary constants:: Binary constants using the @samp{0b} prefix.
+ @end menu
+
+ @node Statement Exprs
+@@ -9742,6 +9743,28 @@
+ Non-@code{static} members shall not be @code{__thread}.
+ @end quotation
+ @end itemize
++
++@node Binary constants
++@section Binary constants using the @samp{0b} prefix
++@cindex Binary constants using the @samp{0b} prefix
++
++Integer constants can be written as binary constants, consisting of a
++sequence of @samp{0} and @samp{1} digits, prefixed by @samp{0b} or
++@samp{0B}. This is particularly useful in environments that operate a
++lot on the bit-level (like microcontrollers).
++
++The following statements are identical:
++
++@smallexample
++i = 42;
++i = 0x2a;
++i = 052;
++i = 0b101010;
++@end smallexample
++
++The type of these constants follows the same rules as for octal or
++hexadecimal integer constants, so suffixes like @samp{L} or @samp{UL}
++can be applied.
+
+ @node C++ Extensions
+ @chapter Extensions to the C++ Language
+--- ./libcpp/include/cpplib.h.orig Wed Jun 29 04:34:39 2005
++++ ./libcpp/include/cpplib.h Mon Aug 22 00:14:05 2005
+@@ -729,6 +729,7 @@
+ #define CPP_N_DECIMAL 0x0100
+ #define CPP_N_HEX 0x0200
+ #define CPP_N_OCTAL 0x0400
++#define CPP_N_BINARY 0x0800
+
+ #define CPP_N_UNSIGNED 0x1000 /* Properties. */
+ #define CPP_N_IMAGINARY 0x2000
+--- ./libcpp/expr.c.orig Wed Jun 29 04:34:36 2005
++++ ./libcpp/expr.c Mon Aug 22 12:02:28 2005
+@@ -171,6 +171,11 @@
+ radix = 16;
+ str++;
+ }
++ else if ((*str == 'b' || *str == 'B') && (str[1] == '0' || str[1] == '1'))
++ {
++ radix = 2;
++ str++;
++ }
+ }
+
+ /* Now scan for a well-formed integer or float. */
+@@ -209,10 +214,22 @@
+ radix = 10;
+
+ if (max_digit >= radix)
+- SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
++ {
++ if (radix == 2)
++ SYNTAX_ERROR2 ("invalid digit \"%c\" in binary constant", '0' + max_digit);
++ else
++ SYNTAX_ERROR2 ("invalid digit \"%c\" in octal constant", '0' + max_digit);
++ }
+
+ if (float_flag != NOT_FLOAT)
+ {
++ if (radix == 2)
++ {
++ cpp_error (pfile, CPP_DL_ERROR,
++ "invalid prefix \"0b\" for floating constant");
++ return CPP_N_INVALID;
++ }
++
+ if (radix == 16 && CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, c99))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "use of C99 hexadecimal floating constant");
+@@ -288,11 +305,16 @@
+ if ((result & CPP_N_IMAGINARY) && CPP_PEDANTIC (pfile))
+ cpp_error (pfile, CPP_DL_PEDWARN,
+ "imaginary constants are a GCC extension");
++ if (radix == 2 && CPP_PEDANTIC (pfile))
++ cpp_error (pfile, CPP_DL_PEDWARN,
++ "binary constants are a GCC extension");
+
+ if (radix == 10)
+ result |= CPP_N_DECIMAL;
+ else if (radix == 16)
+ result |= CPP_N_HEX;
++ else if (radix == 2)
++ result |= CPP_N_BINARY;
+ else
+ result |= CPP_N_OCTAL;
+
+@@ -343,6 +365,11 @@
+ base = 16;
+ p += 2;
+ }
++ else if ((type & CPP_N_RADIX) == CPP_N_BINARY)
++ {
++ base = 2;
++ p += 2;
++ }
+
+ /* We can add a digit to numbers strictly less than this without
+ needing the precision and slowness of double integers. */
+@@ -398,12 +425,25 @@
+ append_digit (cpp_num num, int digit, int base, size_t precision)
+ {
+ cpp_num result;
+- unsigned int shift = 3 + (base == 16);
++ unsigned int shift;
+ bool overflow;
+ cpp_num_part add_high, add_low;
+
+- /* Multiply by 8 or 16. Catching this overflow here means we don't
++ /* Multiply by 2, 8 or 16. Catching this overflow here means we don't
+ need to worry about add_high overflowing. */
++ switch (base)
++ {
++ case 2:
++ shift = 1;
++ break;
++
++ case 16:
++ shift = 4;
++ break;
++
++ default:
++ shift = 3;
++ }
+ overflow = !!(num.high >> (PART_PRECISION - shift));
+ result.high = num.high << shift;
+ result.low = num.low << shift;
diff --git a/31-gcc-4.1.2-isr-alias.patch b/31-gcc-4.1.2-isr-alias.patch
new file mode 100644
index 000000000000..c873b4ee8ee1
--- /dev/null
+++ b/31-gcc-4.1.2-isr-alias.patch
@@ -0,0 +1,12 @@
+--- gcc/config/avr/avr.h.orig Sat Jun 25 03:22:41 2005
++++ gcc/config/avr/avr.h Tue Sep 26 23:07:01 2006
+@@ -631,6 +631,8 @@
+ /* Globalizing directive for a label. */
+ #define GLOBAL_ASM_OP ".global\t"
+
++#define SET_ASM_OP "\t.set\t"
++
+ #define ASM_WEAKEN_LABEL(FILE, NAME) \
+ do \
+ { \
+
diff --git a/40-gcc-4.1.2-bug-28902.patch b/40-gcc-4.1.2-bug-28902.patch
new file mode 100644
index 000000000000..4a61a1bad232
--- /dev/null
+++ b/40-gcc-4.1.2-bug-28902.patch
@@ -0,0 +1,12 @@
+Index: gcc/config/avr/avr.h
+===================================================================
+--- gcc/config/avr/avr.h (revision 116509)
++++ gcc/config/avr/avr.h (working copy)
+@@ -94,6 +94,7 @@
+ /* No data type wants to be aligned rounder than this. */
+ #define BIGGEST_ALIGNMENT 8
+
++#define TARGET_VTABLE_ENTRY_ALIGN 8
+
+ #define STRICT_ALIGNMENT 0
+
diff --git a/42-gcc-4.1.2-bug-31137.patch b/42-gcc-4.1.2-bug-31137.patch
new file mode 100644
index 000000000000..2bcfcf7c4dfe
--- /dev/null
+++ b/42-gcc-4.1.2-bug-31137.patch
@@ -0,0 +1,18 @@
+--- gcc/config/avr/avr.c.old 2007-03-13 15:19:35.502842800 -0600
++++ gcc/config/avr/avr.c 2007-03-13 15:21:58.968920800 -0600
+@@ -5050,6 +5050,7 @@ avr_rtx_costs (rtx x, int code, int oute
+ *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
+ else
+ return false;
++ break;
+
+ case HImode:
+ if (AVR_ENHANCED)
+@@ -5058,6 +5059,7 @@ avr_rtx_costs (rtx x, int code, int oute
+ *total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
+ else
+ return false;
++ break;
+
+ default:
+ return false;
diff --git a/43-gcc-4.1.2-bug-19087.patch b/43-gcc-4.1.2-bug-19087.patch
new file mode 100644
index 000000000000..ae1d46b8530b
--- /dev/null
+++ b/43-gcc-4.1.2-bug-19087.patch
@@ -0,0 +1,10 @@
+--- gcc/config/avr/avr.h.old 2006-08-30 10:30:17.756953100 -0600
++++ gcc/config/avr/avr.h 2006-08-30 15:35:25.810505300 -0600
+@@ -71,6 +71,7 @@ extern int avr_asm_only_p;
+
+ #define POINTER_SIZE 16
+
++#define DWARF2_ADDR_SIZE 4
+
+ /* Maximum sized of reasonable data type
+ DImode or Dfmode ... */
diff --git a/44-gcc-4.1.2-bug-30289.patch b/44-gcc-4.1.2-bug-30289.patch
new file mode 100644
index 000000000000..704bc4d544fa
--- /dev/null
+++ b/44-gcc-4.1.2-bug-30289.patch
@@ -0,0 +1,20 @@
+--- gcc/config/avr/avr.md 2007/04/07 22:14:51 123648
++++ gcc/config/avr/avr.md 2007/04/07 22:21:01 123649
+@@ -448,7 +448,7 @@
+ (use (match_operand:QI 1 "register_operand" "r"))
+ (use (match_operand:QI 2 "const_int_operand" "n"))
+ (clobber (match_scratch:HI 3 "=0"))
+- (clobber (match_scratch:QI 4 "=1"))]
++ (clobber (match_scratch:QI 4 "=&1"))]
+ ""
+ "st %a0+,__zero_reg__
+ dec %1
+@@ -462,7 +462,7 @@
+ (use (match_operand:HI 1 "register_operand" "!w,d"))
+ (use (match_operand:HI 2 "const_int_operand" "n,n"))
+ (clobber (match_scratch:HI 3 "=0,0"))
+- (clobber (match_scratch:HI 4 "=1,1"))]
++ (clobber (match_scratch:HI 4 "=&1,&1"))]
+ ""
+ "*{
+ if (which_alternative==0)
diff --git a/45-gcc-4.1.2-bug-18989.patch b/45-gcc-4.1.2-bug-18989.patch
new file mode 100644
index 000000000000..698b362a04d5
--- /dev/null
+++ b/45-gcc-4.1.2-bug-18989.patch
@@ -0,0 +1,15 @@
+--- gcc/config/avr/avr.h 2007/04/25 18:45:39 124161
++++ gcc/config/avr/avr.h 2007/04/25 18:52:21 124162
+@@ -690,7 +690,11 @@
+ #define ASM_OUTPUT_SKIP(STREAM, N) \
+ fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
+
+-#define ASM_OUTPUT_ALIGN(STREAM, POWER)
++#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
++ do { \
++ if ((POWER) > 1) \
++ fprintf (STREAM, "\t.p2align\t%d\n", POWER); \
++ } while (0)
+
+ #define CASE_VECTOR_MODE HImode
+
diff --git a/46-gcc-4.1.2-bug-30483.patch b/46-gcc-4.1.2-bug-30483.patch
new file mode 100644
index 000000000000..a41825bb30ac
--- /dev/null
+++ b/46-gcc-4.1.2-bug-30483.patch
@@ -0,0 +1,21 @@
+2007-04-14 Anatoly Sokolov <aesok@post.ru>
+
+ PR target/30483
+ * config/avr/avr.c (ptrreg_to_str): Replace gcc_unreachable() with
+ error().
+
+
+Index: gcc/config/avr/avr.c
+===================================================================
+--- gcc/config/avr/avr.c (revision 123920)
++++ gcc/config/avr/avr.c (working copy)
+@@ -1041,7 +1044,7 @@
+ case REG_Y: return "Y";
+ case REG_Z: return "Z";
+ default:
+- gcc_unreachable ();
++ error ("address operand requires constraint for X, Y, or Z register");
+ }
+ return NULL;
+ }
+
diff --git a/50-gcc-4.1.2-newdevices.patch b/50-gcc-4.1.2-newdevices.patch
new file mode 100644
index 000000000000..32a3f677317e
--- /dev/null
+++ b/50-gcc-4.1.2-newdevices.patch
@@ -0,0 +1,307 @@
+--- gcc/config/avr/avr.c.orig Thu Jul 28 00:29:46 2005
++++ gcc/config/avr/avr.c Mon May 14 07:18:20 2007
+@@ -169,10 +169,19 @@
+ { "at90s8515", 2, "__AVR_AT90S8515__" },
+ { "at90c8534", 2, "__AVR_AT90C8534__" },
+ { "at90s8535", 2, "__AVR_AT90S8535__" },
+- { "at86rf401", 2, "__AVR_AT86RF401__" },
+ /* Classic + MOVW, <= 8K. */
+ { "attiny13", 2, "__AVR_ATtiny13__" },
+ { "attiny2313", 2, "__AVR_ATtiny2313__" },
++ { "attiny24", 2, "__AVR_ATtiny24__" },
++ { "attiny44", 2, "__AVR_ATtiny44__" },
++ { "attiny84", 2, "__AVR_ATtiny84__" },
++ { "attiny25", 2, "__AVR_ATtiny25__" },
++ { "attiny45", 2, "__AVR_ATtiny45__" },
++ { "attiny85", 2, "__AVR_ATtiny85__" },
++ { "attiny261", 2, "__AVR_ATtiny261__" },
++ { "attiny461", 2, "__AVR_ATtiny461__" },
++ { "attiny861", 2, "__AVR_ATtiny861__" },
++ { "at86rf401", 2, "__AVR_AT86RF401__" },
+ /* Classic, > 8K. */
+ { "avr3", 3, NULL },
+ { "atmega103", 3, "__AVR_ATmega103__" },
+@@ -187,24 +196,55 @@
+ { "atmega88", 4, "__AVR_ATmega88__" },
+ { "atmega8515", 4, "__AVR_ATmega8515__" },
+ { "atmega8535", 4, "__AVR_ATmega8535__" },
++ { "atmega8hva", 4, "__AVR_ATmega8HVA__" },
++ { "at90pwm1", 4, "__AVR_AT90PWM1__" },
++ { "at90pwm2", 4, "__AVR_AT90PWM2__" },
++ { "at90pwm3", 4, "__AVR_AT90PWM3__" },
+ /* Enhanced, > 8K. */
+ { "avr5", 5, NULL },
+ { "atmega16", 5, "__AVR_ATmega16__" },
+ { "atmega161", 5, "__AVR_ATmega161__" },
+ { "atmega162", 5, "__AVR_ATmega162__" },
+ { "atmega163", 5, "__AVR_ATmega163__" },
++ { "atmega164p",5, "__AVR_ATmega164P__" },
+ { "atmega165", 5, "__AVR_ATmega165__" },
++ { "atmega165p",5, "__AVR_ATmega165P__" },
+ { "atmega168", 5, "__AVR_ATmega168__" },
+ { "atmega169", 5, "__AVR_ATmega169__" },
++ { "atmega169p",5, "__AVR_ATmega169P__" },
+ { "atmega32", 5, "__AVR_ATmega32__" },
+ { "atmega323", 5, "__AVR_ATmega323__" },
++ { "atmega324p",5, "__AVR_ATmega324P__" },
+ { "atmega325", 5, "__AVR_ATmega325__" },
++ { "atmega325p", 5, "__AVR_ATmega325P__" },
+ { "atmega3250", 5, "__AVR_ATmega3250__" },
++ { "atmega3250p", 5, "__AVR_ATmega3250P__" },
++ { "atmega329", 5, "__AVR_ATmega329__" },
++ { "atmega329p", 5, "__AVR_ATmega329P__" },
++ { "atmega3290", 5, "__AVR_ATmega3290__" },
++ { "atmega3290p", 5, "__AVR_ATmega3290P__" },
++ { "atmega406", 5, "__AVR_ATmega406__" },
+ { "atmega64", 5, "__AVR_ATmega64__" },
++ { "atmega640", 5, "__AVR_ATmega640__" },
++ { "atmega644", 5, "__AVR_ATmega644__" },
++ { "atmega644p",5, "__AVR_ATmega644P__" },
+ { "atmega645", 5, "__AVR_ATmega645__" },
+ { "atmega6450", 5, "__AVR_ATmega6450__" },
++ { "atmega649", 5, "__AVR_ATmega649__" },
++ { "atmega6490", 5, "__AVR_ATmega6490__" },
+ { "atmega128", 5, "__AVR_ATmega128__" },
++ { "atmega1280",5, "__AVR_ATmega1280__" },
++ { "atmega1281",5, "__AVR_ATmega1281__" },
++ { "atmega16hva",5, "__AVR_ATmega16HVA__" },
++ { "at90can32", 5, "__AVR_AT90CAN32__" },
++ { "at90can64", 5, "__AVR_AT90CAN64__" },
++ { "at90usb82", 5, "__AVR_AT90USB82__" },
+ { "at90can128", 5, "__AVR_AT90CAN128__" },
++ { "at90usb162", 5, "__AVR_AT90USB162__" },
++ { "at90usb646", 5, "__AVR_AT90USB646__" },
++ { "at90usb647", 5, "__AVR_AT90USB647__" },
++ { "at90usb1286", 5, "__AVR_AT90USB1286__" },
++ { "at90usb1287", 5, "__AVR_AT90USB1287__" },
+ { "at94k", 5, "__AVR_AT94K__" },
+ /* Assembler only. */
+ { "avr1", 1, NULL },
+--- gcc/config/avr/t-avr.orig Wed Apr 6 07:34:30 2005
++++ gcc/config/avr/t-avr Mon May 14 07:16:32 2007
+@@ -42,21 +42,64 @@
+
+ # The many avr2 matches are not listed here - this is the default.
+ MULTILIB_MATCHES = \
+- mmcu?avr3=mmcu?atmega103 mmcu?avr3=mmcu?atmega603 \
+- mmcu?avr3=mmcu?at43usb320 mmcu?avr3=mmcu?at43usb355 \
++ mmcu?avr3=mmcu?atmega103 \
++ mmcu?avr3=mmcu?atmega603 \
++ mmcu?avr3=mmcu?at43usb320 \
++ mmcu?avr3=mmcu?at43usb355 \
+ mmcu?avr3=mmcu?at76c711 \
+- mmcu?avr4=mmcu?atmega8515 mmcu?avr4=mmcu?atmega8535 \
+- mmcu?avr4=mmcu?atmega8 mmcu?avr4=mmcu?atmega48 \
++ mmcu?avr4=mmcu?atmega48 \
++ mmcu?avr4=mmcu?atmega8 \
++ mmcu?avr4=mmcu?atmega8515 \
++ mmcu?avr4=mmcu?atmega8535 \
+ mmcu?avr4=mmcu?atmega88 \
+- mmcu?avr5=mmcu?atmega161 mmcu?avr5=mmcu?atmega162 \
+- mmcu?avr5=mmcu?atmega163 mmcu?avr5=mmcu?atmega169 \
+- mmcu?avr5=mmcu?atmega16 mmcu?avr5=mmcu?atmega168 \
++ mmcu?avr4=mmcu?atmega8hva \
++ mmcu?avr4=mmcu?at90pwm1 \
++ mmcu?avr4=mmcu?at90pwm2 \
++ mmcu?avr4=mmcu?at90pwm3 \
++ mmcu?avr4=mmcu?at90usb82 \
++ mmcu?avr5=mmcu?atmega16 \
++ mmcu?avr5=mmcu?atmega161 \
++ mmcu?avr5=mmcu?atmega162 \
++ mmcu?avr5=mmcu?atmega163 \
++ mmcu?avr5=mmcu?atmega164p \
+ mmcu?avr5=mmcu?atmega165 \
+- mmcu?avr5=mmcu?atmega323 mmcu?avr5=mmcu?atmega32 \
+- mmcu?avr5=mmcu?atmega325 mmcu?avr5=mmcu?atmega3250 \
+- mmcu?avr5=mmcu?atmega64 mmcu?avr5=mmcu?atmega128 \
+- mmcu?avr5=mmcu?atmega645 mmcu?avr5=mmcu?atmega6450 \
+- mmcu?avr5=mmcu?at94k mmcu?avr5=mmcu?at90can128
++ mmcu?avr5=mmcu?atmega165p \
++ mmcu?avr5=mmcu?atmega168 \
++ mmcu?avr5=mmcu?atmega169 \
++ mmcu?avr5=mmcu?atmega169p \
++ mmcu?avr5=mmcu?atmega32 \
++ mmcu?avr5=mmcu?atmega323 \
++ mmcu?avr5=mmcu?atmega324p \
++ mmcu?avr5=mmcu?atmega325 \
++ mmcu?avr5=mmcu?atmega325p \
++ mmcu?avr5=mmcu?atmega3250 \
++ mmcu?avr5=mmcu?atmega3250p \
++ mmcu?avr5=mmcu?atmega329 \
++ mmcu?avr5=mmcu?atmega329p \
++ mmcu?avr5=mmcu?atmega3290 \
++ mmcu?avr5=mmcu?atmega3290p \
++ mmcu?avr5=mmcu?atmega406 \
++ mmcu?avr5=mmcu?atmega64 \
++ mmcu?avr5=mmcu?atmega640 \
++ mmcu?avr5=mmcu?atmega644 \
++ mmcu?avr5=mmcu?atmega644p \
++ mmcu?avr5=mmcu?atmega645 \
++ mmcu?avr5=mmcu?atmega6450 \
++ mmcu?avr5=mmcu?atmega649 \
++ mmcu?avr5=mmcu?atmega6490 \
++ mmcu?avr5=mmcu?atmega128 \
++ mmcu?avr5=mmcu?atmega1280 \
++ mmcu?avr5=mmcu?atmega1281 \
++ mmcu?avr5=mmcu?atmega16hva \
++ mmcu?avr5=mmcu?at90can32 \
++ mmcu?avr5=mmcu?at90can64 \
++ mmcu?avr5=mmcu?at90can128 \
++ mmcu?avr5=mmcu?at90usb162 \
++ mmcu?avr5=mmcu?at90usb646 \
++ mmcu?avr5=mmcu?at90usb647 \
++ mmcu?avr5=mmcu?at90usb1286 \
++ mmcu?avr5=mmcu?at90usb1287 \
++ mmcu?avr5=mmcu?at94k
+
+ MULTILIB_EXCEPTIONS =
+
+--- gcc/config/avr/avr.h.orig Mon May 14 07:12:25 2007
++++ gcc/config/avr/avr.h Mon May 14 07:15:46 2007
+@@ -763,12 +763,69 @@
+ #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
+
+ #define LINK_SPEC " %{!mmcu*:-m avr2}\
+-%{mmcu=at90s1200|mmcu=attiny11|mmcu=attiny12|mmcu=attiny15|mmcu=attiny28:-m avr1} \
+-%{mmcu=attiny22|mmcu=attiny26|mmcu=at90s2*|mmcu=at90s4*|mmcu=at90s8*|mmcu=at90c8*|mmcu=at86rf401|mmcu=attiny13|mmcu=attiny2313:-m avr2}\
+-%{mmcu=atmega103|mmcu=atmega603|mmcu=at43*|mmcu=at76*:-m avr3}\
+-%{mmcu=atmega8*|mmcu=atmega48:-m avr4}\
+-%{mmcu=atmega16*|mmcu=atmega32*|mmcu=atmega64*|mmcu=atmega128|mmcu=at90can128|mmcu=at94k:-m avr5}\
+-%{mmcu=atmega325|mmcu=atmega3250|mmcu=atmega48|mmcu=atmega88|mmcu=atmega64|mmcu=atmega645|mmcu=atmega6450|mmcu=atmega128|mmcu=at90can128|mmcu=at90can128|mmcu=atmega162|mmcu=atmega165|mmcu=atmega168|mmcu=atmega169: -Tdata 0x800100} "
++%{mmcu=at90s1200|\
++ mmcu=attiny11|\
++ mmcu=attiny12|\
++ mmcu=attiny15|\
++ mmcu=attiny28:-m avr1}\
++%{mmcu=attiny22|\
++ mmcu=attiny26|\
++ mmcu=at90s2*|\
++ mmcu=at90s4*|\
++ mmcu=at90s8*|\
++ mmcu=at90c8*|\
++ mmcu=at86rf401|\
++ mmcu=attiny13|\
++ mmcu=attiny2313|\
++ mmcu=attiny24|\
++ mmcu=attiny25|\
++ mmcu=attiny261|\
++ mmcu=attiny4*|\
++ mmcu=attiny8*:-m avr2}\
++%{mmcu=atmega103|\
++ mmcu=atmega603|\
++ mmcu=at43*|\
++ mmcu=at76*:-m avr3}\
++%{mmcu=atmega8*|\
++ mmcu=atmega48|\
++ mmcu=at90pwm*|\
++ mmcu=at90usb82:-m avr4}\
++%{mmcu=atmega16*|\
++ mmcu=atmega32*|\
++ mmcu=atmega406|\
++ mmcu=atmega64*|\
++ mmcu=atmega128*|\
++ mmcu=at90can*|\
++ mmcu=at90usb162|\
++ mmcu=at90usb64*|\
++ mmcu=at90usb128*|\
++ mmcu=at94k:-m avr5}\
++%{mmcu=atmega324*|\
++ mmcu=atmega325*|\
++ mmcu=atmega329*|\
++ mmcu=atmega406|\
++ mmcu=atmega48|\
++ mmcu=atmega88|\
++ mmcu=atmega64|\
++ mmcu=atmega644*|\
++ mmcu=atmega645|\
++ mmcu=atmega6450|\
++ mmcu=atmega649|\
++ mmcu=atmega6490|\
++ mmcu=atmega128|\
++ mmcu=atmega162|\
++ mmcu=atmega164*|\
++ mmcu=atmega165*|\
++ mmcu=atmega168|\
++ mmcu=atmega169*|\
++ mmcu=atmega8hva|\
++ mmcu=atmega16hva|\
++ mmcu=at90can*|\
++ mmcu=at90pwm*|\
++ mmcu=at90usb*: -Tdata 0x800100}\
++%{mmcu=atmega640|\
++ mmcu=atmega1280|\
++ mmcu=atmega1281: -Tdata 0x800200} "
+
+ #define LIB_SPEC \
+ "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
+@@ -804,6 +861,15 @@
+ %{mmcu=at86rf401:crt86401.o%s} \
+ %{mmcu=attiny13:crttn13.o%s} \
+ %{mmcu=attiny2313:crttn2313.o%s} \
++%{mmcu=attiny24:crttn24.o%s} \
++%{mmcu=attiny44:crttn44.o%s} \
++%{mmcu=attiny84:crttn84.o%s} \
++%{mmcu=attiny25:crttn25.o%s} \
++%{mmcu=attiny45:crttn45.o%s} \
++%{mmcu=attiny85:crttn85.o%s} \
++%{mmcu=attiny261:crttn261.o%s} \
++%{mmcu=attiny461:crttn461.o%s} \
++%{mmcu=attiny861:crttn861.o%s} \
+ %{mmcu=atmega103|mmcu=avr3:crtm103.o%s} \
+ %{mmcu=atmega603:crtm603.o%s} \
+ %{mmcu=at43usb320:crt43320.o%s} \
+@@ -814,22 +880,53 @@
+ %{mmcu=atmega88:crtm88.o%s} \
+ %{mmcu=atmega8515:crtm8515.o%s} \
+ %{mmcu=atmega8535:crtm8535.o%s} \
++%{mmcu=at90pwm1:crt90pwm1.o%s} \
++%{mmcu=at90pwm2:crt90pwm2.o%s} \
++%{mmcu=at90pwm3:crt90pwm3.o%s} \
+ %{mmcu=atmega16:crtm16.o%s} \
+ %{mmcu=atmega161|mmcu=avr5:crtm161.o%s} \
+ %{mmcu=atmega162:crtm162.o%s} \
+ %{mmcu=atmega163:crtm163.o%s} \
++%{mmcu=atmega164p:crtm164p.o%s} \
+ %{mmcu=atmega165:crtm165.o%s} \
++%{mmcu=atmega165p:crtm165p.o%s} \
+ %{mmcu=atmega168:crtm168.o%s} \
+ %{mmcu=atmega169:crtm169.o%s} \
++%{mmcu=atmega169p:crtm169p.o%s} \
+ %{mmcu=atmega32:crtm32.o%s} \
+ %{mmcu=atmega323:crtm323.o%s} \
++%{mmcu=atmega324p:crtm324p.o%s} \
+ %{mmcu=atmega325:crtm325.o%s} \
++%{mmcu=atmega325p:crtm325p.o%s} \
+ %{mmcu=atmega3250:crtm3250.o%s} \
++%{mmcu=atmega3250p:crtm3250p.o%s} \
++%{mmcu=atmega329:crtm329.o%s} \
++%{mmcu=atmega329p:crtm329p.o%s} \
++%{mmcu=atmega3290:crtm3290.o%s} \
++%{mmcu=atmega3290p:crtm3290p.o%s} \
++%{mmcu=atmega406:crtm406.o%s} \
+ %{mmcu=atmega64:crtm64.o%s} \
+-%{mmcu=atmega645:crtm6450.o%s} \
++%{mmcu=atmega640:crtm640.o%s} \
++%{mmcu=atmega644:crtm644.o%s} \
++%{mmcu=atmega644p:crtm644p.o%s} \
++%{mmcu=atmega645:crtm645.o%s} \
+ %{mmcu=atmega6450:crtm6450.o%s} \
++%{mmcu=atmega649:crtm649.o%s} \
++%{mmcu=atmega6490:crtm6490.o%s} \
+ %{mmcu=atmega128:crtm128.o%s} \
++%{mmcu=atmega1280:crtm1280.o%s} \
++%{mmcu=atmega1281:crtm1281.o%s} \
++%{mmcu=atmega8hva:crtm8hva.o%s} \
++%{mmcu=atmega16hva:crtm16hva.o%s} \
++%{mmcu=at90can32:crtcan32.o%s} \
++%{mmcu=at90can64:crtcan64.o%s} \
+ %{mmcu=at90can128:crtcan128.o%s} \
++%{mmcu=at90usb82:crtusb82.o%s} \
++%{mmcu=at90usb162:crtusb162.o%s} \
++%{mmcu=at90usb646:crtusb646.o%s} \
++%{mmcu=at90usb647:crtusb647.o%s} \
++%{mmcu=at90usb1286:crtusb1286.o%s} \
++%{mmcu=at90usb1287:crtusb1287.o%s} \
+ %{mmcu=at94k:crtat94k.o%s}"
+
+ #define EXTRA_SPECS {"crt_binutils", CRT_BINUTILS_SPECS},
diff --git a/51-gcc-4.1.2-atmega256x.patch b/51-gcc-4.1.2-atmega256x.patch
new file mode 100644
index 000000000000..f4af252afa38
--- /dev/null
+++ b/51-gcc-4.1.2-atmega256x.patch
@@ -0,0 +1,499 @@
+diff -ur gcc/config/avr/avr.c gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c 2006-09-07 20:19:07.276183419 +0200
++++ gcc/config/avr/avr.c 2006-09-07 20:49:56.268363803 +0200
+@@ -123,20 +123,26 @@
+ /* Assembler only. */
+ int avr_asm_only_p = 0;
+
++/* Usually holds the value 2, but could be 3 for the larger devices with a
++ 3-byte program counter. */
++int avr_pc_size = 2;
++
+ struct base_arch_s {
+ int asm_only;
+ int enhanced;
+ int mega;
++ int three_byte_pc;
+ const char *const macro;
+ };
+
+ static const struct base_arch_s avr_arch_types[] = {
+- { 1, 0, 0, NULL }, /* unknown device specified */
+- { 1, 0, 0, "__AVR_ARCH__=1" },
+- { 0, 0, 0, "__AVR_ARCH__=2" },
+- { 0, 0, 1, "__AVR_ARCH__=3" },
+- { 0, 1, 0, "__AVR_ARCH__=4" },
+- { 0, 1, 1, "__AVR_ARCH__=5" }
++ { 1, 0, 0, 0, NULL }, /* unknown device specified */
++ { 1, 0, 0, 0, "__AVR_ARCH__=1" },
++ { 0, 0, 0, 0, "__AVR_ARCH__=2" },
++ { 0, 0, 1, 0, "__AVR_ARCH__=3" },
++ { 0, 1, 0, 0, "__AVR_ARCH__=4" },
++ { 0, 1, 1, 0, "__AVR_ARCH__=5" },
++ { 0, 1, 1, 1, "__AVR_ARCH__=6" }
+ };
+
+ struct mcu_type_s {
+@@ -237,6 +243,10 @@
+ { "at90usb1286", 5, "__AVR_AT90USB1286__" },
+ { "at90usb1287", 5, "__AVR_AT90USB1287__" },
+ { "at94k", 5, "__AVR_AT94K__" },
++ /* 3-Byte PC */
++ { "avr6", 6, NULL },
++ { "atmega2560", 6, "__AVR_ATmega2560__" },
++ { "atmega2561", 6, "__AVR_ATmega2561__" },
+ /* Assembler only. */
+ { "avr1", 1, NULL },
+ { "at90s1200", 1, "__AVR_AT90S1200__" },
+@@ -319,6 +329,11 @@
+ avr_base_arch_macro = base->macro;
+ avr_extra_arch_macro = t->macro;
+
++ if (base->three_byte_pc)
++ avr_pc_size = 3;
++ else
++ avr_pc_size = 2;
++
+ if (optimize && !TARGET_NO_TABLEJUMP)
+ avr_case_values_threshold = (!AVR_MEGA || TARGET_CALL_PROLOGUES) ? 8 : 17;
+
+@@ -476,7 +491,7 @@
+ int offset = frame_pointer_needed ? 2 : 0;
+
+ offset += avr_regs_to_save (NULL);
+- return get_frame_size () + 2 + 1 + offset;
++ return get_frame_size () + (avr_pc_size) + 1 + offset;
+ }
+ }
+
+@@ -660,7 +675,6 @@
+ int reg;
+ int interrupt_func_p;
+ int signal_func_p;
+- int main_p;
+ int live_seq;
+ int minimize;
+
+@@ -678,7 +692,6 @@
+
+ interrupt_func_p = interrupt_function_p (current_function_decl);
+ signal_func_p = signal_function_p (current_function_decl);
+- main_p = MAIN_NAME_P (DECL_NAME (current_function_decl));
+ live_seq = sequent_regs_live ();
+ minimize = (TARGET_CALL_PROLOGUES
+ && !interrupt_func_p && !signal_func_p && live_seq);
+@@ -698,25 +711,14 @@
+ AS1 (clr,__zero_reg__) "\n");
+ prologue_size += 5;
+ }
+- if (main_p)
+- {
+- fprintf (file, ("\t"
+- AS1 (ldi,r28) ",lo8(%s - " HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
+- AS1 (ldi,r29) ",hi8(%s - " HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
+- AS2 (out,__SP_H__,r29) CR_TAB
+- AS2 (out,__SP_L__,r28) "\n"),
+- avr_init_stack, size, avr_init_stack, size);
+-
+- prologue_size += 4;
+- }
+- else if (minimize && (frame_pointer_needed || live_seq > 6))
++ if (minimize && (frame_pointer_needed || live_seq > 6))
+ {
+ fprintf (file, ("\t"
+ AS1 (ldi, r26) ",lo8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
+ AS1 (ldi, r27) ",hi8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB), size, size);
+
+- fputs ((AS2 (ldi,r30,pm_lo8(1f)) CR_TAB
+- AS2 (ldi,r31,pm_hi8(1f)) CR_TAB), file);
++ fputs ((AS2 (ldi,r30,lo8(gs(1f))) CR_TAB
++ AS2 (ldi,r31,hi8(gs(1f))) CR_TAB), file);
+
+ prologue_size += 4;
+
+@@ -787,7 +789,6 @@
+ int reg;
+ int interrupt_func_p;
+ int signal_func_p;
+- int main_p;
+ int function_size;
+ int live_seq;
+ int minimize;
+@@ -819,27 +820,12 @@
+
+ interrupt_func_p = interrupt_function_p (current_function_decl);
+ signal_func_p = signal_function_p (current_function_decl);
+- main_p = MAIN_NAME_P (DECL_NAME (current_function_decl));
++
+ live_seq = sequent_regs_live ();
+ minimize = (TARGET_CALL_PROLOGUES
+ && !interrupt_func_p && !signal_func_p && live_seq);
+
+- if (main_p)
+- {
+- /* Return value from main() is already in the correct registers
+- (r25:r24) as the exit() argument. */
+- if (AVR_MEGA)
+- {
+- fputs ("\t" AS1 (jmp,exit) "\n", file);
+- epilogue_size += 2;
+- }
+- else
+- {
+- fputs ("\t" AS1 (rjmp,exit) "\n", file);
+- ++epilogue_size;
+- }
+- }
+- else if (minimize && (frame_pointer_needed || live_seq > 4))
++ if (minimize && (frame_pointer_needed || live_seq > 4))
+ {
+ fprintf (file, ("\t" AS2 (ldi, r30, %d) CR_TAB), live_seq);
+ ++epilogue_size;
+@@ -1097,7 +1083,7 @@
+ && ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (addr))
+ || GET_CODE (addr) == LABEL_REF))
+ {
+- fprintf (file, "pm(");
++ fprintf (file, "gs(");
+ output_addr_const (file,addr);
+ fprintf (file ,")");
+ }
+@@ -4518,7 +4504,7 @@
+ && ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (x))
+ || GET_CODE (x) == LABEL_REF))
+ {
+- fputs ("\t.word\tpm(", asm_out_file);
++ fputs ("\t.word\tgs(", asm_out_file);
+ output_addr_const (asm_out_file, x);
+ fputs (")\n", asm_out_file);
+ return true;
+@@ -5880,7 +5866,7 @@
+ {
+ progmem_section ();
+ if (AVR_MEGA)
+- fprintf (stream, "\t.word pm(.L%d)\n", value);
++ fprintf (stream, "\t.word gs(.L%d)\n", value);
+ else
+ fprintf (stream, "\trjmp .L%d\n", value);
+
+diff -ur gcc/config/avr/avr.h gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.h
+--- gcc/config/avr/avr.h 2006-09-07 20:19:07.304181348 +0200
++++ gcc/config/avr/avr.h 2006-09-07 20:49:56.277363137 +0200
+@@ -33,6 +33,10 @@
+ builtin_define (avr_extra_arch_macro); \
+ if (avr_asm_only_p) \
+ builtin_define ("__AVR_ASM_ONLY__"); \
++ if (avr_pc_size == 2) \
++ builtin_define ("__AVR_2_BYTE_PC__"); \
++ if (avr_pc_size == 3) \
++ builtin_define ("__AVR_3_BYTE_PC__"); \
+ if (avr_enhanced_p) \
+ builtin_define ("__AVR_ENHANCED__"); \
+ if (avr_mega_p) \
+@@ -47,10 +51,14 @@
+ extern int avr_mega_p;
+ extern int avr_enhanced_p;
+ extern int avr_asm_only_p;
++extern int avr_pc_size;
+
+ #define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
+ #define AVR_ENHANCED (avr_enhanced_p)
+
++#define AVR_3_BYTE_PC (avr_pc_size == 3)
++#define AVR_2_BYTE_PC (avr_pc_size == 2)
++
+ #define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
+
+ #define OVERRIDE_OPTIONS avr_override_options ()
+@@ -747,12 +755,13 @@
+
+ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+
+-#define CC1_SPEC "%{profile:-p}"
++#define CC1_SPEC "%{profile:-p} -fno-delete-null-pointer-checks"
+
+ #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
+ %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
+- %{!fexceptions:-fno-exceptions}"
+-/* A C string constant that tells the GCC drvier program options to
++ %{!fexceptions:-fno-exceptions} \
++ -fno-delete-null-pointer-checks"
++/* A C string constant that tells the GCC driver program options to
+ pass to `cc1plus'. */
+
+ #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
+@@ -793,6 +802,7 @@
+ mmcu=at90can*|\
+ mmcu=at90usb*|\
+ mmcu=at94k:-m avr5}\
++%{mmcu=atmega256*:-m avr6}\
+ %{mmcu=atmega324*|\
+ mmcu=atmega325|\
+ mmcu=atmega3250|\
+@@ -818,7 +828,8 @@
+ mmcu=at90usb*: -Tdata 0x800100}\
+ %{mmcu=atmega640|\
+ mmcu=atmega1280|\
+- mmcu=atmega1281: -Tdata 0x800200} "
++ mmcu=atmega1281|\
++ mmcu=atmega256*: -Tdata 0x800200} "
+
+ #define LIB_SPEC \
+ "%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
+@@ -904,6 +915,8 @@
+ %{mmcu=atmega1281:crtm1281.o%s} \
+ %{mmcu=atmega8hva:crtm8hva.o%s} \
+ %{mmcu=atmega16hva:crtm16hva.o%s} \
++%{mmcu=atmega2560:crtm2560.o%s} \
++%{mmcu=atmega2561:crtm2561.o%s} \
+ %{mmcu=at90can32:crtcan32.o%s} \
+ %{mmcu=at90can64:crtcan64.o%s} \
+ %{mmcu=at90can128:crtcan128.o%s} \
+diff -ur gcc/config/avr/avr.md gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.md
+--- gcc/config/avr/avr.md 2005-06-28 21:56:23.000000000 +0200
++++ gcc/config/avr/avr.md 2006-09-07 20:49:56.246365431 +0200
+@@ -2087,22 +2087,47 @@
+ "(register_operand (operands[0], HImode) || CONSTANT_P (operands[0]))"
+ "*{
+ if (which_alternative==0)
+- return \"icall\";
++ {
++ if (AVR_3_BYTE_PC)
++ return \"eicall\";
++ else
++ return \"icall\";
++ }
+ else if (which_alternative==1)
+ {
+ if (AVR_ENHANCED)
+- return (AS2 (movw, r30, %0) CR_TAB
+- \"icall\");
++ {
++ if (AVR_3_BYTE_PC)
++ return (AS2 (movw, r30, %0) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (movw, r30, %0) CR_TAB
++ \"icall\");
++ }
+ else
+- return (AS2 (mov, r30, %A0) CR_TAB
+- AS2 (mov, r31, %B0) CR_TAB
+- \"icall\");
++ {
++ if (AVR_3_BYTE_PC)
++ return (AS2 (mov, r30, %A0) CR_TAB
++ AS2 (mov, r31, %B0) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (mov, r30, %A0) CR_TAB
++ AS2 (mov, r31, %B0) CR_TAB
++ \"icall\");
++ }
+ }
+ else if (which_alternative==2)
+ return AS1(%~call,%c0);
+- return (AS2 (ldi,r30,lo8(%0)) CR_TAB
+- AS2 (ldi,r31,hi8(%0)) CR_TAB
+- \"icall\");
++
++
++ if (AVR_3_BYTE_PC)
++ return (AS2 (ldi,r30,lo8(%0)) CR_TAB
++ AS2 (ldi,r31,hi8(%0)) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (ldi,r30,lo8(%0)) CR_TAB
++ AS2 (ldi,r31,hi8(%0)) CR_TAB
++ \"icall\");
+ }"
+ [(set_attr "cc" "clobber,clobber,clobber,clobber")
+ (set_attr_alternative "length"
+@@ -2124,22 +2149,46 @@
+ "(register_operand (operands[0], VOIDmode) || CONSTANT_P (operands[0]))"
+ "*{
+ if (which_alternative==0)
+- return \"icall\";
++ {
++ if (AVR_3_BYTE_PC)
++ return \"eicall\";
++ else
++ return \"icall\";
++ }
+ else if (which_alternative==1)
+ {
+ if (AVR_ENHANCED)
+- return (AS2 (movw, r30, %1) CR_TAB
+- \"icall\");
++ {
++ if (AVR_3_BYTE_PC)
++ return (AS2 (movw, r30, %1) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (movw, r30, %1) CR_TAB
++ \"icall\");
++ }
+ else
+- return (AS2 (mov, r30, %A1) CR_TAB
+- AS2 (mov, r31, %B1) CR_TAB
+- \"icall\");
++ {
++ if (AVR_3_BYTE_PC)
++ return (AS2 (mov, r30, %A1) CR_TAB
++ AS2 (mov, r31, %B1) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (mov, r30, %A1) CR_TAB
++ AS2 (mov, r31, %B1) CR_TAB
++ \"icall\");
++ }
+ }
+ else if (which_alternative==2)
+ return AS1(%~call,%c1);
+- return (AS2 (ldi, r30, lo8(%1)) CR_TAB
+- AS2 (ldi, r31, hi8(%1)) CR_TAB
+- \"icall\");
++
++ if (AVR_3_BYTE_PC)
++ return (AS2 (ldi, r30, lo8(%1)) CR_TAB
++ AS2 (ldi, r31, hi8(%1)) CR_TAB
++ \"eicall\");
++ else
++ return (AS2 (ldi, r30, lo8(%1)) CR_TAB
++ AS2 (ldi, r31, hi8(%1)) CR_TAB
++ \"icall\");
+ }"
+ [(set_attr "cc" "clobber,clobber,clobber,clobber")
+ (set_attr_alternative "length"
+@@ -2169,13 +2218,20 @@
+ ; indirect jump
+ (define_insn "indirect_jump"
+ [(set (pc) (match_operand:HI 0 "register_operand" "!z,*r"))]
+- ""
++ "AVR_2_BYTE_PC"
+ "@
+ ijmp
+ push %A0\;push %B0\;ret"
+ [(set_attr "length" "1,3")
+ (set_attr "cc" "none,none")])
+
++(define_insn "*indirect_jump_avr6"
++ [(set (pc) (match_operand:HI 0 "register_operand" "z"))]
++ "AVR_3_BYTE_PC"
++ "eijmp"
++ [(set_attr "length" "1")
++ (set_attr "cc" "none")])
++
+ ;; table jump
+
+ ;; Table made from "rjmp" instructions for <=8K devices.
+@@ -2183,7 +2239,7 @@
+ [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r")] 1))
+ (use (label_ref (match_operand 1 "" "")))
+ (clobber (match_dup 0))]
+- "!AVR_MEGA"
++ "(!AVR_MEGA) && (AVR_2_BYTE_PC)"
+ "@
+ ijmp
+ push %A0\;push %B0\;ret"
+@@ -2200,11 +2256,26 @@
+ [(set_attr "length" "2")
+ (set_attr "cc" "clobber")])
+
++(define_insn "*tablejump_avr6"
++ [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")]
++ 1))
++ (use (label_ref (match_operand 1 "" "")))
++ (clobber (match_dup 0))]
++ "AVR_MEGA && AVR_ENHANCED && AVR_3_BYTE_PC"
++ "lsl r30
++ rol r31
++ lpm __tmp_reg__,Z+
++ lpm r31,Z
++ mov r30,__tmp_reg__
++ eijmp"
++ [(set_attr "length" "6")
++ (set_attr "cc" "clobber")])
++
+ (define_insn "*tablejump_enh"
+ [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
+ (use (label_ref (match_operand 1 "" "")))
+ (clobber (match_dup 0))]
+- "AVR_MEGA && AVR_ENHANCED"
++ "AVR_MEGA && AVR_ENHANCED && AVR_2_BYTE_PC"
+ "lsl r30
+ rol r31
+ lpm __tmp_reg__,Z+
+@@ -2218,7 +2289,7 @@
+ [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
+ (use (label_ref (match_operand 1 "" "")))
+ (clobber (match_dup 0))]
+- "AVR_MEGA"
++ "AVR_MEGA && AVR_2_BYTE_PC"
+ "lsl r30
+ rol r31
+ lpm
+diff -ur gcc/config/avr/libgcc.S gcc-4.1.1-new-devices-m256/gcc/config/avr/libgcc.S
+--- gcc/config/avr/libgcc.S 2005-06-25 03:22:41.000000000 +0200
++++ gcc/config/avr/libgcc.S 2006-09-07 20:49:56.232366466 +0200
+@@ -593,7 +593,12 @@
+ out __SP_H__,r29
+ out __SREG__,__tmp_reg__
+ out __SP_L__,r28
++#if defined (__AVR_3_BYTE_PC__)
++ eijmp
++#else
+ ijmp
++#endif
++
+ .endfunc
+ #endif /* defined (L_prologue) */
+
+@@ -672,13 +677,22 @@
+ lpm __tmp_reg__, Z+
+ lpm r31, Z
+ mov r30, __tmp_reg__
++
++#if defined (__AVR_3_BYTE_PC__)
++ eijmp
++#else
+ ijmp
++#endif
++
+ #else
+ lpm
+ adiw r30, 1
+ push r0
+ lpm
+ push r0
++#if defined (__AVR_3_BYTE_PC__)
++ push __zero_reg__
++#endif
+ ret
+ #endif
+ .endfunc
+diff -ur gcc/config/avr/t-avr gcc-4.1.1-new-devices-m256/gcc/config/avr/t-avr
+--- gcc/config/avr/t-avr 2006-09-07 20:19:07.299181718 +0200
++++ gcc/config/avr/t-avr 2006-09-07 20:49:56.273363433 +0200
+@@ -37,8 +37,8 @@
+
+ FPBIT = fp-bit.c
+
+-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr3/mmcu=avr4/mmcu=avr5
+-MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5
++MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr3/mmcu=avr4/mmcu=avr5/mmcu=avr6
++MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5 avr6
+
+ # The many avr2 matches are not listed here - this is the default.
+ MULTILIB_MATCHES = \
+@@ -90,7 +90,9 @@
+ mmcu?avr5=mmcu?at90usb647 \
+ mmcu?avr5=mmcu?at90usb1286 \
+ mmcu?avr5=mmcu?at90usb1287 \
+- mmcu?avr5=mmcu?at94k
++ mmcu?avr5=mmcu?at94k \
++ mmcu?avr6=mmcu?atmega2560 \
++ mmcu?avr6=mmcu?atmega2561
+
+ MULTILIB_EXCEPTIONS =
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..1f095385e20b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,116 @@
+# Maintainer: ABDULLATIF Mouhamadi <bourou01dev@gmail.com>
+
+pkgname=gcc-avr-tinyos
+pkgver=4.1.2
+pkgrel=1
+pkgdesc="The GNU avr Compiler Collection with TinyOS patches"
+arch=('i686' 'x86_64')
+license=('GPL' 'LGPL' 'custom')
+url="http://gcc.gnu.org/"
+depends=('binutils-avr-tinyos' 'gcc-libs' 'libmpc')
+provides=('gcc-avr')
+options=('staticlibs' '!ccache' '!distcc' '!emptydirs' '!libtool' '!strip')
+source=("http://ftp.gnu.org/gnu/gcc/gcc-${pkgver}/gcc-${pkgver}.tar.bz2"
+ "10-gcc-4.1.2-c-incpath.patch"
+ "11-gcc-4.1.2-exec-prefix.patch"
+ "20-gcc-4.1.2-libiberty-Makefile.in.patch"
+ "30-gcc-4.1.2-binary-constants.patch"
+ "31-gcc-4.1.2-isr-alias.patch"
+ "40-gcc-4.1.2-bug-28902.patch"
+ "42-gcc-4.1.2-bug-31137.patch"
+ "43-gcc-4.1.2-bug-19087.patch"
+ "44-gcc-4.1.2-bug-30289.patch"
+ "45-gcc-4.1.2-bug-18989.patch"
+ "46-gcc-4.1.2-bug-30483.patch"
+ "50-gcc-4.1.2-newdevices.patch"
+ "51-gcc-4.1.2-atmega256x.patch"
+ "rfa1.patch")
+
+md5sums=('a4a3eb15c96030906d8494959eeda23c'
+ '61116f5b61b3bbec9af326fd3b460281'
+ 'a69568f43093e4fde729b562c46d5ba0'
+ '802a403cf49540df0e27c5aa8d00e749'
+ '97f3b27945783b93c9e681e5d874c056'
+ 'e70f0e54d7492f0e82813fe75764d356'
+ '2344927824632eaecb7176156b20c1c8'
+ '3442ea03c04e626088c51f31af3329cf'
+ '137de4bfd8b94c96ac546b8967964aa8'
+ 'c3835d0d0229c0b2fb14d097afe19a16'
+ 'e3e5916ce4a286e03ec6275035f19dfd'
+ '42a8f2a38f9570dba800a179b5d55b43'
+ '3f4fc9108b63ffa9ccda033ff139883a'
+ '5be152a40f9e27832590482f7cb5e5de'
+ 'f068e5b046bcf07715306f38b1e3c9a2')
+
+prepare() {
+
+ cd "${srcdir}/gcc-${pkgver}"
+
+ (cd "${srcdir}/gcc-${pkgver}" &&
+ patch -p0 < "${srcdir}/10-gcc-4.1.2-c-incpath.patch" &&
+ patch -p0 < "${srcdir}/11-gcc-4.1.2-exec-prefix.patch" &&
+ patch -p0 < "${srcdir}/20-gcc-4.1.2-libiberty-Makefile.in.patch" &&
+ patch -p0 < "${srcdir}/30-gcc-4.1.2-binary-constants.patch" &&
+ patch -p0 < "${srcdir}/31-gcc-4.1.2-isr-alias.patch" &&
+ patch -p0 < "${srcdir}/40-gcc-4.1.2-bug-28902.patch" &&
+ patch -p0 < "${srcdir}/42-gcc-4.1.2-bug-31137.patch" &&
+ patch -p0 < "${srcdir}/43-gcc-4.1.2-bug-19087.patch" &&
+ patch -p0 < "${srcdir}/44-gcc-4.1.2-bug-30289.patch" &&
+ patch -p0 < "${srcdir}/45-gcc-4.1.2-bug-18989.patch" &&
+ patch -p0 < "${srcdir}/46-gcc-4.1.2-bug-30483.patch" &&
+ patch -p0 < "${srcdir}/50-gcc-4.1.2-newdevices.patch" &&
+ patch -p0 < "${srcdir}/51-gcc-4.1.2-atmega256x.patch" &&
+ patch -p0 < "${srcdir}/rfa1.patch" &&
+ for patch in ${_patches[@]} ; do
+ msg "Applying ${patch}"
+ patch -p1 < "${srcdir}/${patch}"
+ done)
+
+ # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" - credits to jck
+
+ sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
+}
+
+build() {
+ export CFLAGS="-O2 -pipe"
+ export CXXFLAGS="-O2 -pipe"
+
+ # https://bugzilla.redhat.com/show_bug.cgi?id=476370
+ export CC="gcc -fgnu89-inline"
+ export CXX="g++ -fgnu89-inline"
+
+ cd "${srcdir}/gcc-${pkgver}"
+
+ export MAKEINFO=${srcdir}/usr/bin/makeinfo
+
+ mkdir build
+ cd build
+ ../configure --disable-libssp \
+ --disable-nls \
+ --enable-languages=c,c++ \
+ --infodir=/usr/share/info \
+ --libdir=/usr/lib \
+ --libexecdir=/usr/lib \
+ --mandir=/usr/share/man \
+ --prefix=/usr \
+ --target=avr \
+ --with-gnu-as \
+ --with-gnu-ld \
+ --with-as=/usr/bin/avr-as \
+ --with-ld=/usr/bin/avr-ld
+
+ make || return 1
+}
+
+package() {
+ cd ${srcdir}/gcc-${pkgver}
+
+ cd build
+ make -j1 DESTDIR=${pkgdir} install || return 1
+
+ rm -f ${pkgdir}/usr/lib/libiberty.a || return 1
+ rm -rf ${pkgdir}/usr/share/man/man7 || return 1
+ rm -rf ${pkgdir}/usr/share/info || return 1
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/rfa1.patch b/rfa1.patch
new file mode 100644
index 000000000000..4cd079c90cf1
--- /dev/null
+++ b/rfa1.patch
@@ -0,0 +1,41 @@
+diff -ruN gcc-orig/gcc/config/avr/avr.c gcc-4.1.2/gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c 2011-05-30 17:38:04.000000000 +0200
++++ gcc/config/avr/avr.c 2011-05-30 17:39:57.564303380 +0200
+@@ -241,6 +241,7 @@
+ { "atmega128", 5, "__AVR_ATmega128__" },
+ { "atmega1280",5, "__AVR_ATmega1280__" },
+ { "atmega1281",5, "__AVR_ATmega1281__" },
++ { "atmega128rfa1",5, "__AVR_ATmega128RFA1__" },
+ { "atmega16hva",5, "__AVR_ATmega16HVA__" },
+ { "at90can32", 5, "__AVR_AT90CAN32__" },
+ { "at90can64", 5, "__AVR_AT90CAN64__" },
+diff -ruN gcc-orig/gcc/config/avr/avr.h gcc-4.1.2/gcc/config/avr/avr.h
+--- gcc/config/avr/avr.h 2011-05-30 17:38:04.000000000 +0200
++++ gcc/config/avr/avr.h 2011-05-30 17:42:08.132880519 +0200
+@@ -842,6 +842,7 @@
+ %{mmcu=atmega640|\
+ mmcu=atmega1280|\
+ mmcu=atmega1281|\
++ mmcu=atmega128rfa1|\
+ mmcu=atmega256*: -Tdata 0x800200} "
+
+ #define LIB_SPEC \
+@@ -933,6 +934,7 @@
+ %{mmcu=atmega128:crtm128.o%s} \
+ %{mmcu=atmega1280:crtm1280.o%s} \
+ %{mmcu=atmega1281:crtm1281.o%s} \
++%{mmcu=atmega128rfa1:crtm128rfa1.o%s} \
+ %{mmcu=atmega8hva:crtm8hva.o%s} \
+ %{mmcu=atmega16hva:crtm16hva.o%s} \
+ %{mmcu=atmega2560:crtm2560.o%s} \
+diff -ruN gcc-orig/gcc/config/avr/t-avr gcc-4.1.2/gcc/config/avr/t-avr
+--- gcc/config/avr/t-avr 2011-05-30 17:38:04.000000000 +0200
++++ gcc/config/avr/t-avr 2011-05-30 17:42:43.393833397 +0200
+@@ -90,6 +90,7 @@
+ mmcu?avr5=mmcu?atmega128 \
+ mmcu?avr5=mmcu?atmega1280 \
+ mmcu?avr5=mmcu?atmega1281 \
++ mmcu?avr5=mmcu?atmega128rfa1 \
+ mmcu?avr5=mmcu?atmega16hva \
+ mmcu?avr5=mmcu?at90can32 \
+ mmcu?avr5=mmcu?at90can64 \