aboutsummaryrefslogtreecommitdiff
path: root/devel/avr-gcc
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>2006-10-06 20:43:57 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>2006-10-06 20:43:57 +0000
commit48e98e9e987f0bbecff19ec50b13983b4a0cec6e (patch)
treeef614ccb0efa20173baa3ab93a84e07b355d99c7 /devel/avr-gcc
parent422318ef21c53797f9f2efc03fd5c8b32848ba1c (diff)
downloadports-48e98e9e987f0bbecff19ec50b13983b4a0cec6e.tar.gz
ports-48e98e9e987f0bbecff19ec50b13983b4a0cec6e.zip
Notes
Diffstat (limited to 'devel/avr-gcc')
-rw-r--r--devel/avr-gcc/Makefile68
-rw-r--r--devel/avr-gcc/distinfo6
-rw-r--r--devel/avr-gcc/files/patch-0b-constants144
-rw-r--r--devel/avr-gcc/files/patch-attribute_alias11
-rw-r--r--devel/avr-gcc/files/patch-dwarf10
-rw-r--r--devel/avr-gcc/files/patch-libiberty-Makefile.in12
-rw-r--r--devel/avr-gcc/files/patch-newdevices284
-rw-r--r--devel/avr-gcc/files/patch-zz-atmega256x499
-rw-r--r--devel/avr-gcc/pkg-descr24
-rw-r--r--devel/avr-gcc/pkg-plist95
10 files changed, 1153 insertions, 0 deletions
diff --git a/devel/avr-gcc/Makefile b/devel/avr-gcc/Makefile
new file mode 100644
index 000000000000..cea0fd0b1f7e
--- /dev/null
+++ b/devel/avr-gcc/Makefile
@@ -0,0 +1,68 @@
+# New ports collection makefile for: avr-gcc-devel
+# Date created: 22 Mar 2006
+# Whom: Joerg Wunsch <joerg@freebsd.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= gcc
+PORTVERSION= 4.1.1
+CATEGORIES= devel
+MASTER_SITES= ${MASTER_SITE_GCC}
+MASTER_SITES+= http://people.freebsd.org/~joerg/:local
+MASTER_SITE_SUBDIR= releases/${DISTNAME}
+PKGNAMEPREFIX= avr-
+DISTFILES= gcc-core-${PORTVERSION}${EXTRACT_SUFX} \
+ gcc-g++-${PORTVERSION}${EXTRACT_SUFX}
+EXTRACT_ONLY= gcc-core-${PORTVERSION}${EXTRACT_SUFX} \
+ gcc-g++-${PORTVERSION}${EXTRACT_SUFX}
+
+MAINTAINER= joerg@freebsd.org
+COMMENT= FSF GCC 4.x for Atmel AVR 8-bit RISC cross-development
+
+BUILD_DEPENDS= avr-as:${PORTSDIR}/devel/avr-binutils \
+ avr-ld:${PORTSDIR}/devel/avr-binutils
+RUN_DEPENDS= avr-as:${PORTSDIR}/devel/avr-binutils \
+ avr-ld:${PORTSDIR}/devel/avr-binutils
+
+# GCC 4.x doesn't want to be built in its own source directory.
+WRKSRC= ${WRKDIR}/gcc-${PORTVERSION}
+BUILD_WRKSRC= ${WRKDIR}/build
+CONFIGURE_WRKSRC= ${BUILD_WRKSRC}
+INSTALL_WRKSRC= ${BUILD_WRKSRC}
+CONFIGURE_SCRIPT= ../gcc-${PORTVERSION}/configure
+NO_LATEST_LINK= Use devel/avr-gcc for a stable version.
+
+USE_PERL5_BUILD= yes
+USE_BZIP2= yes
+USE_GMAKE= yes
+USE_BISON= yes
+GNU_CONFIGURE= yes
+
+.include <bsd.port.pre.mk>
+
+.if (${ARCH} == "amd64")
+ARCH= x86_64
+.endif
+
+CONFLICTS= avr-gcc-3*
+
+CONFIGURE_ARGS= --target=avr --disable-libssp
+
+MAKE_FLAGS= LANGUAGES="c c++"
+# get rid of that silly -mcpu=pentiumpro FreeBSD 5+ is so fond of. :-(
+MAKE_ENV= MACHINE_ARCH=avr
+
+MAN1= avr-cpp.1 avr-gcc.1 avr-g++.1 avr-gcov.1
+MAN7= fsf-funding.7 gfdl.7 gpl.7
+INFO= cpp gcc gccint cppinternals gccinstall
+
+post-extract:
+ cd ${WRKDIR} && ${MKDIR} build
+
+.if ${PERL_LEVEL} < 500600
+BROKEN= system's Pod::Man too old to generate the documentation.
+IGNORE= you need a newer version of Perl to build the documentation
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/devel/avr-gcc/distinfo b/devel/avr-gcc/distinfo
new file mode 100644
index 000000000000..aea02c63a969
--- /dev/null
+++ b/devel/avr-gcc/distinfo
@@ -0,0 +1,6 @@
+MD5 (gcc-core-4.1.1.tar.bz2) = a1b189c98aa7d7f164036bbe89b9b2a2
+SHA256 (gcc-core-4.1.1.tar.bz2) = f1f116d3f6281ffe961b68255bdc446cd164d7b9d159cb302236a6175d215a51
+SIZE (gcc-core-4.1.1.tar.bz2) = 17087873
+MD5 (gcc-g++-4.1.1.tar.bz2) = 70c786bf8ca042e880a87fecb9e4dfcd
+SHA256 (gcc-g++-4.1.1.tar.bz2) = 48a2fbf87ca5497f9b78c25f2763eb1df86ec7c539be0938d9c43651fc504c40
+SIZE (gcc-g++-4.1.1.tar.bz2) = 3810062
diff --git a/devel/avr-gcc/files/patch-0b-constants b/devel/avr-gcc/files/patch-0b-constants
new file mode 100644
index 000000000000..3f21cb6fdbaf
--- /dev/null
+++ b/devel/avr-gcc/files/patch-0b-constants
@@ -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/devel/avr-gcc/files/patch-attribute_alias b/devel/avr-gcc/files/patch-attribute_alias
new file mode 100644
index 000000000000..95d8ba4ece7f
--- /dev/null
+++ b/devel/avr-gcc/files/patch-attribute_alias
@@ -0,0 +1,11 @@
+--- 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/devel/avr-gcc/files/patch-dwarf b/devel/avr-gcc/files/patch-dwarf
new file mode 100644
index 000000000000..316080d37166
--- /dev/null
+++ b/devel/avr-gcc/files/patch-dwarf
@@ -0,0 +1,10 @@
+--- gcc/config/avr/avr.h.orig 2006-04-13 15:31:19.000000000 +0200
++++ gcc/config/avr/avr.h 2006-04-13 16:23:16.000000000 +0200
+@@ -892,3 +892,7 @@
+ #define ZERO_REGNO 1
+
++#define DWARF2_DEBUGGING_INFO 1
+ #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
++
++/* Offset from the frame pointer register value to the top of the stack. */
++#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
diff --git a/devel/avr-gcc/files/patch-libiberty-Makefile.in b/devel/avr-gcc/files/patch-libiberty-Makefile.in
new file mode 100644
index 000000000000..0e0b3ce31173
--- /dev/null
+++ b/devel/avr-gcc/files/patch-libiberty-Makefile.in
@@ -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/devel/avr-gcc/files/patch-newdevices b/devel/avr-gcc/files/patch-newdevices
new file mode 100644
index 000000000000..6155126a58a6
--- /dev/null
+++ b/devel/avr-gcc/files/patch-newdevices
@@ -0,0 +1,284 @@
+Index: gcc/config/avr/avr.c
+===================================================================
+--- gcc/config/avr/avr.c (revision 114367)
++++ gcc/config/avr/avr.c (working copy)
+@@ -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,46 @@
+ { "atmega88", 4, "__AVR_ATmega88__" },
+ { "atmega8515", 4, "__AVR_ATmega8515__" },
+ { "atmega8535", 4, "__AVR_ATmega8535__" },
++ { "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__" },
+ { "atmega3250", 5, "__AVR_ATmega3250__" },
++ { "atmega329", 5, "__AVR_ATmega329__" },
++ { "atmega3290", 5, "__AVR_ATmega3290__" },
++ { "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__" },
++ { "at90can32", 5, "__AVR_AT90CAN32__" },
++ { "at90can64", 5, "__AVR_AT90CAN64__" },
+ { "at90can128", 5, "__AVR_AT90CAN128__" },
++ { "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 },
+Index: gcc/config/avr/t-avr
+===================================================================
+--- gcc/config/avr/t-avr (revision 114367)
++++ gcc/config/avr/t-avr (working copy)
+@@ -42,21 +42,55 @@
+
+ # 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?at90pwm2 \
++ mmcu?avr4=mmcu?at90pwm3 \
++ 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?atmega3250 \
++ mmcu?avr5=mmcu?atmega329 \
++ mmcu?avr5=mmcu?atmega3290 \
++ 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?at90can32 \
++ mmcu?avr5=mmcu?at90can64 \
++ mmcu?avr5=mmcu?at90can128 \
++ mmcu?avr5=mmcu?at90usb646 \
++ mmcu?avr5=mmcu?at90usb647 \
++ mmcu?avr5=mmcu?at90usb1286 \
++ mmcu?avr5=mmcu?at90usb1287 \
++ mmcu?avr5=mmcu?at94k
+
+ MULTILIB_EXCEPTIONS =
+
+Index: gcc/config/avr/avr.h
+===================================================================
+--- gcc/config/avr/avr.h (revision 114367)
++++ gcc/config/avr/avr.h (working copy)
+@@ -758,12 +758,67 @@
+ #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=at90pwm2|\
++ mmcu=at90pwm3:-m avr4}\
++%{mmcu=atmega16*|\
++ mmcu=atmega32*|\
++ mmcu=atmega406|\
++ mmcu=atmega64*|\
++ mmcu=atmega128*|\
++ mmcu=at90can*|\
++ mmcu=at90usb*|\
++ mmcu=at94k:-m avr5}\
++%{mmcu=atmega324*|\
++ mmcu=atmega325|\
++ mmcu=atmega3250|\
++ mmcu=atmega329|\
++ mmcu=atmega3290|\
++ 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=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 }}}}}"
+@@ -799,6 +854,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} \
+@@ -809,22 +873,44 @@
+ %{mmcu=atmega88:crtm88.o%s} \
+ %{mmcu=atmega8515:crtm8515.o%s} \
+ %{mmcu=atmega8535:crtm8535.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=atmega3250:crtm3250.o%s} \
++%{mmcu=atmega329:crtm329.o%s} \
++%{mmcu=atmega3290:crtm3290.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=at90can32:crtcan32.o%s} \
++%{mmcu=at90can64:crtcan64.o%s} \
+ %{mmcu=at90can128:crtcan128.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/devel/avr-gcc/files/patch-zz-atmega256x b/devel/avr-gcc/files/patch-zz-atmega256x
new file mode 100644
index 000000000000..b096badd2a5f
--- /dev/null
+++ b/devel/avr-gcc/files/patch-zz-atmega256x
@@ -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=atmega128:crtm128.o%s} \
+ %{mmcu=atmega1280:crtm1280.o%s} \
+ %{mmcu=atmega1281:crtm1281.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/devel/avr-gcc/pkg-descr b/devel/avr-gcc/pkg-descr
new file mode 100644
index 000000000000..8b123c7c3910
--- /dev/null
+++ b/devel/avr-gcc/pkg-descr
@@ -0,0 +1,24 @@
+FSF gcc-4.x for Atmel AVR cross-development
+
+Included is the basic C++ compiler, although this is only of limited
+use without a libstdc++, and it is little tested.
+
+Supported debugging formats: -gdwarf-2 [default], -gstabs
+Locally hack added: recognizes 0bXXX binary constants
+Backported GCC 4.2 patch for __attribute__((alias))
+
+Locally added support for the following AVR devices:
+
+ ATtiny24/ATtiny44/ATtiny84
+ ATtiny25/ATtiny45/ATtiny85 ATtiny261/ATtiny461/ATtiny861
+ ATmega164P/ATmega324P/ATmega644/ATmega644P
+ ATmega165P/ATmega169P
+ ATmega329/ATmega3290/ATmega649/ATmega6490
+ ATmega406
+ ATmega640/ATmega1280/ATmega1281
+ AT90PWM2/AT90PWM3 AT90CAN32/64
+ AT90USB646/647/1286/1287
+ ATmega2560/ATmega2561 (beta test)
+
+WWW: http://gcc.gnu.org/
+WWW: http://www.nongnu.org/avr-libc/
diff --git a/devel/avr-gcc/pkg-plist b/devel/avr-gcc/pkg-plist
new file mode 100644
index 000000000000..9277ed00b2a4
--- /dev/null
+++ b/devel/avr-gcc/pkg-plist
@@ -0,0 +1,95 @@
+avr/bin/c++
+avr/bin/g++
+avr/bin/gcc
+bin/avr-c++
+bin/avr-cpp
+bin/avr-g++
+bin/avr-gcc
+bin/avr-gcc-4.1.1
+bin/avr-gccbug
+lib/gcc/avr/4.1.1/avr3/libgcc.a
+lib/gcc/avr/4.1.1/avr3/libgcov.a
+lib/gcc/avr/4.1.1/avr4/libgcc.a
+lib/gcc/avr/4.1.1/avr4/libgcov.a
+lib/gcc/avr/4.1.1/avr5/libgcc.a
+lib/gcc/avr/4.1.1/avr5/libgcov.a
+lib/gcc/avr/4.1.1/avr6/libgcc.a
+lib/gcc/avr/4.1.1/avr6/libgcov.a
+lib/gcc/avr/4.1.1/include/README
+lib/gcc/avr/4.1.1/include/fixed
+lib/gcc/avr/4.1.1/include/float.h
+lib/gcc/avr/4.1.1/include/iso646.h
+lib/gcc/avr/4.1.1/include/limits.h
+lib/gcc/avr/4.1.1/include/stdarg.h
+lib/gcc/avr/4.1.1/include/stdbool.h
+lib/gcc/avr/4.1.1/include/stddef.h
+lib/gcc/avr/4.1.1/include/syslimits.h
+lib/gcc/avr/4.1.1/include/unwind.h
+lib/gcc/avr/4.1.1/include/varargs.h
+lib/gcc/avr/4.1.1/install-tools/gsyslimits.h
+lib/gcc/avr/4.1.1/install-tools/include/README
+lib/gcc/avr/4.1.1/install-tools/include/float.h
+lib/gcc/avr/4.1.1/install-tools/include/iso646.h
+lib/gcc/avr/4.1.1/install-tools/include/limits.h
+lib/gcc/avr/4.1.1/install-tools/include/stdarg.h
+lib/gcc/avr/4.1.1/install-tools/include/stdbool.h
+lib/gcc/avr/4.1.1/install-tools/include/stddef.h
+lib/gcc/avr/4.1.1/install-tools/include/unwind.h
+lib/gcc/avr/4.1.1/install-tools/include/varargs.h
+lib/gcc/avr/4.1.1/install-tools/macro_list
+lib/gcc/avr/4.1.1/install-tools/mkheaders.conf
+lib/gcc/avr/4.1.1/libgcc.a
+lib/gcc/avr/4.1.1/libgcov.a
+libexec/gcc/avr/4.1.1/cc1
+libexec/gcc/avr/4.1.1/cc1plus
+libexec/gcc/avr/4.1.1/collect2
+libexec/gcc/avr/4.1.1/install-tools/fix-header
+libexec/gcc/avr/4.1.1/install-tools/fixinc.sh
+libexec/gcc/avr/4.1.1/install-tools/fixincl
+libexec/gcc/avr/4.1.1/install-tools/fixproto
+libexec/gcc/avr/4.1.1/install-tools/mkheaders
+share/locale/be/LC_MESSAGES/cpplib.mo
+share/locale/be/LC_MESSAGES/gcc.mo
+share/locale/ca/LC_MESSAGES/cpplib.mo
+share/locale/ca/LC_MESSAGES/gcc.mo
+share/locale/da/LC_MESSAGES/cpplib.mo
+share/locale/da/LC_MESSAGES/gcc.mo
+share/locale/de/LC_MESSAGES/cpplib.mo
+share/locale/de/LC_MESSAGES/gcc.mo
+share/locale/el/LC_MESSAGES/cpplib.mo
+share/locale/el/LC_MESSAGES/gcc.mo
+share/locale/es/LC_MESSAGES/cpplib.mo
+share/locale/es/LC_MESSAGES/gcc.mo
+share/locale/fr/LC_MESSAGES/cpplib.mo
+share/locale/fr/LC_MESSAGES/gcc.mo
+share/locale/ja/LC_MESSAGES/cpplib.mo
+share/locale/ja/LC_MESSAGES/gcc.mo
+share/locale/nl/LC_MESSAGES/cpplib.mo
+share/locale/nl/LC_MESSAGES/gcc.mo
+share/locale/rw/LC_MESSAGES/cpplib.mo
+share/locale/rw/LC_MESSAGES/gcc.mo
+share/locale/sv/LC_MESSAGES/cpplib.mo
+share/locale/sv/LC_MESSAGES/gcc.mo
+share/locale/tr/LC_MESSAGES/cpplib.mo
+share/locale/tr/LC_MESSAGES/gcc.mo
+share/locale/vi/LC_MESSAGES/cpplib.mo
+share/locale/zh_CN/LC_MESSAGES/cpplib.mo
+share/locale/zh_CN/LC_MESSAGES/gcc.mo
+share/locale/zh_TW/LC_MESSAGES/cpplib.mo
+share/locale/zh_TW/LC_MESSAGES/gcc.mo
+@unexec /bin/rmdir %D/share/locale/rw/LC_MESSAGES 2>/dev/null || /usr/bin/true
+@unexec /bin/rmdir %D/share/locale/rw 2>/dev/null || /usr/bin/true
+@dirrm lib/gcc/avr/4.1.1/avr3
+@dirrm lib/gcc/avr/4.1.1/avr4
+@dirrm lib/gcc/avr/4.1.1/avr5
+@dirrm lib/gcc/avr/4.1.1/avr6
+@dirrm lib/gcc/avr/4.1.1/include
+@dirrm lib/gcc/avr/4.1.1/install-tools/include
+@dirrm lib/gcc/avr/4.1.1/install-tools
+@dirrm lib/gcc/avr/4.1.1
+@dirrm lib/gcc/avr
+@dirrm lib/gcc
+@dirrm libexec/gcc/avr/4.1.1/install-tools
+@dirrm libexec/gcc/avr/4.1.1
+@dirrm libexec/gcc/avr
+@dirrm libexec/gcc