diff options
author | Joerg Wunsch <joerg@FreeBSD.org> | 2009-06-11 20:39:39 +0000 |
---|---|---|
committer | Joerg Wunsch <joerg@FreeBSD.org> | 2009-06-11 20:39:39 +0000 |
commit | 3bf397da57cef19904b08fe46c33cb4c483a0a04 (patch) | |
tree | b81ce88e6ce49c525c69125e2a917c027439c5d2 /devel | |
parent | 082ad5e4e936c4760afffa8044c8391e24c3712e (diff) | |
download | ports-3bf397da57cef19904b08fe46c33cb4c483a0a04.tar.gz ports-3bf397da57cef19904b08fe46c33cb4c483a0a04.zip |
Notes
Diffstat (limited to 'devel')
-rw-r--r-- | devel/avr-binutils/Makefile | 3 | ||||
-rw-r--r-- | devel/avr-binutils/distinfo | 6 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-aa | 46 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-bug5215 | 52 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-bug5523 | 30 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-coff-avr | 1442 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-data-origin | 83 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-newdevices | 184 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-wrong-arch | 22 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-xmega | 792 | ||||
-rw-r--r-- | devel/avr-binutils/files/patch-zzz-atmega128rfa1 | 21 | ||||
-rw-r--r-- | devel/avr-binutils/pkg-plist | 22 |
12 files changed, 1276 insertions, 1427 deletions
diff --git a/devel/avr-binutils/Makefile b/devel/avr-binutils/Makefile index bfc933e5c692..31a0a91391b2 100644 --- a/devel/avr-binutils/Makefile +++ b/devel/avr-binutils/Makefile @@ -6,8 +6,7 @@ # PORTNAME= binutils -PORTVERSION= 2.18 -PORTREVISION= 4 +PORTVERSION= 2.19 CATEGORIES= devel MASTER_SITES= ${MASTER_SITE_SOURCEWARE} MASTER_SITE_SUBDIR= binutils/releases diff --git a/devel/avr-binutils/distinfo b/devel/avr-binutils/distinfo index 11093cafba7e..a9b640264d30 100644 --- a/devel/avr-binutils/distinfo +++ b/devel/avr-binutils/distinfo @@ -1,3 +1,3 @@ -MD5 (binutils-2.18.tar.bz2) = 9d22ee4dafa3a194457caf4706f9cf01 -SHA256 (binutils-2.18.tar.bz2) = 487a33a452f0edcf1f8bb8fc23dff5c7a82edec3f3f8b65632b6c945e961ee9b -SIZE (binutils-2.18.tar.bz2) = 14962245 +MD5 (binutils-2.19.tar.bz2) = 17a52219dee5a76c1a9d9b0bfd337d66 +SHA256 (binutils-2.19.tar.bz2) = bd2ea10ffc2bf62a917b05f4fbe3d02212589c2bc177fa0c51a9c874d3da528a +SIZE (binutils-2.19.tar.bz2) = 16219400 diff --git a/devel/avr-binutils/files/patch-aa b/devel/avr-binutils/files/patch-aa index 7a27308a99ce..8024256b6ea4 100644 --- a/devel/avr-binutils/files/patch-aa +++ b/devel/avr-binutils/files/patch-aa @@ -1,6 +1,18 @@ ---- libiberty/Makefile.in.orig Fri Apr 7 02:01:25 2006 -+++ libiberty/Makefile.in Mon Sep 25 21:54:25 2006 -@@ -330,7 +330,8 @@ +--- ./etc/Makefile.in.orig 2007-03-27 20:09:32.000000000 +0200 ++++ ./etc/Makefile.in 2009-01-06 17:33:01.000000000 +0100 +@@ -64,7 +64,8 @@ + HTMLFILES = standards.html configure.html + + all: info +-install: install-info ++#install: install-info ++install: + + uninstall: + +--- ./libiberty/Makefile.in.orig 2008-07-24 15:51:49.000000000 +0200 ++++ ./libiberty/Makefile.in 2009-01-06 17:33:01.000000000 +0100 +@@ -346,7 +346,8 @@ @MAINT@ echo stamp > stamp-functions INSTALL_DEST = @INSTALL_DEST@ @@ -8,11 +20,11 @@ +#install: install_to_$(INSTALL_DEST) install-subdir +install: - install_to_libdir: all - ${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR) ---- bfd/Makefile.in.orig Fri Jun 23 20:17:19 2006 -+++ bfd/Makefile.in Mon Sep 25 21:54:49 2006 -@@ -1158,7 +1158,8 @@ + # This is tricky. Even though CC in the Makefile contains + # multilib-specific flags, it's overridden by FLAGS_TO_PASS from the +--- ./bfd/Makefile.in.orig 2008-10-16 15:20:48.000000000 +0200 ++++ ./bfd/Makefile.in 2009-01-06 17:33:01.000000000 +0100 +@@ -1222,7 +1222,8 @@ for dir in "$(DESTDIR)$(bfdlibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done @@ -22,9 +34,9 @@ install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive ---- opcodes/Makefile.in.orig Thu Apr 6 23:49:35 2006 -+++ opcodes/Makefile.in Mon Sep 25 21:55:23 2006 -@@ -837,7 +837,8 @@ +--- ./opcodes/Makefile.in.orig 2008-09-09 10:02:19.000000000 +0200 ++++ ./opcodes/Makefile.in 2009-01-06 17:33:01.000000000 +0100 +@@ -879,7 +879,8 @@ for dir in "$(DESTDIR)$(bfdlibdir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done @@ -34,15 +46,3 @@ install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive ---- etc/Makefile.in.orig Thu Apr 6 23:49:30 2006 -+++ etc/Makefile.in Mon Sep 25 21:55:51 2006 -@@ -59,7 +59,8 @@ - HTMLFILES = standards.html configure.html - - all: info --install: install-info -+#install: install-info -+install: - - uninstall: - diff --git a/devel/avr-binutils/files/patch-bug5215 b/devel/avr-binutils/files/patch-bug5215 deleted file mode 100644 index 81f314d834ba..000000000000 --- a/devel/avr-binutils/files/patch-bug5215 +++ /dev/null @@ -1,52 +0,0 @@ -This is a workaround for - -http://sourceware.org/bugzilla/show_bug.cgi?id=5215 - ---- ld/genscripts.sh.orig Wed Oct 24 09:38:43 2007 -+++ ld/genscripts.sh Wed Oct 24 09:59:03 2007 -@@ -390,21 +390,21 @@ - *" ${EMULATION_NAME} "*) COMPILE_IN=true;; - esac - --if test -n "${BASH+set}"; then -- source_em() -- { -- local current_script="$em_script" -- em_script=$1 -- . $em_script -- em_script=$current_script -- } -- fragment() -- { -- local lineno=$[${BASH_LINENO[0]} + 1] -- echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\"" -- cat >> e${EMULATION_NAME}.c -- } --else -+#if test -n "${BASH+set}"; then -+# source_em() -+# { -+# local current_script="$em_script" -+# em_script=$1 -+# . $em_script -+# em_script=$current_script -+# } -+# fragment() -+# { -+# local lineno=$[${BASH_LINENO[0]} + 1] -+# echo >> e${EMULATION_NAME}.c "#line $lineno \"$em_script\"" -+# cat >> e${EMULATION_NAME}.c -+# } -+#else - source_em() - { - . $1 -@@ -413,7 +413,7 @@ - { - cat >> e${EMULATION_NAME}.c - } --fi -+#fi - - # Generate e${EMULATION_NAME}.c. - # Start with an empty file, then the sourced .em script diff --git a/devel/avr-binutils/files/patch-bug5523 b/devel/avr-binutils/files/patch-bug5523 deleted file mode 100644 index 59986b7dbaca..000000000000 --- a/devel/avr-binutils/files/patch-bug5523 +++ /dev/null @@ -1,30 +0,0 @@ -Committed -Binutils 2.19. -Backport patch to fix Binutils bug #5523. --------------------------------------------------------------------------------- -Index: gas/config/tc-avr.c -=================================================================== -RCS file: /cvs/src/src/gas/config/tc-avr.c,v -retrieving revision 1.48 -diff -c -3 -p -r1.48 tc-avr.c -*** gas/config/tc-avr.c 16 Nov 2007 17:39:22 -0000 1.48 ---- gas/config/tc-avr.c 7 Jan 2008 16:43:30 -0000 -*************** avr_ldi_expression (expressionS *exp) -*** 618,624 **** - break; - - default: -! as_warn (_("expression dangerous with linker stubs")); - } - } - return reloc_to_return; ---- 618,626 ---- - break; - - default: -! /* PR 5523: Do not generate a warning here, -! legitimate code can trigger this case. */ -! break; - } - } - return reloc_to_return; diff --git a/devel/avr-binutils/files/patch-coff-avr b/devel/avr-binutils/files/patch-coff-avr index fdba8c03e55e..eae0c2ea69e8 100644 --- a/devel/avr-binutils/files/patch-coff-avr +++ b/devel/avr-binutils/files/patch-coff-avr @@ -1,94 +1,6 @@ -diff -Nur ../binutils-2.18.orig/binutils/doc/objcopy.1 ./binutils/doc/objcopy.1 ---- ../binutils-2.18.orig/binutils/doc/objcopy.1 Tue Oct 23 21:44:42 2007 -+++ ./binutils/doc/objcopy.1 Tue Oct 23 22:18:44 2007 -@@ -193,6 +193,8 @@ - [\fB\-\-readonly\-text\fR] - [\fB\-\-pure\fR] - [\fB\-\-impure\fR] -+ [\fB\-\-change\-pathname\fR \fIold\fR=\fInew\fR] -+ [\fB\-\-basename\fR] - [\fB\-v\fR|\fB\-\-verbose\fR] - [\fB\-V\fR|\fB\-\-version\fR] - [\fB\-\-help\fR] [\fB\-\-info\fR] -@@ -807,6 +809,23 @@ - It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR - linker input file. - .RE -+.IP "\fB\-\-change\-pathname\fR \fIold\fR=\fInew\fR" 4 -+.IX Item "--change-pathname old=new" -+When converting debugging information using \fB\-\-debugging\fR, for -+every pathname that starts with \fIold\fR, replace the matching part -+by \fInew\fR. This is intented to map pathnames between different -+debugging tools, or when parts of the object file(s) had their -+pathnames recorded in a different build environment. Note that only -+leading directory name components might be changed that way, since the -+trailing filename could be recorded elsewhere as well (depending on the -+debugging format of the input file). -+.IP "\fB\-\-basename\fR" -+.IX Item "--basename" -+When converting debugging information using \fB\-\-debugging\fR, for -+every pathname, strip all leading directory information. This option -+takes precedence over any \fB\-\-change\-pathname\fR option. For some -+debugging formats that cannot handle long filenames, this options is -+implied (notably, some COFF debugging formats). - .IP "\fB\-V\fR" 4 - .IX Item "-V" - .PD 0 -diff -Nur ../binutils-2.18.orig/binutils/Makefile.am ./binutils/Makefile.am ---- ../binutils-2.18.orig/binutils/Makefile.am Tue Oct 23 21:44:42 2007 -+++ ./binutils/Makefile.am Tue Oct 23 22:22:40 2007 -@@ -98,7 +98,7 @@ - resbin.c rescoff.c resrc.c resres.c \ - size.c srconv.c stabs.c strings.c sysdump.c \ - unwind-ia64.c version.c \ -- windres.c winduni.c wrstabs.c \ -+ windres.c winduni.c wrcoff.c wrstabs.c \ - windmc.c mclex.c - - GENERATED_CFILES = \ -@@ -106,7 +106,7 @@ - defparse.c deflex.c nlmheader.c rcparse.c mcparse.c - - DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c --WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c -+WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c wrcoff.c - - # Code shared by all the binutils. - BULIBS = bucomm.c version.c filemode.c -diff -Nur ../binutils-2.18.orig/binutils/Makefile.in ./binutils/Makefile.in ---- ../binutils-2.18.orig/binutils/Makefile.in Tue Oct 23 21:44:42 2007 -+++ ./binutils/Makefile.in Tue Oct 23 22:26:52 2007 -@@ -129,7 +129,7 @@ - nm_new_OBJECTS = $(am_nm_new_OBJECTS) - nm_new_LDADD = $(LDADD) - am__objects_2 = rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) \ -- ieee.$(OBJEXT) rdcoff.$(OBJEXT) -+ ieee.$(OBJEXT) rdcoff.$(OBJEXT) wrcoff.$(OBJEXT) - am__objects_3 = $(am__objects_2) wrstabs.$(OBJEXT) - am_objcopy_OBJECTS = objcopy.$(OBJEXT) not-strip.$(OBJEXT) \ - rename.$(OBJEXT) $(am__objects_3) $(am__objects_1) -@@ -418,7 +418,7 @@ - resbin.c rescoff.c resrc.c resres.c \ - size.c srconv.c stabs.c strings.c sysdump.c \ - unwind-ia64.c version.c \ -- windres.c winduni.c wrstabs.c \ -+ windres.c winduni.c wrcoff.c wrstabs.c \ - windmc.c mclex.c - - GENERATED_CFILES = \ -@@ -426,7 +426,7 @@ - defparse.c deflex.c nlmheader.c rcparse.c mcparse.c - - DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c --WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c -+WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c wrcoff.c - - # Code shared by all the binutils. - BULIBS = bucomm.c version.c filemode.c -diff -Nur ../binutils-2.18.orig/binutils/bucomm.c ./binutils/bucomm.c ---- ../binutils-2.18.orig/binutils/bucomm.c Tue Oct 23 21:44:42 2007 -+++ ./binutils/bucomm.c Tue Oct 23 22:18:44 2007 -@@ -501,6 +501,32 @@ +--- ./binutils/bucomm.c.orig 2008-01-09 11:40:32.000000000 +0100 ++++ ./binutils/bucomm.c 2009-01-06 17:45:34.000000000 +0100 +@@ -549,6 +549,32 @@ return ret; } @@ -121,21 +33,8 @@ diff -Nur ../binutils-2.18.orig/binutils/bucomm.c ./binutils/bucomm.c /* Returns the size of the named file. If the file does not exist, or if it is not a real file, then a suitable non-fatal error message is printed and zero is returned. */ -diff -Nur ../binutils-2.18.orig/binutils/bucomm.h ./binutils/bucomm.h ---- ../binutils-2.18.orig/binutils/bucomm.h Tue Oct 23 21:44:42 2007 -+++ ./binutils/bucomm.h Tue Oct 23 22:18:44 2007 -@@ -54,6 +54,8 @@ - - off_t get_file_size (const char *); - -+const char *bu_basename PARAMS ((const char *)); -+ - extern char *program_name; - - /* filemode.c */ -diff -Nur ../binutils-2.18.orig/binutils/budbg.h ./binutils/budbg.h ---- ../binutils-2.18.orig/binutils/budbg.h Tue Oct 23 21:44:42 2007 -+++ ./binutils/budbg.h Tue Oct 23 22:18:44 2007 +--- ./binutils/budbg.h.orig 2008-06-12 13:57:40.000000000 +0200 ++++ ./binutils/budbg.h 2009-01-06 17:45:34.000000000 +0100 @@ -51,8 +51,11 @@ extern bfd_boolean write_ieee_debugging_info (bfd *, void *); @@ -144,145 +43,13 @@ diff -Nur ../binutils-2.18.orig/binutils/budbg.h ./binutils/budbg.h +/* Routine used to read and write COFF debugging information. */ extern bfd_boolean parse_coff (bfd *, asymbol **, long, void *); -+ + +extern bfd_boolean write_coff_debugging_info + (bfd *abfd, void *, long *symcountp, asymbol ***); - - #endif ---- binutils/debug.c.orig Mon Aug 6 21:55:10 2007 -+++ binutils/debug.c Tue Oct 23 23:43:19 2007 -@@ -31,6 +31,7 @@ - #include <assert.h> - #include "bfd.h" - #include "libiberty.h" -+#include "bucomm.h" - #include "debug.h" - - /* Global information we keep for debugging. A pointer to this -@@ -552,6 +553,19 @@ - struct debug_type *t; - }; - -+/* Simple list, used for pathname translations. */ -+struct xlat_list -+{ -+ /* Next string on list. */ -+ struct xlat_list *next; -+ /* Old part to match against. */ -+ const char *old; -+ size_t olen; -+ /* New part to replace. */ -+ const char *newstr; -+ size_t nlen; -+}; -+ - /* Local functions. */ - - static void debug_error (const char *); -@@ -588,6 +602,11 @@ - (struct debug_handle *, struct debug_type *, struct debug_type *); - static bfd_boolean debug_class_type_samep - (struct debug_handle *, struct debug_type *, struct debug_type *); -+static const char *debug_xlat_pathname (const char *); -+ -+/* List of pathname translations. */ -+static struct xlat_list *xlat, *xltail; -+static bfd_boolean xlat_basename; - - /* Issue an error message. */ - -@@ -680,6 +699,8 @@ - - if (name == NULL) - name = ""; -+ else -+ name = debug_xlat_pathname (name); - - nfile = (struct debug_file *) xmalloc (sizeof *nfile); - memset (nfile, 0, sizeof *nfile); -@@ -720,6 +741,8 @@ - - if (name == NULL) - name = ""; -+ else -+ name = debug_xlat_pathname (name); - - if (info->current_unit == NULL) - { -@@ -3369,4 +3392,70 @@ - } - - return TRUE; -+} -+ -+/* Register a pathname translation. */ -+void -+debug_register_pathname_xlat (oname, nname) -+ const char *oname; -+ const char *nname; -+{ -+ struct xlat_list *xlp; + -+ /* Special case: if oname is given as NULL, this means the -+ --basename option has been given to objcopy. */ -+ if (oname == NULL) -+ { -+ xlat_basename = TRUE; -+ return; -+ } -+ -+ xlp = (struct xlat_list *) xmalloc (sizeof (struct xlat_list)); -+ xlp->next = NULL; -+ if (xlat == NULL) -+ xlat = xltail = xlp; -+ else -+ { -+ xltail->next = xlp; -+ xltail = xlp; -+ } -+ xlp->old = oname; -+ xlp->newstr = nname; -+ xlp->olen = strlen (oname); -+ xlp->nlen = strlen (nname); -+} -+ -+/* Try to translate a pathname. */ -+static const char * -+debug_xlat_pathname (oname) -+ const char *oname; -+{ -+ struct xlat_list *xlp; -+ char *cp; -+ size_t olen; -+ -+ if (xlat_basename) -+ return bu_basename (oname); -+ -+ olen = strlen (oname); -+ for (xlp = xlat; xlp; xlp = xlp->next) -+ { -+ if (xlp->olen > olen) -+ /* This cannot be our turn. */ -+ continue; -+ /* Since we have pre-computed all our length values to avoid -+ repetitively computing them, just use memcmp() since it's -+ faster than strcmp(). */ -+ if (memcmp (xlp->old, oname, xlp->olen) == 0) -+ { -+ cp = (char *) xmalloc (olen + xlp->nlen - xlp->olen + 1); -+ memcpy (cp, xlp->newstr, xlp->nlen); -+ memcpy (cp + xlp->nlen, oname + xlp->olen, -+ olen - xlp->olen + 1); -+ return cp; -+ } -+ } -+ -+ /* Not found, pass the original name on. */ -+ return oname; - } -diff -Nur ../binutils-2.18.orig/binutils/debug.h ./binutils/debug.h ---- ../binutils-2.18.orig/binutils/debug.h Tue Oct 23 21:44:43 2007 -+++ ./binutils/debug.h Tue Oct 23 22:18:44 2007 + #endif +--- ./binutils/debug.h.orig 2007-07-05 18:54:45.000000000 +0200 ++++ ./binutils/debug.h 2009-01-06 17:45:34.000000000 +0100 @@ -440,6 +440,12 @@ extern bfd_boolean debug_start_source (void *, const char *); @@ -296,118 +63,43 @@ diff -Nur ../binutils-2.18.orig/binutils/debug.h ./binutils/debug.h /* Record a function definition. This implicitly starts a function block. The debug_type argument is the type of the return value. The bfd_boolean indicates whether the function is globally visible. -diff -Nur ../binutils-2.18.orig/binutils/objcopy.c ./binutils/objcopy.c ---- ../binutils-2.18.orig/binutils/objcopy.c Tue Oct 23 21:44:43 2007 -+++ ./binutils/objcopy.c Tue Oct 23 22:38:29 2007 -@@ -32,6 +32,7 @@ - #include "elf-bfd.h" - #include <sys/stat.h> - #include "libbfd.h" -+#include "debug.h" - - /* A list of symbols to explicitly strip out, or to keep. A linked - list is good enough for a small number from the command line, but -@@ -272,7 +273,9 @@ - OPTION_PURE, - OPTION_IMPURE, - OPTION_EXTRACT_SYMBOL, -- OPTION_REVERSE_BYTES -+ OPTION_REVERSE_BYTES, -+ OPTION_CHANGE_PATHNAME, -+ OPTION_BASENAME - }; - - /* Options to handle if running as "strip". */ -@@ -316,10 +319,12 @@ - {"adjust-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS}, - {"adjust-warnings", no_argument, 0, OPTION_CHANGE_WARNINGS}, - {"alt-machine-code", required_argument, 0, OPTION_ALT_MACH_CODE}, -+ {"basename", no_argument, 0, OPTION_BASENAME}, - {"binary-architecture", required_argument, 0, 'B'}, - {"byte", required_argument, 0, 'b'}, - {"change-addresses", required_argument, 0, OPTION_CHANGE_ADDRESSES}, - {"change-leading-char", no_argument, 0, OPTION_CHANGE_LEADING_CHAR}, -+ {"change-pathname", required_argument, 0, OPTION_CHANGE_PATHNAME}, - {"change-section-address", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS}, - {"change-section-lma", required_argument, 0, OPTION_CHANGE_SECTION_LMA}, - {"change-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_VMA}, -@@ -504,6 +509,8 @@ - --prefix-alloc-sections <prefix>\n\ - Add <prefix> to start of every allocatable\n\ - section name\n\ -+ --change-pathname <old>=<new> Change debug pathnames from <old> to <new>\n\ -+ --basename Strip directory part from debug pathnames\n\ - -v --verbose List all object files modified\n\ - @<file> Read options from <file>\n\ - -V --version Display this program's version number\n\ -@@ -911,6 +918,8 @@ - asymbol **from = isyms, **to = osyms; - long src_count = 0, dst_count = 0; - int relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0; -+ bfd_boolean need_for_debugging = convert_debugging -+ && bfd_get_arch (abfd) == bfd_arch_avr; - - for (; src_count < symcount; src_count++) - { -@@ -1010,9 +1019,10 @@ - || bfd_is_com_section (bfd_get_section (sym))) - keep = strip_symbols != STRIP_UNNEEDED; - else if ((flags & BSF_DEBUGGING) != 0) /* Debugging symbol. */ -- keep = (strip_symbols != STRIP_DEBUG -- && strip_symbols != STRIP_UNNEEDED -- && ! convert_debugging); -+ keep = need_for_debugging -+ || (strip_symbols != STRIP_DEBUG -+ && strip_symbols != STRIP_UNNEEDED -+ && ! convert_debugging); - else if (bfd_coff_get_comdat_section (abfd, bfd_get_section (sym))) - /* COMDAT sections store special information in local - symbols, so we cannot risk stripping any of them. */ -@@ -2588,6 +2598,10 @@ - return write_ieee_debugging_info (obfd, dhandle); - - if (bfd_get_flavour (obfd) == bfd_target_coff_flavour -+ && bfd_get_arch (obfd) == bfd_arch_avr) -+ return write_coff_debugging_info (obfd, dhandle, symcountp, symppp); -+ -+ if (bfd_get_flavour (obfd) == bfd_target_coff_flavour - || bfd_get_flavour (obfd) == bfd_target_elf_flavour) - { - bfd_byte *syms, *strings; -@@ -3287,6 +3301,30 @@ - - case OPTION_PREFIX_ALLOC_SECTIONS: - prefix_alloc_sections_string = optarg; -+ break; -+ -+ case OPTION_CHANGE_PATHNAME: -+ { -+ const char *s; -+ int len; -+ char *name; -+ -+ s = strchr (optarg, '='); -+ if (s == NULL) -+ fatal (_("bad format for %s"), "--change-pathname"); -+ -+ len = s - optarg; -+ name = (char *) xmalloc (len + 1); -+ strncpy (name, optarg, len); -+ name[len] = '\0'; -+ -+ debug_register_pathname_xlat (name, s + 1); -+ } -+ break; -+ -+ case OPTION_BASENAME: -+ /* very special case of pathname translation */ -+ debug_register_pathname_xlat (NULL, NULL); - break; - - case OPTION_READONLY_TEXT: -diff -Nur ../binutils-2.18.orig/binutils/rdcoff.c ./binutils/rdcoff.c ---- ../binutils-2.18.orig/binutils/rdcoff.c Tue Oct 23 21:44:43 2007 -+++ ./binutils/rdcoff.c Tue Oct 23 22:18:44 2007 +--- ./binutils/doc/objcopy.1.orig 2008-09-10 09:50:26.000000000 +0200 ++++ ./binutils/doc/objcopy.1 2009-01-06 17:45:34.000000000 +0100 +@@ -193,6 +193,8 @@ + [\fB\-\-readonly\-text\fR] + [\fB\-\-pure\fR] + [\fB\-\-impure\fR] ++ [\fB\-\-change\-pathname\fR \fIold\fR=\fInew\fR] ++ [\fB\-\-basename\fR] + [\fB\-v\fR|\fB\-\-verbose\fR] + [\fB\-V\fR|\fB\-\-version\fR] + [\fB\-\-help\fR] [\fB\-\-info\fR] +@@ -805,6 +807,23 @@ + It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR + linker input file. + .RE ++.IP "\fB\-\-change\-pathname\fR \fIold\fR=\fInew\fR" 4 ++.IX Item "--change-pathname old=new" ++When converting debugging information using \fB\-\-debugging\fR, for ++every pathname that starts with \fIold\fR, replace the matching part ++by \fInew\fR. This is intented to map pathnames between different ++debugging tools, or when parts of the object file(s) had their ++pathnames recorded in a different build environment. Note that only ++leading directory name components might be changed that way, since the ++trailing filename could be recorded elsewhere as well (depending on the ++debugging format of the input file). ++.IP "\fB\-\-basename\fR" ++.IX Item "--basename" ++When converting debugging information using \fB\-\-debugging\fR, for ++every pathname, strip all leading directory information. This option ++takes precedence over any \fB\-\-change\-pathname\fR option. For some ++debugging formats that cannot handle long filenames, this options is ++implied (notably, some COFF debugging formats). + .IP "\fB\-V\fR" 4 + .IX Item "-V" + .PD 0 +--- ./binutils/rdcoff.c.orig 2007-07-05 18:54:45.000000000 +0200 ++++ ./binutils/rdcoff.c 2009-01-06 17:45:34.000000000 +0100 @@ -82,6 +82,9 @@ struct coff_slots *slots; /* Basic types. */ @@ -551,9 +243,165 @@ diff -Nur ../binutils-2.18.orig/binutils/rdcoff.c ./binutils/rdcoff.c if (ISFCN (syment.n_type)) { fnname = name; -diff -Nur ../binutils-2.18.orig/binutils/wrcoff.c ./binutils/wrcoff.c ---- ../binutils-2.18.orig/binutils/wrcoff.c Thu Jan 1 01:00:00 1970 -+++ ./binutils/wrcoff.c Tue Oct 23 22:18:44 2007 +--- ./binutils/objcopy.c.orig 2008-08-06 02:42:17.000000000 +0200 ++++ ./binutils/objcopy.c 2009-01-06 17:45:34.000000000 +0100 +@@ -32,6 +32,7 @@ + #include "elf-bfd.h" + #include <sys/stat.h> + #include "libbfd.h" ++#include "debug.h" + + struct is_specified_symbol_predicate_data + { +@@ -270,7 +271,9 @@ + OPTION_PURE, + OPTION_IMPURE, + OPTION_EXTRACT_SYMBOL, +- OPTION_REVERSE_BYTES ++ OPTION_REVERSE_BYTES, ++ OPTION_CHANGE_PATHNAME, ++ OPTION_BASENAME + }; + + /* Options to handle if running as "strip". */ +@@ -314,10 +317,12 @@ + {"adjust-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS}, + {"adjust-warnings", no_argument, 0, OPTION_CHANGE_WARNINGS}, + {"alt-machine-code", required_argument, 0, OPTION_ALT_MACH_CODE}, ++ {"basename", no_argument, 0, OPTION_BASENAME}, + {"binary-architecture", required_argument, 0, 'B'}, + {"byte", required_argument, 0, 'b'}, + {"change-addresses", required_argument, 0, OPTION_CHANGE_ADDRESSES}, + {"change-leading-char", no_argument, 0, OPTION_CHANGE_LEADING_CHAR}, ++ {"change-pathname", required_argument, 0, OPTION_CHANGE_PATHNAME}, + {"change-section-address", required_argument, 0, OPTION_CHANGE_SECTION_ADDRESS}, + {"change-section-lma", required_argument, 0, OPTION_CHANGE_SECTION_LMA}, + {"change-section-vma", required_argument, 0, OPTION_CHANGE_SECTION_VMA}, +@@ -502,6 +507,8 @@ + --prefix-alloc-sections <prefix>\n\ + Add <prefix> to start of every allocatable\n\ + section name\n\ ++ --change-pathname <old>=<new> Change debug pathnames from <old> to <new>\n\ ++ --basename Strip directory part from debug pathnames\n\ + -v --verbose List all object files modified\n\ + @<file> Read options from <file>\n\ + -V --version Display this program's version number\n\ +@@ -948,6 +955,8 @@ + asymbol **from = isyms, **to = osyms; + long src_count = 0, dst_count = 0; + int relocatable = (abfd->flags & (EXEC_P | DYNAMIC)) == 0; ++ bfd_boolean need_for_debugging = convert_debugging ++ && bfd_get_arch (abfd) == bfd_arch_avr; + + for (; src_count < symcount; src_count++) + { +@@ -1047,9 +1056,10 @@ + || bfd_is_com_section (bfd_get_section (sym))) + keep = strip_symbols != STRIP_UNNEEDED; + else if ((flags & BSF_DEBUGGING) != 0) /* Debugging symbol. */ +- keep = (strip_symbols != STRIP_DEBUG +- && strip_symbols != STRIP_UNNEEDED +- && ! convert_debugging); ++ keep = need_for_debugging ++ || (strip_symbols != STRIP_DEBUG ++ && strip_symbols != STRIP_UNNEEDED ++ && ! convert_debugging); + else if (bfd_coff_get_comdat_section (abfd, bfd_get_section (sym))) + /* COMDAT sections store special information in local + symbols, so we cannot risk stripping any of them. */ +@@ -2659,6 +2669,10 @@ + return write_ieee_debugging_info (obfd, dhandle); + + if (bfd_get_flavour (obfd) == bfd_target_coff_flavour ++ && bfd_get_arch (obfd) == bfd_arch_avr) ++ return write_coff_debugging_info (obfd, dhandle, symcountp, symppp); ++ ++ if (bfd_get_flavour (obfd) == bfd_target_coff_flavour + || bfd_get_flavour (obfd) == bfd_target_elf_flavour) + { + bfd_byte *syms, *strings; +@@ -3359,6 +3373,30 @@ + prefix_alloc_sections_string = optarg; + break; + ++ case OPTION_CHANGE_PATHNAME: ++ { ++ const char *s; ++ int len; ++ char *name; ++ ++ s = strchr (optarg, '='); ++ if (s == NULL) ++ fatal (_("bad format for %s"), "--change-pathname"); ++ ++ len = s - optarg; ++ name = (char *) xmalloc (len + 1); ++ strncpy (name, optarg, len); ++ name[len] = '\0'; ++ ++ debug_register_pathname_xlat (name, s + 1); ++ } ++ break; ++ ++ case OPTION_BASENAME: ++ /* very special case of pathname translation */ ++ debug_register_pathname_xlat (NULL, NULL); ++ break; ++ + case OPTION_READONLY_TEXT: + bfd_flags_to_set |= WP_TEXT; + bfd_flags_to_clear &= ~WP_TEXT; +--- ./binutils/Makefile.in.orig 2008-08-25 06:38:13.000000000 +0200 ++++ ./binutils/Makefile.in 2009-01-06 17:45:34.000000000 +0100 +@@ -133,7 +133,7 @@ + nm_new_OBJECTS = $(am_nm_new_OBJECTS) + nm_new_LDADD = $(LDADD) + am__objects_2 = rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) \ +- ieee.$(OBJEXT) rdcoff.$(OBJEXT) ++ ieee.$(OBJEXT) rdcoff.$(OBJEXT) wrcoff.$(OBJEXT) + am__objects_3 = $(am__objects_2) wrstabs.$(OBJEXT) + am_objcopy_OBJECTS = objcopy.$(OBJEXT) not-strip.$(OBJEXT) \ + rename.$(OBJEXT) $(am__objects_3) $(am__objects_1) +@@ -421,7 +421,7 @@ + resbin.c rescoff.c resrc.c resres.c \ + size.c srconv.c stabs.c strings.c sysdump.c \ + unwind-ia64.c version.c \ +- windres.c winduni.c wrstabs.c \ ++ windres.c winduni.c wrcoff.c wrstabs.c \ + windmc.c mclex.c + + GENERATED_CFILES = \ +@@ -429,7 +429,7 @@ + defparse.c deflex.c nlmheader.c rcparse.c mcparse.c + + DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c +-WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c ++WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c wrcoff.c + + # Code shared by all the binutils. + BULIBS = bucomm.c version.c filemode.c +--- ./binutils/Makefile.am.orig 2008-08-25 06:38:13.000000000 +0200 ++++ ./binutils/Makefile.am 2009-01-06 17:45:34.000000000 +0100 +@@ -97,7 +97,7 @@ + resbin.c rescoff.c resrc.c resres.c \ + size.c srconv.c stabs.c strings.c sysdump.c \ + unwind-ia64.c version.c \ +- windres.c winduni.c wrstabs.c \ ++ windres.c winduni.c wrcoff.c wrstabs.c \ + windmc.c mclex.c + + GENERATED_CFILES = \ +@@ -105,7 +105,7 @@ + defparse.c deflex.c nlmheader.c rcparse.c mcparse.c + + DEBUG_SRCS = rddbg.c debug.c stabs.c ieee.c rdcoff.c +-WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c ++WRITE_DEBUG_SRCS = $(DEBUG_SRCS) wrstabs.c wrcoff.c + + # Code shared by all the binutils. + BULIBS = bucomm.c version.c filemode.c +--- ./binutils/wrcoff.c.orig 2009-01-06 17:45:34.000000000 +0100 ++++ ./binutils/wrcoff.c 2009-01-06 17:45:34.000000000 +0100 @@ -0,0 +1,3410 @@ +/* wrcoff.c -- Generate (AVR) COFF debugging information + Copyright 2003 Free Software Foundation, Inc. @@ -3965,60 +3813,421 @@ diff -Nur ../binutils-2.18.orig/binutils/wrcoff.c ./binutils/wrcoff.c + + return TRUE; +} -diff -Nur ../binutils-2.18.orig/bfd/Makefile.am ./bfd/Makefile.am ---- ../binutils-2.18.orig/bfd/Makefile.am Tue Oct 23 21:44:07 2007 -+++ ./bfd/Makefile.am Tue Oct 23 22:41:01 2007 -@@ -208,6 +208,8 @@ - coff-apollo.lo \ - coff-arm.lo \ - coff-aux.lo \ -+ coff-avr.lo \ -+ coff-ext-avr.lo \ - coff-h8300.lo \ - coff-h8500.lo \ - coff-i386.lo \ -@@ -387,6 +389,8 @@ - coff-apollo.c \ - coff-arm.c \ - coff-aux.c \ -+ coff-avr.c \ -+ coff-ext-avr.c \ - coff-h8300.c \ - coff-h8500.c \ - coff-i386.c \ -@@ -976,13 +980,13 @@ - bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in - @echo "creating $@" - @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ -- bfd_version_string="\"$(VERSION)\"" ;\ -+ bfd_version_string="\"$(VERSION) + coff-avr-patch (20050630)\"" ;\ - bfd_soversion="$(VERSION)" ;\ - bfd_version_package="\"$(PKGVERSION)\"" ;\ - report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ - if test "x$(RELEASE)" = x ; then \ - bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ -- bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ -+ bfd_version_string="\"$(VERSION).$${bfd_version_date} + coff-avr-patch (20050630)\"" ;\ - bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ - fi ;\ - sed -e "s,@bfd_version@,$$bfd_version," \ -@@ -1186,6 +1190,12 @@ - coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ - coffcode.h coffswap.h -+coff-avr.lo: coff-avr.c $(INCDIR)/filenames.h $(INCDIR)/coff/avr.h \ -+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ -+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h -+coff-ext-avr.lo: coff-ext-avr.c $(INCDIR)/filenames.h $(INCDIR)/coff/avr.h \ -+ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ -+ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h - coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ - $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ - $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ -diff -Nur ../binutils-2.18.orig/bfd/Makefile.in ./bfd/Makefile.in ---- ../binutils-2.18.orig/bfd/Makefile.in Tue Oct 23 21:44:07 2007 -+++ ./bfd/Makefile.in Tue Oct 23 22:41:31 2007 -@@ -458,6 +458,8 @@ +--- ./binutils/debug.c.orig 2007-07-05 18:54:45.000000000 +0200 ++++ ./binutils/debug.c 2009-01-06 17:45:34.000000000 +0100 +@@ -31,6 +31,7 @@ + #include <assert.h> + #include "bfd.h" + #include "libiberty.h" ++#include "bucomm.h" + #include "debug.h" + + /* Global information we keep for debugging. A pointer to this +@@ -552,6 +553,19 @@ + struct debug_type *t; + }; + ++/* Simple list, used for pathname translations. */ ++struct xlat_list ++{ ++ /* Next string on list. */ ++ struct xlat_list *next; ++ /* Old part to match against. */ ++ const char *old; ++ size_t olen; ++ /* New part to replace. */ ++ const char *newstr; ++ size_t nlen; ++}; ++ + /* Local functions. */ + + static void debug_error (const char *); +@@ -588,6 +602,11 @@ + (struct debug_handle *, struct debug_type *, struct debug_type *); + static bfd_boolean debug_class_type_samep + (struct debug_handle *, struct debug_type *, struct debug_type *); ++static const char *debug_xlat_pathname (const char *); ++ ++/* List of pathname translations. */ ++static struct xlat_list *xlat, *xltail; ++static bfd_boolean xlat_basename; + + /* Issue an error message. */ + +@@ -680,6 +699,8 @@ + + if (name == NULL) + name = ""; ++ else ++ name = debug_xlat_pathname (name); + + nfile = (struct debug_file *) xmalloc (sizeof *nfile); + memset (nfile, 0, sizeof *nfile); +@@ -720,6 +741,8 @@ + + if (name == NULL) + name = ""; ++ else ++ name = debug_xlat_pathname (name); + + if (info->current_unit == NULL) + { +@@ -3370,3 +3393,69 @@ + + return TRUE; + } ++ ++/* Register a pathname translation. */ ++void ++debug_register_pathname_xlat (oname, nname) ++ const char *oname; ++ const char *nname; ++{ ++ struct xlat_list *xlp; ++ ++ /* Special case: if oname is given as NULL, this means the ++ --basename option has been given to objcopy. */ ++ if (oname == NULL) ++ { ++ xlat_basename = TRUE; ++ return; ++ } ++ ++ xlp = (struct xlat_list *) xmalloc (sizeof (struct xlat_list)); ++ xlp->next = NULL; ++ if (xlat == NULL) ++ xlat = xltail = xlp; ++ else ++ { ++ xltail->next = xlp; ++ xltail = xlp; ++ } ++ xlp->old = oname; ++ xlp->newstr = nname; ++ xlp->olen = strlen (oname); ++ xlp->nlen = strlen (nname); ++} ++ ++/* Try to translate a pathname. */ ++static const char * ++debug_xlat_pathname (oname) ++ const char *oname; ++{ ++ struct xlat_list *xlp; ++ char *cp; ++ size_t olen; ++ ++ if (xlat_basename) ++ return bu_basename (oname); ++ ++ olen = strlen (oname); ++ for (xlp = xlat; xlp; xlp = xlp->next) ++ { ++ if (xlp->olen > olen) ++ /* This cannot be our turn. */ ++ continue; ++ /* Since we have pre-computed all our length values to avoid ++ repetitively computing them, just use memcmp() since it's ++ faster than strcmp(). */ ++ if (memcmp (xlp->old, oname, xlp->olen) == 0) ++ { ++ cp = (char *) xmalloc (olen + xlp->nlen - xlp->olen + 1); ++ memcpy (cp, xlp->newstr, xlp->nlen); ++ memcpy (cp + xlp->nlen, oname + xlp->olen, ++ olen - xlp->olen + 1); ++ return cp; ++ } ++ } ++ ++ /* Not found, pass the original name on. */ ++ return oname; ++} +--- ./binutils/bucomm.h.orig 2007-08-30 12:19:03.000000000 +0200 ++++ ./binutils/bucomm.h 2009-01-06 17:45:34.000000000 +0100 +@@ -57,6 +57,8 @@ + + off_t get_file_size (const char *); + ++const char *bu_basename PARAMS ((const char *)); ++ + extern char *program_name; + + /* filemode.c */ +--- ./include/coff/internal.h.orig 2007-07-12 09:16:41.000000000 +0200 ++++ ./include/coff/internal.h 2009-01-06 17:45:34.000000000 +0100 +@@ -630,6 +630,8 @@ + + }; + ++#define NAUXENTS 10 /* number of pre-allocated aux entries */ ++ + /********************** RELOCATION DIRECTIVES **********************/ + + struct internal_reloc +--- ./include/coff/avr.h.orig 2009-01-06 17:45:34.000000000 +0100 ++++ ./include/coff/avr.h 2009-01-06 17:45:34.000000000 +0100 +@@ -0,0 +1,110 @@ ++/* coff information for Atmel AVR. ++ ++ Copyright 2001 Free Software Foundation, Inc. ++ ++ This program is free software; you can redistribute it and/or modify ++ it under the terms of the GNU General Public License as published by ++ the Free Software Foundation; either version 2 of the License, or ++ (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ++ ++/* This file was hacked from i860.h */ ++ ++#define L_LNNO_SIZE 2 ++#include "coff/external.h" ++ ++/* Bits for f_flags: ++ F_RELFLG relocation info stripped from file ++ F_EXEC file is executable (no unresolved external references) ++ F_LNNO line numbers stripped from file ++ F_LSYMS local symbols stripped from file */ ++ ++#define F_RELFLG (0x0001) ++#define F_EXEC (0x0002) ++#define F_LNNO (0x0004) ++#define F_LSYMS (0x0008) ++/* Upper nibble of flags always needs to be set. This used to be ++ * undocumented, recent information from Atmel says that bit 7 used to ++ * differentiate between an old vendor-specific deviation of the ++ * format and the current format. */ ++#define F_JUNK (0x00f0) ++#define F_UNUSED (0xff00) ++ ++#define AVRMAGIC 0xa12 ++ ++#undef AOUTSZ ++#ifdef AVR_EXT_COFF ++ ++/* AVR "extended" COFF format. This uses the optional header ("a.out" ++ header) to inform the consumer about some additional features that ++ are supported. */ ++#define COFF_LONG_FILENAMES yes /* long filenames supported in consecutive aux entries */ ++#define AOUTSZ 28 /* size of optional header in "extended" COFF */ ++ ++/* Flags in the optional header; they are stored in the vstamp field. */ ++#define F_FULLPATHS 0x0001 /* long filenames supported */ ++#define F_STRUCTINFO 0x0002 /* structure information contained */ ++#define F_PTRINFO 0x0004 /* inter-segment pointers supported */ ++ ++#else /* old AVR COFF */ ++ ++#define AOUTSZ 0 /* no a.out for AVR */ ++#endif ++ ++/* #define AVRAOUTMAGIC 0x406 */ /* "general" magic number of optional header */ ++/* ++ * The following magic number causes AVR Studio 4.x to recognize ++ * avr-gcc/GNU binutils produced AVR extended COFF files. By now, ++ * the only special treatment for them is that the contents of .data ++ * will be appended after .text in the simulator flash. ++ * ++ * 0x9cc has been chosen since it resembles "gcc". ;-) ++ */ ++#define AVRAOUTMAGIC 0x9cc /* "gcc" magic number */ ++ ++/* By matching not only the magic number, but also the size of the ++ optional a.out header, we can differentiate between both ++ formats. */ ++#define AVRBADMAG(x) ((x).f_magic != AVRMAGIC || (x).f_opthdr != AOUTSZ) ++ ++/* AVR COFF has several anomalities in the way the handle the derived ++ type information, and AUX entries, mainly because they apparently ++ didn't bother to learn how COFF is supposed to work before they ++ started. We fix many of them at the export/import boundary, so all ++ the internal generic COFF handling will work mostly as designed. */ ++ ++/* NB: these functions are only defined in bfd/coff-avr.c, but also ++ used in coff-ext-avr.c, so the latter can only be configured if the ++ former is also present. This is certainly always the case ++ anyway. */ ++extern void avr_coff_adjust_sym_in_post ++ PARAMS((bfd *, PTR, PTR)); ++ ++extern void avr_coff_adjust_sym_out_post ++ PARAMS((bfd *, PTR, PTR)); ++ ++#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \ ++ avr_coff_adjust_sym_in_post (ABFD, EXT, INT) ++ ++#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \ ++ avr_coff_adjust_sym_out_post (ABFD, INT, EXT) ++ ++/********************** RELOCATION DIRECTIVES **********************/ ++ ++struct external_reloc ++{ ++ char r_vaddr[4]; ++ char r_symndx[4]; ++ char r_type[2]; ++}; ++ ++#define RELOC struct external_reloc ++#define RELSZ 10 +--- ./bfd/coffgen.c.orig 2008-08-14 04:38:22.000000000 +0200 ++++ ./bfd/coffgen.c 2009-01-06 17:45:34.000000000 +0100 +@@ -687,6 +687,20 @@ + if (last_file != NULL) + last_file->n_value = native_index; + last_file = &(s->u.syment); ++ if (bfd_get_arch (bfd_ptr) == bfd_arch_avr ++ && bfd_coff_long_filenames (bfd_ptr) ++ && s->u.syment.n_numaux > 0) ++ { ++ /* AVR COFF records long filenames in successive aux ++ records. Adjust the number of aux records ++ required here, so the renumbering will account ++ for them. */ ++ unsigned int filnmlen = bfd_coff_filnmlen (bfd_ptr); ++ unsigned int namelen = strlen (coff_symbol_ptr->symbol.name); ++ unsigned int n = (namelen + filnmlen - 1) / filnmlen; ++ ++ s->u.syment.n_numaux = n > NAUXENTS? NAUXENTS: n; ++ } + } + else + /* Modify the symbol values according to their section and +@@ -815,6 +829,20 @@ + { + if (name_length <= filnmlen) + strncpy (auxent->x_file.x_fname, name, filnmlen); ++ else if (bfd_get_arch (abfd) == bfd_arch_avr) ++ { ++ /* AVR COFF records long filenames in successive aux records. */ ++ int i = 1; ++ while (name_length > filnmlen && i < NAUXENTS) ++ { ++ strncpy (auxent->x_file.x_fname, name, filnmlen); ++ name += filnmlen; ++ name_length -= filnmlen; ++ i++; ++ auxent = &(native + i)->u.auxent; ++ } ++ strncpy (auxent->x_file.x_fname, name, filnmlen); ++ } + else + { + auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE; +@@ -1218,7 +1246,11 @@ + if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6) + return FALSE; + } +- maxlen = bfd_coff_filnmlen (abfd); ++ if (bfd_get_arch (abfd) == bfd_arch_avr) ++ /* AVR COFF handles long file names in aux records. */ ++ maxlen = name_length; ++ else ++ maxlen = bfd_coff_filnmlen (abfd); + } + else + maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; +@@ -1655,14 +1687,27 @@ + { + /* Ordinary short filename, put into memory anyway. The + Microsoft PE tools sometimes store a filename in +- multiple AUX entries. */ ++ multiple AUX entries. ++ AVR COFF does it that way, too. */ + if (internal_ptr->u.syment.n_numaux > 1 +- && coff_data (abfd)->pe) +- internal_ptr->u.syment._n._n_n._n_offset = +- ((bfd_hostptr_t) +- copy_name (abfd, +- (internal_ptr + 1)->u.auxent.x_file.x_fname, +- internal_ptr->u.syment.n_numaux * symesz)); ++ && (coff_data (abfd)->pe ++ || (bfd_get_arch (abfd) == bfd_arch_avr))) ++ { ++ char *b; ++ unsigned int i; ++ ++ /* We allocate enough storage to fit the contents of ++ this many aux records, and simply append a \0. ++ This ensures the string will always be ++ terminated, even in the case where it just fit ++ into the aux records. */ ++ b = (char *) bfd_alloc (abfd, ++ internal_ptr->u.syment.n_numaux * FILNMLEN + 1); ++ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) b; ++ b[internal_ptr->u.syment.n_numaux * FILNMLEN] = '\0'; ++ for (i = 0; i < internal_ptr->u.syment.n_numaux; i++, b += FILNMLEN) ++ memcpy (b, (internal_ptr + i + 1)->u.auxent.x_file.x_fname, FILNMLEN); ++ } + else + internal_ptr->u.syment._n._n_n._n_offset = + ((bfd_hostptr_t) +@@ -1768,9 +1813,9 @@ + + if (new == NULL) + return NULL; +- /* @@ The 10 is a guess at a plausible maximum number of aux entries +- (but shouldn't be a constant). */ +- amt = sizeof (combined_entry_type) * 10; ++ /* @@ The NAUXENTS is a guess at a plausible maximum number of aux ++ entries (but shouldn't be a constant). */ ++ amt = sizeof (combined_entry_type) * (NAUXENTS + 1); + new->native = bfd_zalloc (abfd, amt); + if (!new->native) + return NULL; +--- ./bfd/configure.orig 2008-10-16 15:20:42.000000000 +0200 ++++ ./bfd/configure 2009-01-06 17:45:34.000000000 +0100 +@@ -19626,6 +19626,8 @@ + armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; ++ avrcoff_vec) tb="$tb coff-avr.lo cofflink.lo " ;; ++ avrextcoff_vec) tb="$tb coff-ext-avr.lo cofflink.lo " ;; + b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; + b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; + bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; +--- ./bfd/targets.c.orig 2008-02-14 16:20:26.000000000 +0100 ++++ ./bfd/targets.c 2009-01-06 17:45:34.000000000 +0100 +@@ -558,6 +558,8 @@ + extern const bfd_target armpe_little_vec; + extern const bfd_target armpei_big_vec; + extern const bfd_target armpei_little_vec; ++extern const bfd_target avrcoff_vec; ++extern const bfd_target avrextcoff_vec; + extern const bfd_target b_out_vec_big_host; + extern const bfd_target b_out_vec_little_host; + extern const bfd_target bfd_efi_app_ia32_vec; +@@ -882,6 +884,8 @@ + &armpe_little_vec, + &armpei_big_vec, + &armpei_little_vec, ++ &avrcoff_vec, ++ &avrextcoff_vec, + &b_out_vec_big_host, + &b_out_vec_little_host, + &bfd_efi_app_ia32_vec, +--- ./bfd/configure.in.orig 2008-10-16 15:20:34.000000000 +0200 ++++ ./bfd/configure.in 2009-01-06 17:45:34.000000000 +0100 +@@ -619,6 +619,8 @@ + armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; + armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; + armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; ++ avrcoff_vec) tb="$tb coff-avr.lo cofflink.lo " ;; ++ avrextcoff_vec) tb="$tb coff-ext-avr.lo cofflink.lo " ;; + b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; + b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; + bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; +--- ./bfd/Makefile.in.orig 2009-01-06 17:33:01.000000000 +0100 ++++ ./bfd/Makefile.in 2009-01-06 17:45:34.000000000 +0100 +@@ -462,6 +462,8 @@ coff-apollo.lo \ coff-arm.lo \ coff-aux.lo \ @@ -4027,7 +4236,7 @@ diff -Nur ../binutils-2.18.orig/bfd/Makefile.in ./bfd/Makefile.in coff-h8300.lo \ coff-h8500.lo \ coff-i386.lo \ -@@ -637,6 +639,8 @@ +@@ -643,6 +645,8 @@ coff-apollo.c \ coff-arm.c \ coff-aux.c \ @@ -4036,7 +4245,7 @@ diff -Nur ../binutils-2.18.orig/bfd/Makefile.in ./bfd/Makefile.in coff-h8300.c \ coff-h8500.c \ coff-i386.c \ -@@ -1556,13 +1560,13 @@ +@@ -1573,13 +1577,13 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in @echo "creating $@" @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ @@ -4052,9 +4261,9 @@ diff -Nur ../binutils-2.18.orig/bfd/Makefile.in ./bfd/Makefile.in bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ fi ;\ sed -e "s,@bfd_version@,$$bfd_version," \ -@@ -1766,6 +1770,12 @@ - coff-m68k.c $(INCDIR)/hashtab.h $(INCDIR)/coff/m68k.h \ - $(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \ +@@ -1783,6 +1787,12 @@ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ coffcode.h coffswap.h +coff-avr.lo: coff-avr.c $(INCDIR)/filenames.h $(INCDIR)/coff/avr.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ @@ -4065,10 +4274,19 @@ diff -Nur ../binutils-2.18.orig/bfd/Makefile.in ./bfd/Makefile.in coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ -diff -Nur ../binutils-2.18.orig/bfd/coff-avr.c ./bfd/coff-avr.c ---- ../binutils-2.18.orig/bfd/coff-avr.c Thu Jan 1 01:00:00 1970 -+++ ./bfd/coff-avr.c Tue Oct 23 22:18:44 2007 -@@ -0,0 +1,609 @@ +--- ./bfd/config.bfd.orig 2008-04-16 20:02:01.000000000 +0200 ++++ ./bfd/config.bfd 2009-01-06 17:45:34.000000000 +0100 +@@ -328,6 +328,7 @@ + + avr-*-*) + targ_defvec=bfd_elf32_avr_vec ++ targ_selvecs="bfd_elf32_avr_vec avrcoff_vec avrextcoff_vec" + ;; + + bfin-*-*) +--- ./bfd/coff-avr.c.orig 2009-01-06 17:45:34.000000000 +0100 ++++ ./bfd/coff-avr.c 2009-01-06 17:45:34.000000000 +0100 +@@ -0,0 +1,613 @@ +/* BFD back-end for Atmel AVR COFF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003 + Free Software Foundation, Inc. @@ -4428,6 +4646,10 @@ diff -Nur ../binutils-2.18.orig/bfd/coff-avr.c ./bfd/coff-avr.c + +#define coff_rtype_to_howto coff_avr_rtype_to_howto + ++#ifndef bfd_pe_print_pdata ++#define bfd_pe_print_pdata NULL ++#endif ++ +#include "coffcode.h" + +static const bfd_target * @@ -4678,10 +4900,58 @@ diff -Nur ../binutils-2.18.orig/bfd/coff-avr.c ./bfd/coff-avr.c + + COFF_SWAP_TABLE +}; -diff -Nur ../binutils-2.18.orig/bfd/coff-ext-avr.c ./bfd/coff-ext-avr.c ---- ../binutils-2.18.orig/bfd/coff-ext-avr.c Thu Jan 1 01:00:00 1970 -+++ ./bfd/coff-ext-avr.c Tue Oct 23 22:18:44 2007 -@@ -0,0 +1,424 @@ +--- ./bfd/Makefile.am.orig 2008-10-16 15:20:34.000000000 +0200 ++++ ./bfd/Makefile.am 2009-01-06 17:45:34.000000000 +0100 +@@ -208,6 +208,8 @@ + coff-apollo.lo \ + coff-arm.lo \ + coff-aux.lo \ ++ coff-avr.lo \ ++ coff-ext-avr.lo \ + coff-h8300.lo \ + coff-h8500.lo \ + coff-i386.lo \ +@@ -389,6 +391,8 @@ + coff-apollo.c \ + coff-arm.c \ + coff-aux.c \ ++ coff-avr.c \ ++ coff-ext-avr.c \ + coff-h8300.c \ + coff-h8500.c \ + coff-i386.c \ +@@ -988,13 +992,13 @@ + bfdver.h: $(srcdir)/version.h $(srcdir)/Makefile.in + @echo "creating $@" + @bfd_version=`echo "$(VERSION)" | sed -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\ +- bfd_version_string="\"$(VERSION)\"" ;\ ++ bfd_version_string="\"$(VERSION) + coff-avr-patch (20050630)\"" ;\ + bfd_soversion="$(VERSION)" ;\ + bfd_version_package="\"$(PKGVERSION)\"" ;\ + report_bugs_to="\"$(REPORT_BUGS_TO)\"" ;\ + if test "x$(RELEASE)" = x ; then \ + bfd_version_date=`sed -n -e 's/.*DATE //p' < $(srcdir)/version.h` ;\ +- bfd_version_string="\"$(VERSION).$${bfd_version_date}\"" ;\ ++ bfd_version_string="\"$(VERSION).$${bfd_version_date} + coff-avr-patch (20050630)\"" ;\ + bfd_soversion="$(VERSION).$${bfd_version_date}" ;\ + fi ;\ + sed -e "s,@bfd_version@,$$bfd_version," \ +@@ -1198,6 +1202,12 @@ + $(INCDIR)/coff/internal.h $(INCDIR)/coff/m68k.h $(INCDIR)/coff/external.h \ + coff-m68k.c $(INCDIR)/hashtab.h libcoff.h $(INCDIR)/bfdlink.h \ + coffcode.h coffswap.h ++coff-avr.lo: coff-avr.c $(INCDIR)/filenames.h $(INCDIR)/coff/avr.h \ ++ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ ++ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h ++coff-ext-avr.lo: coff-ext-avr.c $(INCDIR)/filenames.h $(INCDIR)/coff/avr.h \ ++ $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ ++ libcoff.h $(INCDIR)/bfdlink.h coffcode.h coffswap.h + coff-h8300.lo: coff-h8300.c $(INCDIR)/filenames.h $(INCDIR)/hashtab.h \ + $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/coff/h8300.h \ + $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \ +--- ./bfd/coff-ext-avr.c.orig 2009-01-06 17:45:34.000000000 +0100 ++++ ./bfd/coff-ext-avr.c 2009-01-06 17:45:34.000000000 +0100 +@@ -0,0 +1,428 @@ +/* BFD back-end for Atmel AVR "extended" COFF files. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003 + Free Software Foundation, Inc. @@ -5043,6 +5313,10 @@ diff -Nur ../binutils-2.18.orig/bfd/coff-ext-avr.c ./bfd/coff-ext-avr.c + +#define coff_rtype_to_howto coff_ext_avr_rtype_to_howto + ++#ifndef bfd_pe_print_pdata ++#define bfd_pe_print_pdata NULL ++#endif ++ +#include "coffcode.h" + +static const bfd_target * @@ -5106,15 +5380,14 @@ diff -Nur ../binutils-2.18.orig/bfd/coff-ext-avr.c ./bfd/coff-ext-avr.c + + COFF_SWAP_TABLE +}; -diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h ---- ../binutils-2.18.orig/bfd/coffcode.h Tue Oct 23 21:44:07 2007 -+++ ./bfd/coffcode.h Tue Oct 23 22:18:44 2007 +--- ./bfd/coffcode.h.orig 2008-08-05 05:03:46.000000000 +0200 ++++ ./bfd/coffcode.h 2009-01-06 17:45:34.000000000 +0100 @@ -1,3 +1,4 @@ + /* Support for the generic parts of most COFF variants, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 -@@ -1769,6 +1770,17 @@ + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +@@ -1777,6 +1778,17 @@ coff->relocbase = 0; coff->local_toc_sym_map = 0; @@ -5132,7 +5405,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h /* make_abs_section(abfd);*/ return TRUE; -@@ -1793,17 +1805,6 @@ +@@ -1801,17 +1813,6 @@ coff->sym_filepos = internal_f->f_symptr; @@ -5150,7 +5423,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h coff->timestamp = internal_f->f_timdat; obj_raw_syment_count (abfd) = -@@ -1930,6 +1931,11 @@ +@@ -1938,6 +1939,11 @@ } break; #endif @@ -5162,7 +5435,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h #ifdef MC68MAGIC case MC68MAGIC: case M68MAGIC: -@@ -2726,6 +2732,13 @@ +@@ -2734,6 +2740,13 @@ return TRUE; #endif @@ -5176,7 +5449,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h #ifdef PPCMAGIC case bfd_arch_powerpc: *magicp = PPCMAGIC; -@@ -3522,6 +3535,11 @@ +@@ -3530,6 +3543,11 @@ section.s_page = coff_get_section_load_page (current); #endif @@ -5188,7 +5461,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h #ifdef COFF_WITH_PE section.s_paddr = 0; #endif -@@ -3866,6 +3884,17 @@ +@@ -3874,6 +3892,17 @@ internal_a.magic = ZMAGIC; #endif @@ -5206,7 +5479,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h #if defined(PPC_PE) #define __A_MAGIC_SET__ internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC; -@@ -3933,8 +3962,16 @@ +@@ -3941,8 +3970,16 @@ #endif } @@ -5223,7 +5496,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h /* Now should write relocs, strings, syms. */ obj_sym_filepos (abfd) = sym_base; -@@ -4120,22 +4157,29 @@ +@@ -4128,22 +4165,29 @@ char * buff; bfd_size_type amount = bfd_coff_aoutsz (abfd); @@ -5263,7 +5536,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h } #ifdef RS6000COFF_C else -@@ -4491,6 +4535,10 @@ +@@ -4500,6 +4544,10 @@ /* In PE, 0x69 (105) denotes a weak external symbol. */ case C_NT_WEAK: #endif @@ -5274,7 +5547,7 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h switch (coff_classify_symbol (abfd, &src->u.syment)) { case COFF_SYMBOL_GLOBAL: -@@ -4714,7 +4762,9 @@ +@@ -4723,7 +4771,9 @@ && src->u.syment.n_scnum == 0) break; /* Fall through. */ @@ -5284,115 +5557,8 @@ diff -Nur ../binutils-2.18.orig/bfd/coffcode.h ./bfd/coffcode.h case C_ULABEL: /* Undefined label. */ case C_USTATIC: /* Undefined static. */ #ifndef COFF_WITH_PE -diff -Nur ../binutils-2.18.orig/bfd/coffgen.c ./bfd/coffgen.c ---- ../binutils-2.18.orig/bfd/coffgen.c Tue Oct 23 21:44:07 2007 -+++ ./bfd/coffgen.c Tue Oct 23 23:07:23 2007 -@@ -687,6 +687,20 @@ - if (last_file != NULL) - last_file->n_value = native_index; - last_file = &(s->u.syment); -+ if (bfd_get_arch (bfd_ptr) == bfd_arch_avr -+ && bfd_coff_long_filenames (bfd_ptr) -+ && s->u.syment.n_numaux > 0) -+ { -+ /* AVR COFF records long filenames in successive aux -+ records. Adjust the number of aux records -+ required here, so the renumbering will account -+ for them. */ -+ unsigned int filnmlen = bfd_coff_filnmlen (bfd_ptr); -+ unsigned int namelen = strlen (coff_symbol_ptr->symbol.name); -+ unsigned int n = (namelen + filnmlen - 1) / filnmlen; -+ -+ s->u.syment.n_numaux = n > NAUXENTS? NAUXENTS: n; -+ } - } - else - /* Modify the symbol values according to their section and -@@ -815,6 +829,20 @@ - { - if (name_length <= filnmlen) - strncpy (auxent->x_file.x_fname, name, filnmlen); -+ else if (bfd_get_arch (abfd) == bfd_arch_avr) -+ { -+ /* AVR COFF records long filenames in successive aux records. */ -+ int i = 1; -+ while (name_length > filnmlen && i < NAUXENTS) -+ { -+ strncpy (auxent->x_file.x_fname, name, filnmlen); -+ name += filnmlen; -+ name_length -= filnmlen; -+ i++; -+ auxent = &(native + i)->u.auxent; -+ } -+ strncpy (auxent->x_file.x_fname, name, filnmlen); -+ } - else - { - auxent->x_file.x_n.x_offset = *string_size_p + STRING_SIZE_SIZE; -@@ -1218,7 +1246,11 @@ - if (bfd_bwrite (".file", (bfd_size_type) 6, abfd) != 6) - return FALSE; - } -- maxlen = bfd_coff_filnmlen (abfd); -+ if (bfd_get_arch (abfd) == bfd_arch_avr) -+ /* AVR COFF handles long file names in aux records. */ -+ maxlen = name_length; -+ else -+ maxlen = bfd_coff_filnmlen (abfd); - } - else - maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; -@@ -1655,14 +1687,27 @@ - { - /* Ordinary short filename, put into memory anyway. The - Microsoft PE tools sometimes store a filename in -- multiple AUX entries. */ -+ multiple AUX entries. -+ AVR COFF does it that way, too. */ - if (internal_ptr->u.syment.n_numaux > 1 -- && coff_data (abfd)->pe) -- internal_ptr->u.syment._n._n_n._n_offset = -- ((bfd_hostptr_t) -- copy_name (abfd, -- (internal_ptr + 1)->u.auxent.x_file.x_fname, -- internal_ptr->u.syment.n_numaux * symesz)); -+ && (coff_data (abfd)->pe -+ || (bfd_get_arch (abfd) == bfd_arch_avr))) -+ { -+ char *b; -+ unsigned int i; -+ -+ /* We allocate enough storage to fit the contents of -+ this many aux records, and simply append a \0. -+ This ensures the string will always be -+ terminated, even in the case where it just fit -+ into the aux records. */ -+ b = (char *) bfd_alloc (abfd, -+ internal_ptr->u.syment.n_numaux * FILNMLEN + 1); -+ internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) b; -+ b[internal_ptr->u.syment.n_numaux * FILNMLEN] = '\0'; -+ for (i = 0; i < internal_ptr->u.syment.n_numaux; i++, b += FILNMLEN) -+ memcpy (b, (internal_ptr + i + 1)->u.auxent.x_file.x_fname, FILNMLEN); -+ } - else - internal_ptr->u.syment._n._n_n._n_offset = - ((bfd_hostptr_t) -@@ -1768,9 +1813,9 @@ - - if (new == NULL) - return NULL; -- /* @@ The 10 is a guess at a plausible maximum number of aux entries -- (but shouldn't be a constant). */ -- amt = sizeof (combined_entry_type) * 10; -+ /* @@ The NAUXENTS is a guess at a plausible maximum number of aux -+ entries (but shouldn't be a constant). */ -+ amt = sizeof (combined_entry_type) * (NAUXENTS + 1); - new->native = bfd_zalloc (abfd, amt); - if (!new->native) - return NULL; -diff -Nur ../binutils-2.18.orig/bfd/coffswap.h ./bfd/coffswap.h ---- ../binutils-2.18.orig/bfd/coffswap.h Tue Oct 23 21:44:07 2007 -+++ ./bfd/coffswap.h Tue Oct 23 22:18:44 2007 +--- ./bfd/coffswap.h.orig 2007-07-03 16:26:40.000000000 +0200 ++++ ./bfd/coffswap.h 2009-01-06 17:45:34.000000000 +0100 @@ -383,7 +383,11 @@ void * ext1, int type, @@ -5420,185 +5586,3 @@ diff -Nur ../binutils-2.18.orig/bfd/coffswap.h ./bfd/coffswap.h } else memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN); -diff -Nur ../binutils-2.18.orig/bfd/config.bfd ./bfd/config.bfd ---- ../binutils-2.18.orig/bfd/config.bfd Tue Oct 23 21:44:07 2007 -+++ ./bfd/config.bfd Tue Oct 23 22:18:44 2007 -@@ -327,6 +327,7 @@ - - avr-*-*) - targ_defvec=bfd_elf32_avr_vec -+ targ_selvecs="bfd_elf32_avr_vec avrcoff_vec avrextcoff_vec" - ;; - - bfin-*-*) -diff -Nur ../binutils-2.18.orig/bfd/configure ./bfd/configure ---- ../binutils-2.18.orig/bfd/configure Tue Oct 23 21:44:09 2007 -+++ ./bfd/configure Tue Oct 23 22:18:44 2007 -@@ -19034,6 +19034,8 @@ - armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; -+ avrcoff_vec) tb="$tb coff-avr.lo cofflink.lo " ;; -+ avrextcoff_vec) tb="$tb coff-ext-avr.lo cofflink.lo " ;; - b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; - b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; - bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; -diff -Nur ../binutils-2.18.orig/bfd/configure.in ./bfd/configure.in ---- ../binutils-2.18.orig/bfd/configure.in Tue Oct 23 21:44:07 2007 -+++ ./bfd/configure.in Tue Oct 23 22:18:44 2007 -@@ -612,6 +612,8 @@ - armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;; - armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; - armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;; -+ avrcoff_vec) tb="$tb coff-avr.lo cofflink.lo " ;; -+ avrextcoff_vec) tb="$tb coff-ext-avr.lo cofflink.lo " ;; - b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;; - b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;; - bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;; -diff -Nur ../binutils-2.18.orig/bfd/targets.c ./bfd/targets.c ---- ../binutils-2.18.orig/bfd/targets.c Tue Oct 23 21:44:09 2007 -+++ ./bfd/targets.c Tue Oct 23 22:18:44 2007 -@@ -558,6 +558,8 @@ - extern const bfd_target armpe_little_vec; - extern const bfd_target armpei_big_vec; - extern const bfd_target armpei_little_vec; -+extern const bfd_target avrcoff_vec; -+extern const bfd_target avrextcoff_vec; - extern const bfd_target b_out_vec_big_host; - extern const bfd_target b_out_vec_little_host; - extern const bfd_target bfd_efi_app_ia32_vec; -@@ -876,6 +878,8 @@ - &armpe_little_vec, - &armpei_big_vec, - &armpei_little_vec, -+ &avrcoff_vec, -+ &avrextcoff_vec, - &b_out_vec_big_host, - &b_out_vec_little_host, - &bfd_efi_app_ia32_vec, -diff -Nur ../binutils-2.18.orig/include/coff/avr.h ./include/coff/avr.h ---- ../binutils-2.18.orig/include/coff/avr.h Thu Jan 1 01:00:00 1970 -+++ ./include/coff/avr.h Tue Oct 23 22:18:44 2007 -@@ -0,0 +1,110 @@ -+/* coff information for Atmel AVR. -+ -+ Copyright 2001 Free Software Foundation, Inc. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program; if not, write to the Free Software -+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -+ -+/* This file was hacked from i860.h */ -+ -+#define L_LNNO_SIZE 2 -+#include "coff/external.h" -+ -+/* Bits for f_flags: -+ F_RELFLG relocation info stripped from file -+ F_EXEC file is executable (no unresolved external references) -+ F_LNNO line numbers stripped from file -+ F_LSYMS local symbols stripped from file */ -+ -+#define F_RELFLG (0x0001) -+#define F_EXEC (0x0002) -+#define F_LNNO (0x0004) -+#define F_LSYMS (0x0008) -+/* Upper nibble of flags always needs to be set. This used to be -+ * undocumented, recent information from Atmel says that bit 7 used to -+ * differentiate between an old vendor-specific deviation of the -+ * format and the current format. */ -+#define F_JUNK (0x00f0) -+#define F_UNUSED (0xff00) -+ -+#define AVRMAGIC 0xa12 -+ -+#undef AOUTSZ -+#ifdef AVR_EXT_COFF -+ -+/* AVR "extended" COFF format. This uses the optional header ("a.out" -+ header) to inform the consumer about some additional features that -+ are supported. */ -+#define COFF_LONG_FILENAMES yes /* long filenames supported in consecutive aux entries */ -+#define AOUTSZ 28 /* size of optional header in "extended" COFF */ -+ -+/* Flags in the optional header; they are stored in the vstamp field. */ -+#define F_FULLPATHS 0x0001 /* long filenames supported */ -+#define F_STRUCTINFO 0x0002 /* structure information contained */ -+#define F_PTRINFO 0x0004 /* inter-segment pointers supported */ -+ -+#else /* old AVR COFF */ -+ -+#define AOUTSZ 0 /* no a.out for AVR */ -+#endif -+ -+/* #define AVRAOUTMAGIC 0x406 */ /* "general" magic number of optional header */ -+/* -+ * The following magic number causes AVR Studio 4.x to recognize -+ * avr-gcc/GNU binutils produced AVR extended COFF files. By now, -+ * the only special treatment for them is that the contents of .data -+ * will be appended after .text in the simulator flash. -+ * -+ * 0x9cc has been chosen since it resembles "gcc". ;-) -+ */ -+#define AVRAOUTMAGIC 0x9cc /* "gcc" magic number */ -+ -+/* By matching not only the magic number, but also the size of the -+ optional a.out header, we can differentiate between both -+ formats. */ -+#define AVRBADMAG(x) ((x).f_magic != AVRMAGIC || (x).f_opthdr != AOUTSZ) -+ -+/* AVR COFF has several anomalities in the way the handle the derived -+ type information, and AUX entries, mainly because they apparently -+ didn't bother to learn how COFF is supposed to work before they -+ started. We fix many of them at the export/import boundary, so all -+ the internal generic COFF handling will work mostly as designed. */ -+ -+/* NB: these functions are only defined in bfd/coff-avr.c, but also -+ used in coff-ext-avr.c, so the latter can only be configured if the -+ former is also present. This is certainly always the case -+ anyway. */ -+extern void avr_coff_adjust_sym_in_post -+ PARAMS((bfd *, PTR, PTR)); -+ -+extern void avr_coff_adjust_sym_out_post -+ PARAMS((bfd *, PTR, PTR)); -+ -+#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \ -+ avr_coff_adjust_sym_in_post (ABFD, EXT, INT) -+ -+#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \ -+ avr_coff_adjust_sym_out_post (ABFD, INT, EXT) -+ -+/********************** RELOCATION DIRECTIVES **********************/ -+ -+struct external_reloc -+{ -+ char r_vaddr[4]; -+ char r_symndx[4]; -+ char r_type[2]; -+}; -+ -+#define RELOC struct external_reloc -+#define RELSZ 10 -diff -Nur ../binutils-2.18.orig/include/coff/internal.h ./include/coff/internal.h ---- ../binutils-2.18.orig/include/coff/internal.h Tue Oct 23 21:44:43 2007 -+++ ./include/coff/internal.h Tue Oct 23 22:18:44 2007 -@@ -630,6 +630,8 @@ - - }; - -+#define NAUXENTS 10 /* number of pre-allocated aux entries */ -+ - /********************** RELOCATION DIRECTIVES **********************/ - - struct internal_reloc diff --git a/devel/avr-binutils/files/patch-data-origin b/devel/avr-binutils/files/patch-data-origin index e46644e15feb..0ff530f6d1d0 100644 --- a/devel/avr-binutils/files/patch-data-origin +++ b/devel/avr-binutils/files/patch-data-origin @@ -1,27 +1,5 @@ -Not committed. -Patch by Anatoly Sokolov --------------------------------------------------------------------------------- -Index: ld/emulparams/avr1.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr1.sh,v -retrieving revision 1.2 -diff -u -r1.2 avr1.sh ---- ld/emulparams/avr1.sh 24 May 2006 07:36:11 -0000 1.2 -+++ ld/emulparams/avr1.sh 29 Feb 2008 23:39:37 -0000 -@@ -7,5 +7,6 @@ - TEMPLATE_NAME=elf32 - - TEXT_LENGTH=8K -+DATA_ORIGIN=0x800060 - DATA_LENGTH=0 - EXTRA_EM_FILE=avrelf -Index: ld/emulparams/avr2.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr2.sh,v -retrieving revision 1.2 -diff -u -r1.2 avr2.sh ---- ld/emulparams/avr2.sh 24 May 2006 07:36:11 -0000 1.2 -+++ ld/emulparams/avr2.sh 29 Feb 2008 23:39:37 -0000 +--- ./ld/emulparams/avr4.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr4.sh 2009-01-06 17:53:32.000000000 +0100 @@ -7,5 +7,6 @@ TEMPLATE_NAME=elf32 @@ -29,13 +7,8 @@ diff -u -r1.2 avr2.sh +DATA_ORIGIN=0x800060 DATA_LENGTH=0xffa0 EXTRA_EM_FILE=avrelf -Index: ld/emulparams/avr3.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr3.sh,v -retrieving revision 1.2 -diff -u -r1.2 avr3.sh ---- ld/emulparams/avr3.sh 24 May 2006 07:36:11 -0000 1.2 -+++ ld/emulparams/avr3.sh 29 Feb 2008 23:39:37 -0000 +--- ./ld/emulparams/avr5.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr5.sh 2009-01-06 17:53:32.000000000 +0100 @@ -7,5 +7,6 @@ TEMPLATE_NAME=elf32 @@ -43,13 +16,8 @@ diff -u -r1.2 avr3.sh +DATA_ORIGIN=0x800060 DATA_LENGTH=0xffa0 EXTRA_EM_FILE=avrelf -Index: ld/emulparams/avr4.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr4.sh,v -retrieving revision 1.2 -diff -u -r1.2 avr4.sh ---- ld/emulparams/avr4.sh 24 May 2006 07:36:11 -0000 1.2 -+++ ld/emulparams/avr4.sh 29 Feb 2008 23:39:37 -0000 +--- ./ld/emulparams/avr2.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr2.sh 2009-01-06 17:53:32.000000000 +0100 @@ -7,5 +7,6 @@ TEMPLATE_NAME=elf32 @@ -57,27 +25,17 @@ diff -u -r1.2 avr4.sh +DATA_ORIGIN=0x800060 DATA_LENGTH=0xffa0 EXTRA_EM_FILE=avrelf -Index: ld/emulparams/avr5.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr5.sh,v -retrieving revision 1.2 -diff -u -r1.2 avr5.sh ---- ld/emulparams/avr5.sh 24 May 2006 07:36:11 -0000 1.2 -+++ ld/emulparams/avr5.sh 29 Feb 2008 23:39:37 -0000 +--- ./ld/emulparams/avr1.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr1.sh 2009-01-06 17:53:32.000000000 +0100 @@ -7,5 +7,6 @@ TEMPLATE_NAME=elf32 - TEXT_LENGTH=128K + TEXT_LENGTH=8K +DATA_ORIGIN=0x800060 - DATA_LENGTH=0xffa0 + DATA_LENGTH=0 EXTRA_EM_FILE=avrelf -Index: ld/emulparams/avr6.sh -=================================================================== -RCS file: /cvs/src/src/ld/emulparams/avr6.sh,v -retrieving revision 1.1 -diff -u -r1.1 avr6.sh ---- ld/emulparams/avr6.sh 24 May 2006 07:36:11 -0000 1.1 -+++ ld/emulparams/avr6.sh 29 Feb 2008 23:39:37 -0000 +--- ./ld/emulparams/avr6.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr6.sh 2009-01-06 17:53:32.000000000 +0100 @@ -7,5 +7,6 @@ TEMPLATE_NAME=elf32 @@ -86,12 +44,23 @@ diff -u -r1.1 avr6.sh +DATA_ORIGIN=0x800200 +DATA_LENGTH=0xfe00 EXTRA_EM_FILE=avrelf ---- ld/scripttempl/avr.sc.orig 2008-02-19 16:36:36.382765500 -0700 -+++ ld/scripttempl/avr.sc 2008-02-19 16:41:07.653804500 -0700 -@@ -5,5 +5,5 @@ OUTPUT_ARCH(${ARCH}) +--- ./ld/emulparams/avr3.sh.orig 2006-05-24 09:36:11.000000000 +0200 ++++ ./ld/emulparams/avr3.sh 2009-01-06 17:53:32.000000000 +0100 +@@ -7,5 +7,6 @@ + TEMPLATE_NAME=elf32 + + TEXT_LENGTH=128K ++DATA_ORIGIN=0x800060 + DATA_LENGTH=0xffa0 + EXTRA_EM_FILE=avrelf +--- ./ld/scripttempl/avr.sc.orig 2008-10-09 14:18:31.000000000 +0200 ++++ ./ld/scripttempl/avr.sc 2009-01-06 17:53:32.000000000 +0100 +@@ -5,7 +5,7 @@ MEMORY { text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH - data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH + data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + } + diff --git a/devel/avr-binutils/files/patch-newdevices b/devel/avr-binutils/files/patch-newdevices index 29bc9b68086a..1147f80556ae 100644 --- a/devel/avr-binutils/files/patch-newdevices +++ b/devel/avr-binutils/files/patch-newdevices @@ -1,165 +1,21 @@ ---- gas/config/tc-avr.c.orig Mon Aug 6 21:59:55 2007 -+++ gas/config/tc-avr.c Wed Dec 19 12:08:45 2007 -@@ -63,7 +63,10 @@ - { - {"avr1", AVR_ISA_TINY1, bfd_mach_avr1}, - {"avr2", AVR_ISA_TINY2, bfd_mach_avr2}, -- {"avr3", AVR_ISA_M103, bfd_mach_avr3}, -+ {"avr3", AVR_ISA_AVR3, bfd_mach_avr3}, -+ {"avr31", AVR_ISA_M103, bfd_mach_avr3}, -+ {"avr35", AVR_ISA_USB162, bfd_mach_avr3}, - {"avr4", AVR_ISA_M8, bfd_mach_avr4}, -- {"avr5", AVR_ISA_ALL, bfd_mach_avr5}, -+ {"avr5", AVR_ISA_M323, bfd_mach_avr5}, -+ {"avr51", AVR_ISA_M128, bfd_mach_avr5}, - {"avr6", AVR_ISA_ALL, bfd_mach_avr6}, -@@ -84,7 +84,7 @@ static struct mcu_type_s mcu_types[] = - {"at90s8515", AVR_ISA_2xxx, bfd_mach_avr2}, - {"at90s8535", AVR_ISA_2xxx, bfd_mach_avr2}, - {"at90c8534", AVR_ISA_2xxx, bfd_mach_avr2}, -- {"at86rf401", AVR_ISA_2xxx, bfd_mach_avr2}, -+ {"at86rf401", AVR_ISA_RF401, bfd_mach_avr2}, - {"attiny13", AVR_ISA_TINY2, bfd_mach_avr2}, - {"attiny2313", AVR_ISA_TINY2, bfd_mach_avr2}, - {"attiny261", AVR_ISA_TINY2, bfd_mach_avr2}, -@@ -97,22 +97,32 @@ - {"attiny25", AVR_ISA_TINY2, bfd_mach_avr2}, - {"attiny45", AVR_ISA_TINY2, bfd_mach_avr2}, - {"attiny85", AVR_ISA_TINY2, bfd_mach_avr2}, -+ {"attiny43u", AVR_ISA_TINY2, bfd_mach_avr2}, -+ {"attiny48", AVR_ISA_TINY2, bfd_mach_avr2}, -+ {"attiny88", AVR_ISA_TINY2, bfd_mach_avr2}, - {"atmega603", AVR_ISA_M603, bfd_mach_avr3}, /* XXX -> m103 */ - {"atmega103", AVR_ISA_M103, bfd_mach_avr3}, - {"at43usb320", AVR_ISA_M103, bfd_mach_avr3}, - {"at43usb355", AVR_ISA_M603, bfd_mach_avr3}, - {"at76c711", AVR_ISA_M603, bfd_mach_avr3}, -+ {"at90usb82", AVR_ISA_USB162, bfd_mach_avr3}, -+ {"at90usb162", AVR_ISA_USB162, bfd_mach_avr3}, -+ {"attiny167", AVR_ISA_TINY3, bfd_mach_avr3}, - {"atmega48", AVR_ISA_PWMx, bfd_mach_avr4}, -+ {"atmega48p", AVR_ISA_PWMx, bfd_mach_avr4}, - {"atmega8", AVR_ISA_M8, bfd_mach_avr4}, - {"atmega83", AVR_ISA_M8, bfd_mach_avr4}, /* XXX -> m8535 */ - {"atmega85", AVR_ISA_M8, bfd_mach_avr4}, /* XXX -> m8 */ - {"atmega88", AVR_ISA_PWMx, bfd_mach_avr4}, -+ {"atmega88p", AVR_ISA_PWMx, bfd_mach_avr4}, - {"atmega8515", AVR_ISA_M8, bfd_mach_avr4}, - {"atmega8535", AVR_ISA_M8, bfd_mach_avr4}, - {"atmega8hva", AVR_ISA_PWMx, bfd_mach_avr4}, - {"at90pwm1", AVR_ISA_PWMx, bfd_mach_avr4}, - {"at90pwm2", AVR_ISA_PWMx, bfd_mach_avr4}, -+ {"at90pwm2b", AVR_ISA_PWMx, bfd_mach_avr4}, - {"at90pwm3", AVR_ISA_PWMx, bfd_mach_avr4}, -+ {"at90pwm3b", AVR_ISA_PWMx, bfd_mach_avr4}, - {"atmega16", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega161", AVR_ISA_M161, bfd_mach_avr5}, - {"atmega162", AVR_ISA_M323, bfd_mach_avr5}, -@@ -121,6 +130,7 @@ - {"atmega165", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega165p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega168", AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega168p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega169", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega169p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega32", AVR_ISA_M323, bfd_mach_avr5}, -@@ -128,12 +138,14 @@ - {"atmega324p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega325", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega325p", AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega328p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega329", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega329p", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega3250", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega3250p",AVR_ISA_M323, bfd_mach_avr5}, - {"atmega3290", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega3290p",AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega32hvb",AVR_ISA_M323, bfd_mach_avr5}, - {"atmega406", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega64", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega640", AVR_ISA_M323, bfd_mach_avr5}, -@@ -142,6 +154,7 @@ - {"atmega128", AVR_ISA_M128, bfd_mach_avr5}, - {"atmega1280", AVR_ISA_M128, bfd_mach_avr5}, - {"atmega1281", AVR_ISA_M128, bfd_mach_avr5}, -+ {"atmega1284p",AVR_ISA_M128, bfd_mach_avr5}, - {"atmega645", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega649", AVR_ISA_M323, bfd_mach_avr5}, - {"atmega6450", AVR_ISA_M323, bfd_mach_avr5}, -@@ -150,8 +163,11 @@ - {"at90can32" , AVR_ISA_M323, bfd_mach_avr5}, - {"at90can64" , AVR_ISA_M323, bfd_mach_avr5}, - {"at90can128", AVR_ISA_M128, bfd_mach_avr5}, -- {"at90usb82", AVR_ISA_M323, bfd_mach_avr5}, -- {"at90usb162", AVR_ISA_M323, bfd_mach_avr5}, -+ {"at90pwm216", AVR_ISA_M323, bfd_mach_avr5}, -+ {"at90pwm316", AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega32c1", AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega32m1", AVR_ISA_M323, bfd_mach_avr5}, -+ {"atmega32u4", AVR_ISA_M323, bfd_mach_avr5}, - {"at90usb646", AVR_ISA_M323, bfd_mach_avr5}, - {"at90usb647", AVR_ISA_M323, bfd_mach_avr5}, - {"at90usb1286",AVR_ISA_M128, bfd_mach_avr5}, ---- gas/doc/c-avr.texi.orig Mon Aug 6 22:00:08 2007 -+++ gas/doc/c-avr.texi Wed Dec 19 12:07:54 2007 -@@ -41,24 +41,26 @@ - attiny26, at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, - at90s8515, at90c8534, at90s8535, at86rf401, attiny13, attiny2313, - attiny261, attiny461, attiny861, attiny24, attiny44, attiny84, attiny25, --attiny45, attiny85). -+attiny45, attiny85, attiny43u, attiny48, attiny88). +--- ./gas/doc/c-avr.texi.orig 2008-08-29 18:58:02.000000000 +0200 ++++ ./gas/doc/c-avr.texi 2009-01-07 17:37:16.000000000 +0100 +@@ -67,7 +67,7 @@ + atmega328p, atmega329, atmega329p, atmega3290, atmega3290p, atmega406, atmega64, + atmega640, atmega644, atmega644p, atmega645, atmega6450, atmega649, atmega6490, + atmega16hva, at90can32, at90can64, at90pwm216, at90pwm316, atmega16u4, +-atmega32c1, atmega32m1, atmega32u4, at90usb646, at90usb647, at94k). ++atmega32c1, atmega32m1, atmega32u4, atmega32u6, at90usb646, at90usb647, at94k). - Instruction set avr3 is for the classic AVR core with up to 128K program - memory space (MCU types: atmega103, atmega603, at43usb320, at43usb355, --at76c711). -+at76c711, at90usb82, at90usb162, attiny167). - --Instruction set avr4 is for the enhanced AVR core with up to 8K program --memory space (MCU types: atmega48, atmega8, atmega83, atmega85, atmega88, --atmega8515, atmega8535, atmega8hva, at90pwm1, at90pwm2, at90pwm3). -+Instruction set avr4 is for the enhanced AVR core with up to 8K -+program memory space (MCU types: atmega48, atmega48p, atmega8, -+atmega83, atmega85, atmega88, atmega88p, atmega8515, atmega8535, -+atmega8hva, at90pwm1, at90pwm2, at90pwm2b, at90pwm3, at90pwm3b). - --Instruction set avr5 is for the enhanced AVR core with up to 128K program --memory space (MCU types: atmega16, atmega161, atmega162, atmega163, --atmega164p, atmega165, atmega165p, atmega168, atmega169, atmega169p, --atmega32, atmega323, atmega324p, atmega325, atmega325p, atmega329, --atmega329p, atmega3250, atmega3250p, atmega3290, atmega3290p, atmega406, --atmega64, atmega640, atmega644, atmega644p, atmega128, atmega1280, --atmega1281, atmega645, atmega649, atmega6450, atmega6490, atmega16hva, --at90can32, at90can64, at90can128, at90usb82, at90usb162, at90usb646, -+Instruction set avr5 is for the enhanced AVR core with up to 128K -+program memory space (MCU types: atmega16, atmega161, atmega162, -+atmega163, atmega164p, atmega165, atmega165p, atmega168, atmega168p, -+atmega169, atmega169p, atmega32, atmega32hvb, atmega323, atmega324p, atmega325, -+atmega325p, atmega328p, atmega329, atmega329p, atmega3250, -+atmega3250p, atmega3290, atmega3290p, atmega406, atmega64, atmega640, -+atmega644, atmega644p, atmega128, atmega1280, atmega1281, atmega1284p, atmega645, -+atmega649, atmega6450, atmega6490, atmega16hva, at90can32, at90can64, -+at90can128, at90pwm216, at90pwm316, atmega32c1, atmega32m1, atmega32u4, at90usb646, - at90usb647, at90usb1286, at90usb1287, at94k). - - Instruction set avr6 is for the enhanced AVR core with 256K program ---- include/opcode/avr.h.orig Fri Apr 7 17:18:08 2006 -+++ include/opcode/avr.h Wed Dec 19 12:10:04 2007 -@@ -40,12 +40,18 @@ - #define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM) - #define AVR_ISA_PWMx (AVR_ISA_M8 | AVR_ISA_BRK) - #define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM) -+#define AVR_ISA_RF401 (AVR_ISA_2xxx | AVR_ISA_MOVW | AVR_ISA_LPMX) - #define AVR_ISA_TINY2 (AVR_ISA_2xxx | AVR_ISA_MOVW | AVR_ISA_LPMX | \ - AVR_ISA_SPM | AVR_ISA_BRK) -+#define AVR_ISA_TINY3 (AVR_ISA_TINY2 | AVR_ISA_MEGA) - #define AVR_ISA_M8 (AVR_ISA_2xxx | AVR_ISA_MUL | AVR_ISA_MOVW | \ - AVR_ISA_LPMX | AVR_ISA_SPM) - #define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA) - #define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM) -+#define AVR_ISA_USB162 (AVR_ISA_M603 | AVR_ISA_MOVW | \ -+ AVR_ISA_LPMX | AVR_ISA_SPM) -+#define AVR_ISA_AVR3 (AVR_ISA_M603 | AVR_ISA_MOVW | \ -+ AVR_ISA_LPMX | AVR_ISA_SPM | AVR_ISA_ELPM) - #define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | \ - AVR_ISA_LPMX | AVR_ISA_SPM) - #define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX) + Instruction set avr51 is for the enhanced AVR core with exactly 128K program + memory space (MCU types: atmega128, atmega1280, atmega1281, atmega1284p, +--- ./gas/config/tc-avr.c.orig 2008-08-29 18:58:02.000000000 +0200 ++++ ./gas/config/tc-avr.c 2009-01-07 17:36:41.000000000 +0100 +@@ -173,6 +173,7 @@ + {"atmega32c1", AVR_ISA_AVR5, bfd_mach_avr5}, + {"atmega32m1", AVR_ISA_AVR5, bfd_mach_avr5}, + {"atmega32u4", AVR_ISA_AVR5, bfd_mach_avr5}, ++ {"atmega32u6", AVR_ISA_AVR5, bfd_mach_avr5}, + {"at90usb646", AVR_ISA_AVR5, bfd_mach_avr5}, + {"at90usb647", AVR_ISA_AVR5, bfd_mach_avr5}, + {"at94k", AVR_ISA_94K, bfd_mach_avr5}, diff --git a/devel/avr-binutils/files/patch-wrong-arch b/devel/avr-binutils/files/patch-wrong-arch new file mode 100644 index 000000000000..0a7b39f44048 --- /dev/null +++ b/devel/avr-binutils/files/patch-wrong-arch @@ -0,0 +1,22 @@ +--- bfd/elf32-avr.c.old 2008-11-11 10:30:09.000000000 -0700 ++++ bfd/elf32-avr.c 2008-11-11 10:31:40.171875000 -0700 +@@ -1298,6 +1298,7 @@ bfd_elf_avr_final_write_processing (bfd + + case bfd_mach_avr25: + val = E_AVR_MACH_AVR25; ++ break; + + case bfd_mach_avr3: + val = E_AVR_MACH_AVR3; +@@ -1305,9 +1306,11 @@ bfd_elf_avr_final_write_processing (bfd + + case bfd_mach_avr31: + val = E_AVR_MACH_AVR31; ++ break; + + case bfd_mach_avr35: + val = E_AVR_MACH_AVR35; ++ break; + + case bfd_mach_avr4: + val = E_AVR_MACH_AVR4; diff --git a/devel/avr-binutils/files/patch-xmega b/devel/avr-binutils/files/patch-xmega index 19953e59daf1..1db6d6bf515a 100644 --- a/devel/avr-binutils/files/patch-xmega +++ b/devel/avr-binutils/files/patch-xmega @@ -1,80 +1,88 @@ -Not committed --------------------------------------------------------------------------------- ---- opcodes/avr-dis.c.orig 2007-08-06 13:58:38.000000000 -0600 -+++ opcodes/avr-dis.c 2008-04-09 16:37:17.233737600 -0600 -@@ -50,7 +50,7 @@ static const char * comment_start = "0x" +--- ./include/opcode/avr.h.orig 2008-08-09 07:35:13.000000000 +0200 ++++ ./include/opcode/avr.h 2009-01-07 17:46:15.000000000 +0100 +@@ -30,6 +30,8 @@ + #define AVR_ISA_BRK 0x0400 /* device has BREAK (on-chip debug) */ + #define AVR_ISA_EIND 0x0800 /* device has >128K program memory (none yet) */ + #define AVR_ISA_MOVW 0x1000 /* device has MOVW */ ++#define AVR_ISA_SPMX 0x2000 /* device has SPM Z[+] */ ++#define AVR_ISA_DES 0x4000 /* device has DES */ - static int - avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint, -- char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) -+ char *opcode_str, char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) - { - int ok = 1; - *sym = 0; -@@ -118,8 +118,18 @@ avr_operand (unsigned int insn, unsigned + #define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM) + #define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM) +@@ -48,6 +50,8 @@ + #define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX) + #define AVR_ISA_M323 (AVR_ISA_M161 | AVR_ISA_BRK) + #define AVR_ISA_M128 (AVR_ISA_M323 | AVR_ISA_ELPM | AVR_ISA_ELPMX) ++#define AVR_ISA_M256 (AVR_ISA_M128 | AVR_ISA_EIND) ++#define AVR_ISA_XMEGA (AVR_ISA_M256 | AVR_ISA_SPMX | AVR_ISA_DES) - case 'z': - *buf++ = 'Z'; -- if (insn & 0x1) -- *buf++ = '+'; -+ -+ /* Check for post-increment. */ -+ char *s; -+ for (s = opcode_str; *s; ++s) -+ { -+ if (*s == '+') -+ { -+ *buf++ = '+'; -+ break; -+ } -+ } -+ - *buf = '\0'; - if (AVR_UNDEF_P (insn)) - sprintf (comment, _("undefined")); -@@ -226,6 +236,10 @@ avr_operand (unsigned int insn, unsigned - sprintf (comment, "%d", x); - } - break; -+ -+ case 'E': -+ sprintf (buf, "%d", (insn >> 4) & 15); -+ break; - - case '?': - *buf = '\0'; -@@ -331,7 +345,8 @@ print_insn_avr (bfd_vma addr, disassembl + #define AVR_ISA_AVR1 AVR_ISA_TINY1 + #define AVR_ISA_AVR2 AVR_ISA_2xxx +@@ -108,6 +112,7 @@ + L - signed pc relative offset from -2048 to 2047 + h - absolute code address (call, jmp) + S - immediate value from 0 to 7 (S = s << 4) ++ E - immediate value from 0 to 15, shifted left by 4 (des) + ? - use this opcode entry if no parameters, else use next opcode entry - if (opcode->name) - { -- char *op = opcode->constraints; -+ char *constraints = opcode->constraints; -+ char *opcode_str = opcode->opcode; + Order is important - some binary opcodes have more than one name, +@@ -168,7 +173,8 @@ + AVR_INSN (sleep,"", "1001010110001000", 1, AVR_ISA_1200, 0x9588) + AVR_INSN (break,"", "1001010110011000", 1, AVR_ISA_BRK, 0x9598) + AVR_INSN (wdr, "", "1001010110101000", 1, AVR_ISA_1200, 0x95a8) +-AVR_INSN (spm, "", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8) ++AVR_INSN (spm, "?", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8) ++AVR_INSN (spm, "z", "10010101111+1000", 1, AVR_ISA_SPMX, 0x95e8) - insn2 = 0; - ok = 1; -@@ -342,14 +357,14 @@ print_insn_avr (bfd_vma addr, disassembl - cmd_len = 4; - } + AVR_INSN (adc, "r,r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00) + AVR_INSN (add, "r,r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00) +@@ -282,3 +288,6 @@ + AVR_INSN (eicall, "", "1001010100011001", 1, AVR_ISA_EIND, 0x9519) + AVR_INSN (eijmp, "", "1001010000011001", 1, AVR_ISA_EIND, 0x9419) -- if (*op && *op != '?') -+ if (*constraints && *constraints != '?') - { -- int regs = REGISTER_P (*op); -+ int regs = REGISTER_P (*constraints); ++/* DES instruction for encryption and decryption */ ++AVR_INSN (des, "E", "10010100EEEE1011", 1, AVR_ISA_DES, 0x940B) ++ +--- ./include/elf/avr.h.orig 2008-08-09 07:35:13.000000000 +0200 ++++ ./include/elf/avr.h 2009-01-07 17:46:15.000000000 +0100 +@@ -40,6 +40,13 @@ + #define E_AVR_MACH_AVR5 5 + #define E_AVR_MACH_AVR51 51 + #define E_AVR_MACH_AVR6 6 ++#define E_AVR_MACH_XMEGA1 101 ++#define E_AVR_MACH_XMEGA2 102 ++#define E_AVR_MACH_XMEGA3 103 ++#define E_AVR_MACH_XMEGA4 104 ++#define E_AVR_MACH_XMEGA5 105 ++#define E_AVR_MACH_XMEGA6 106 ++#define E_AVR_MACH_XMEGA7 107 -- ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0, &sym_op1, &sym_addr1); -+ ok = avr_operand (insn, insn2, addr, *constraints, opcode_str, op1, comment1, 0, &sym_op1, &sym_addr1); + /* Relocations. */ + START_RELOC_NUMBERS (elf_avr_reloc_type) +--- ./gas/doc/c-avr.texi.orig 2009-01-07 17:37:16.000000000 +0100 ++++ ./gas/doc/c-avr.texi 2009-01-07 17:46:28.000000000 +0100 +@@ -76,6 +76,19 @@ + Instruction set avr6 is for the enhanced AVR core with a 3-byte PC (MCU types: + atmega2560, atmega2561). -- if (ok && *(++op) == ',') -- ok = avr_operand (insn, insn2, addr, *(++op), op2, -+ if (ok && *(++constraints) == ',') -+ ok = avr_operand (insn, insn2, addr, *(++constraints), opcode_str, op2, - *comment1 ? comment2 : comment1, regs, &sym_op2, &sym_addr2); - } - } ---- gas/config/tc-avr.c.orig 2008-04-09 14:03:00.411627300 -0600 -+++ gas/config/tc-avr.c 2008-04-09 16:35:42.382096600 -0600 ++Instruction set avrxmega4 is for the XMEGA AVR cor with up to 64K program ++memory space and less than 64K data space (MCU types: atxmega64a3). ++ ++Instruction set avrxmega5 is for the XMEGA AVR core with up to 64K program ++memory space and greater than 64K data space (MCU types: atxmega64a1). ++ ++Instruction set avrxmega6 is for the XMEGA AVR core with up to 256K program ++memory space and less than 64K data space (MCU types: atxmega128a3, ++atxmega256a3, atxmega256a3b). ++ ++Instruction set avrxmega7 is for the XMEGA AVR core with up to 256K program ++memory space and greater than 64K data space (MCU types: atxmega128a1). ++ + @cindex @code{-mall-opcodes} command line option, AVR + @item -mall-opcodes + Accept all AVR opcodes, even if not supported by @code{-mmcu}. +--- ./gas/config/tc-avr.c.orig 2009-01-07 17:36:41.000000000 +0100 ++++ ./gas/config/tc-avr.c 2009-01-07 17:46:28.000000000 +0100 @@ -27,20 +27,21 @@ struct avr_opcodes_s @@ -103,10 +111,10 @@ Not committed }; const char comment_chars[] = ";"; -@@ -64,6 +65,13 @@ static struct mcu_type_s mcu_types[] = - {"avr51", AVR_ISA_M128, bfd_mach_avr5}, -- {"avr6", AVR_ISA_ALL, bfd_mach_avr6}, -+ {"avr6", AVR_ISA_M256, bfd_mach_avr6}, +@@ -79,6 +80,13 @@ + {"avr5", AVR_ISA_AVR51, bfd_mach_avr5}, + {"avr51", AVR_ISA_AVR51, bfd_mach_avr51}, + {"avr6", AVR_ISA_AVR6, bfd_mach_avr6}, + {"avrxmega1", AVR_ISA_XMEGA, bfd_mach_avrxmega1}, + {"avrxmega2", AVR_ISA_XMEGA, bfd_mach_avrxmega2}, + {"avrxmega3", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, @@ -115,23 +123,33 @@ Not committed + {"avrxmega6", AVR_ISA_XMEGA, bfd_mach_avrxmega6}, + {"avrxmega7", AVR_ISA_XMEGA, bfd_mach_avrxmega7}, {"at90s1200", AVR_ISA_1200, bfd_mach_avr1}, - {"attiny10", AVR_ISA_TINY1, bfd_mach_avr1}, /* XXX -> tn11 */ - {"attiny11", AVR_ISA_TINY1, bfd_mach_avr1}, - {"attiny12", AVR_ISA_TINY1, bfd_mach_avr1}, -@@ -169,8 +180,10 @@ static struct mcu_type_s mcu_types[] = - {"at90usb1286",AVR_ISA_M128, bfd_mach_avr5}, - {"at90usb1287",AVR_ISA_M128, bfd_mach_avr5}, - {"at94k", AVR_ISA_94K, bfd_mach_avr5}, -- {"atmega2560", AVR_ISA_ALL, bfd_mach_avr6}, -- {"atmega2561", AVR_ISA_ALL, bfd_mach_avr6}, -+ {"atmega2560", AVR_ISA_M256, bfd_mach_avr6}, -+ {"atmega2561", AVR_ISA_M256, bfd_mach_avr6}, -+ {"atxmega64a1", AVR_ISA_XMEGA, bfd_mach_avrxmega2}, -+ {"atxmega128a1", AVR_ISA_XMEGA, bfd_mach_avrxmega3}, + {"attiny11", AVR_ISA_AVR1, bfd_mach_avr1}, + {"attiny12", AVR_ISA_AVR1, bfd_mach_avr1}, +@@ -186,6 +194,12 @@ + {"at90usb1287",AVR_ISA_AVR51, bfd_mach_avr51}, + {"atmega2560", AVR_ISA_AVR6, bfd_mach_avr6}, + {"atmega2561", AVR_ISA_AVR6, bfd_mach_avr6}, ++ {"atxmega64a3", AVR_ISA_XMEGA, bfd_mach_avrxmega4}, ++ {"atxmega64a1", AVR_ISA_XMEGA, bfd_mach_avrxmega5}, ++ {"atxmega128a3", AVR_ISA_XMEGA, bfd_mach_avrxmega6}, ++ {"atxmega256a3", AVR_ISA_XMEGA, bfd_mach_avrxmega6}, ++ {"atxmega256a3b",AVR_ISA_XMEGA, bfd_mach_avrxmega6}, ++ {"atxmega128a1", AVR_ISA_XMEGA, bfd_mach_avrxmega7}, {NULL, 0, 0} }; -@@ -804,7 +817,12 @@ avr_operand (struct avr_opcodes_s *opcod +@@ -363,6 +377,10 @@ + " avr5 - enhanced AVR core with up to 64K program memory\n" + " avr51 - enhanced AVR core with up to 128K program memory\n" + " avr6 - enhanced AVR core with up to 256K program memory\n" ++ " avrxmega4 - XMEGA, > 64K, <= 128K FLASH, <= 64K RAM\n" ++ " avrxmega5 - XMEGA, > 64K, <= 128K FLASH, > 64K RAM\n" ++ " avrxmega6 - XMEGA, > 128K, <= 256K FLASH, <= 64K RAM\n" ++ " avrxmega7 - XMEGA, > 128K, <= 256K FLASH, > 64K RAM\n" + " or immediate microcontroller name.\n")); + fprintf (stream, + _(" -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n" +@@ -790,7 +808,12 @@ if (*str == '+') { ++str; @@ -145,7 +163,7 @@ Not committed } /* attiny26 can do "lpm" and "lpm r,Z" but not "lpm r,Z+". */ -@@ -921,6 +939,16 @@ avr_operand (struct avr_opcodes_s *opcod +@@ -907,6 +930,16 @@ } break; @@ -162,143 +180,127 @@ Not committed case '?': break; ---- include/opcode/avr.h.orig 2008-04-09 14:03:00.411627300 -0600 -+++ include/opcode/avr.h 2008-04-09 16:34:28.329060900 -0600 -@@ -30,6 +30,8 @@ - #define AVR_ISA_BRK 0x0400 /* device has BREAK (on-chip debug) */ - #define AVR_ISA_EIND 0x0800 /* device has >128K program memory (none yet) */ - #define AVR_ISA_MOVW 0x1000 /* device has MOVW */ -+#define AVR_ISA_SPMX 0x2000 /* device has SPM Z[+] */ -+#define AVR_ISA_DES 0x4000 /* device has DES */ - - #define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM) - #define AVR_ISA_PWMx (AVR_ISA_M8 | AVR_ISA_BRK) -@@ -53,6 +55,8 @@ - #define AVR_ISA_94K (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_MOVW | AVR_ISA_LPMX) - #define AVR_ISA_M323 (AVR_ISA_M161 | AVR_ISA_BRK) - #define AVR_ISA_M128 (AVR_ISA_M323 | AVR_ISA_ELPM | AVR_ISA_ELPMX) -+#define AVR_ISA_M256 (AVR_ISA_M128 | AVR_ISA_EIND) -+#define AVR_ISA_XMEGA (AVR_ISA_M256 | AVR_ISA_SPMX | AVR_ISA_DES) - - #define AVR_ISA_ALL 0xFFFF - -@@ -98,6 +102,7 @@ - L - signed pc relative offset from -2048 to 2047 - h - absolute code address (call, jmp) - S - immediate value from 0 to 7 (S = s << 4) -+ E - immediate value from 0 to 15, shifted left by 4 (des) - ? - use this opcode entry if no parameters, else use next opcode entry - - Order is important - some binary opcodes have more than one name, -@@ -158,7 +163,8 @@ AVR_INSN (reti, "", "1001010100011000 - AVR_INSN (sleep,"", "1001010110001000", 1, AVR_ISA_1200, 0x9588) - AVR_INSN (break,"", "1001010110011000", 1, AVR_ISA_BRK, 0x9598) - AVR_INSN (wdr, "", "1001010110101000", 1, AVR_ISA_1200, 0x95a8) --AVR_INSN (spm, "", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8) -+AVR_INSN (spm, "?", "1001010111101000", 1, AVR_ISA_SPM, 0x95e8) -+AVR_INSN (spm, "z", "10010101111+1000", 1, AVR_ISA_SPMX, 0x95e8) - - AVR_INSN (adc, "r,r", "000111rdddddrrrr", 1, AVR_ISA_1200, 0x1c00) - AVR_INSN (add, "r,r", "000011rdddddrrrr", 1, AVR_ISA_1200, 0x0c00) -@@ -272,3 +278,6 @@ AVR_INSN (st, "e,r", "100!001rrrrree-+ - AVR_INSN (eicall, "", "1001010100011001", 1, AVR_ISA_EIND, 0x9519) - AVR_INSN (eijmp, "", "1001010000011001", 1, AVR_ISA_EIND, 0x9419) - -+/* DES instruction for encryption and decryption */ -+AVR_INSN (des, "E", "10010100EEEE1011", 1, AVR_ISA_DES, 0x940B) +--- ./ld/emulparams/avrxmega6.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega6.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:106 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 + -Index: bfd/archures.c -=================================================================== -RCS file: /cvs/src/src/bfd/archures.c,v -retrieving revision 1.130 -diff -a -u -p -r1.130 archures.c ---- bfd/archures.c 4 Feb 2008 19:15:50 -0000 1.130 -+++ bfd/archures.c 14 Feb 2008 18:01:43 -0000 -@@ -352,6 +352,13 @@ DESCRIPTION - .#define bfd_mach_avr4 4 - .#define bfd_mach_avr5 5 - .#define bfd_mach_avr6 6 -+.#define bfd_mach_avrxmega1 101 -+.#define bfd_mach_avrxmega2 102 -+.#define bfd_mach_avrxmega3 103 -+.#define bfd_mach_avrxmega4 104 -+.#define bfd_mach_avrxmega5 105 -+.#define bfd_mach_avrxmega6 106 -+.#define bfd_mach_avrxmega7 107 - . bfd_arch_bfin, {* ADI Blackfin *} - .#define bfd_mach_bfin 1 - . bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *} -Index: bfd/cpu-avr.c -=================================================================== -RCS file: /cvs/src/src/bfd/cpu-avr.c,v -retrieving revision 1.12 -diff -a -u -p -r1.12 cpu-avr.c ---- bfd/cpu-avr.c 3 Jul 2007 14:26:40 -0000 1.12 -+++ bfd/cpu-avr.c 14 Feb 2008 18:01:43 -0000 -@@ -86,7 +86,29 @@ static const bfd_arch_info_type arch_inf - N (22, bfd_mach_avr5, "avr:5", FALSE, & arch_info_struct[5]), - - /* ATmega256x. */ -- N (22, bfd_mach_avr6, "avr:6", FALSE, NULL) -+ N (22, bfd_mach_avr6, "avr:6", FALSE, & arch_info_struct[6]), -+ -+ /* Xmega 1 */ -+ N (24, bfd_mach_avrxmega1, "avr:101", FALSE, & arch_info_struct[7]), ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega7.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega7.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:107 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 + -+ /* Xmega 2 */ -+ N (24, bfd_mach_avrxmega2, "avr:102", FALSE, & arch_info_struct[8]), -+ -+ /* Xmega 3 */ -+ N (24, bfd_mach_avrxmega3, "avr:103", FALSE, & arch_info_struct[9]), -+ -+ /* Xmega 4 */ -+ N (24, bfd_mach_avrxmega4, "avr:104", FALSE, & arch_info_struct[10]), -+ -+ /* Xmega 5 */ -+ N (24, bfd_mach_avrxmega5, "avr:105", FALSE, & arch_info_struct[11]), -+ -+ /* Xmega 6 */ -+ N (24, bfd_mach_avrxmega6, "avr:106", FALSE, & arch_info_struct[12]), -+ -+ /* Xmega 7 */ -+ N (24, bfd_mach_avrxmega7, "avr:107", FALSE, NULL) -+ - }; - - const bfd_arch_info_type bfd_avr_arch = -Index: include/elf/avr.h -=================================================================== -RCS file: /cvs/src/src/include/elf/avr.h,v -retrieving revision 1.8 -diff -a -u -p -r1.8 avr.h ---- include/elf/avr.h 24 May 2006 07:36:11 -0000 1.8 -+++ include/elf/avr.h 14 Feb 2008 18:01:44 -0000 -@@ -35,7 +35,14 @@ - #define E_AVR_MACH_AVR3 3 - #define E_AVR_MACH_AVR4 4 - #define E_AVR_MACH_AVR5 5 --#define E_AVR_MACH_AVR6 6 -+#define E_AVR_MACH_AVR6 6 -+#define E_AVR_MACH_XMEGA1 101 -+#define E_AVR_MACH_XMEGA2 102 -+#define E_AVR_MACH_XMEGA3 103 -+#define E_AVR_MACH_XMEGA4 104 -+#define E_AVR_MACH_XMEGA5 105 -+#define E_AVR_MACH_XMEGA6 106 -+#define E_AVR_MACH_XMEGA7 107 - - /* Relocations. */ - START_RELOC_NUMBERS (elf_avr_reloc_type) -Index: ld/Makefile.am -=================================================================== -RCS file: /cvs/src/src/ld/Makefile.am,v -retrieving revision 1.244 -diff -a -u -p -r1.244 Makefile.am ---- ld/Makefile.am 24 Oct 2007 04:56:47 -0000 1.244 -+++ ld/Makefile.am 14 Feb 2008 18:01:45 -0000 -@@ -138,6 +138,13 @@ ALL_EMULATIONS = \ - eavr4.o \ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega1.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega1.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:101 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 ++ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega4.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega4.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:104 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 ++ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega5.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega5.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:105 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 ++ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega2.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega2.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:102 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 ++ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/emulparams/avrxmega3.sh.orig 2009-01-07 17:46:15.000000000 +0100 ++++ ./ld/emulparams/avrxmega3.sh 2009-01-07 17:46:15.000000000 +0100 +@@ -0,0 +1,12 @@ ++ARCH=avr:103 ++MACHINE= ++SCRIPT_NAME=avr ++OUTPUT_FORMAT="elf32-avr" ++MAXPAGESIZE=1 ++EMBEDDED=yes ++TEMPLATE_NAME=elf32 ++ ++TEXT_LENGTH=1024K ++DATA_ORIGIN=0x802000 ++DATA_LENGTH=0xffa0 ++EXTRA_EM_FILE=avrelf +--- ./ld/configure.tgt.orig 2008-08-09 07:35:13.000000000 +0200 ++++ ./ld/configure.tgt 2009-01-07 17:46:15.000000000 +0100 +@@ -107,7 +107,7 @@ + xscale-*-elf) targ_emul=armelf + ;; + avr-*-*) targ_emul=avr2 +- targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6" ++ targ_extra_emuls="avr1 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7" + ;; + bfin-*-elf) targ_emul=elf32bfin; + targ_extra_emuls="elf32bfinfd" +--- ./ld/Makefile.in.orig 2008-09-09 10:02:19.000000000 +0200 ++++ ./ld/Makefile.in 2009-01-07 17:46:15.000000000 +0100 +@@ -393,6 +393,13 @@ eavr5.o \ + eavr51.o \ eavr6.o \ + eavrxmega1.o \ + eavrxmega2.o \ @@ -310,7 +312,7 @@ diff -a -u -p -r1.244 Makefile.am ecoff_i860.o \ ecoff_sparc.o \ eelf32_spu.o \ -@@ -622,6 +629,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $( +@@ -1476,6 +1483,34 @@ $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \ ${GEN_DEPENDS} ${GENSCRIPTS} avr6 "$(tdir_avr2)" @@ -345,16 +347,11 @@ diff -a -u -p -r1.244 Makefile.am ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS} ${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)" -Index: ld/Makefile.in -=================================================================== -RCS file: /cvs/src/src/ld/Makefile.in,v -retrieving revision 1.262 -diff -a -u -p -r1.262 Makefile.in ---- ld/Makefile.in 24 Oct 2007 04:56:47 -0000 1.262 -+++ ld/Makefile.in 14 Feb 2008 18:01:45 -0000 -@@ -385,6 +385,13 @@ ALL_EMULATIONS = \ - eavr4.o \ +--- ./ld/Makefile.am.orig 2008-09-09 10:02:19.000000000 +0200 ++++ ./ld/Makefile.am 2009-01-07 17:46:15.000000000 +0100 +@@ -142,6 +142,13 @@ eavr5.o \ + eavr51.o \ eavr6.o \ + eavrxmega1.o \ + eavrxmega2.o \ @@ -366,7 +363,7 @@ diff -a -u -p -r1.262 Makefile.in ecoff_i860.o \ ecoff_sparc.o \ eelf32_spu.o \ -@@ -1448,6 +1455,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $( +@@ -646,6 +653,34 @@ $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \ ${GEN_DEPENDS} ${GENSCRIPTS} avr6 "$(tdir_avr2)" @@ -401,157 +398,220 @@ diff -a -u -p -r1.262 Makefile.in ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \ $(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS} ${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)" -Index: ld/configure.tgt -=================================================================== -RCS file: /cvs/src/src/ld/configure.tgt,v -retrieving revision 1.217 -diff -a -u -p -r1.217 configure.tgt ---- ld/configure.tgt 1 Feb 2008 17:58:48 -0000 1.217 -+++ ld/configure.tgt 14 Feb 2008 18:01:45 -0000 -@@ -107,7 +107,7 @@ xscale-*-coff) targ_emul=armcoff ;; - xscale-*-elf) targ_emul=armelf - ;; - avr-*-*) targ_emul=avr2 -- targ_extra_emuls="avr1 avr3 avr4 avr5 avr6" -+ targ_extra_emuls="avr1 avr3 avr4 avr5 avr6 avrxmega1 avrxmega2 avrxmega3 avrxmega4 avrxmega5 avrxmega6 avrxmega7" - ;; - bfin-*-elf) targ_emul=elf32bfin; - targ_extra_emuls="elf32bfinfd" -Index: ld/emultempl/avrelf.em -=================================================================== -RCS file: /cvs/src/src/ld/emultempl/avrelf.em,v -retrieving revision 1.5 -diff -a -u -p -r1.5 avrelf.em ---- ld/emultempl/avrelf.em 17 Aug 2007 13:50:48 -0000 1.5 -+++ ld/emultempl/avrelf.em 14 Feb 2008 18:01:45 -0000 -@@ -71,8 +71,15 @@ avr_elf_${EMULATION_NAME}_before_allocat +--- ./ld/emultempl/avrelf.em.orig 2008-07-07 02:46:51.000000000 +0200 ++++ ./ld/emultempl/avrelf.em 2009-01-07 17:46:15.000000000 +0100 +@@ -71,8 +71,10 @@ gld${EMULATION_NAME}_before_allocation (); - /* We only need stubs for the avr6 family. */ - if (strcmp ("${EMULATION_NAME}","avr6")) -+ /* We only need stubs for the avr6 and avrxmega* family. */ ++ /* We only need stubs for avr6, avrxmega6, and avrxmega7. */ + if (strcmp ("${EMULATION_NAME}","avr6") -+ && strcmp ("${EMULATION_NAME}","avrxmega1") -+ && strcmp ("${EMULATION_NAME}","avrxmega2") -+ && strcmp ("${EMULATION_NAME}","avrxmega3") -+ && strcmp ("${EMULATION_NAME}","avrxmega4") -+ && strcmp ("${EMULATION_NAME}","avrxmega5") + && strcmp ("${EMULATION_NAME}","avrxmega6") + && strcmp ("${EMULATION_NAME}","avrxmega7") ) avr_no_stubs = TRUE; avr_elf_set_global_bfd_parameters (); ---- /dev/null 2008-02-14 11:03:14.488602600 -0700 -+++ ld/emulparams/avrxmega1.sh 2008-02-14 09:08:29.531250000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:101 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 +--- ./bfd/cpu-avr.c.orig 2008-08-09 07:35:12.000000000 +0200 ++++ ./bfd/cpu-avr.c 2009-01-07 17:46:15.000000000 +0100 +@@ -126,7 +126,29 @@ + N (22, bfd_mach_avr51, "avr:51", FALSE, & arch_info_struct[9]), + + /* 3-Byte PC. */ +- N (22, bfd_mach_avr6, "avr:6", FALSE, NULL) ++ N (22, bfd_mach_avr6, "avr:6", FALSE, & arch_info_struct[10]), ++ ++ /* Xmega 1 */ ++ N (24, bfd_mach_avrxmega1, "avr:101", FALSE, & arch_info_struct[11]), + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:18.394502600 -0700 -+++ ld/emulparams/avrxmega2.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:102 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ /* Xmega 2 */ ++ N (24, bfd_mach_avrxmega2, "avr:102", FALSE, & arch_info_struct[12]), ++ ++ /* Xmega 3 */ ++ N (24, bfd_mach_avrxmega3, "avr:103", FALSE, & arch_info_struct[13]), ++ ++ /* Xmega 4 */ ++ N (24, bfd_mach_avrxmega4, "avr:104", FALSE, & arch_info_struct[14]), ++ ++ /* Xmega 5 */ ++ N (24, bfd_mach_avrxmega5, "avr:105", FALSE, & arch_info_struct[15]), ++ ++ /* Xmega 6 */ ++ N (24, bfd_mach_avrxmega6, "avr:106", FALSE, & arch_info_struct[16]), ++ ++ /* Xmega 7 */ ++ N (24, bfd_mach_avrxmega7, "avr:107", FALSE, NULL) ++ + }; + + const bfd_arch_info_type bfd_avr_arch = +--- ./bfd/archures.c.orig 2008-08-09 07:35:12.000000000 +0200 ++++ ./bfd/archures.c 2009-01-07 17:46:15.000000000 +0100 +@@ -357,6 +357,13 @@ + .#define bfd_mach_avr5 5 + .#define bfd_mach_avr51 51 + .#define bfd_mach_avr6 6 ++.#define bfd_mach_avrxmega1 101 ++.#define bfd_mach_avrxmega2 102 ++.#define bfd_mach_avrxmega3 103 ++.#define bfd_mach_avrxmega4 104 ++.#define bfd_mach_avrxmega5 105 ++.#define bfd_mach_avrxmega6 106 ++.#define bfd_mach_avrxmega7 107 + . bfd_arch_bfin, {* ADI Blackfin *} + .#define bfd_mach_bfin 1 + . bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *} +--- ./bfd/elf32-avr.c.orig 2008-08-09 07:35:12.000000000 +0200 ++++ ./bfd/elf32-avr.c 2009-01-07 17:46:15.000000000 +0100 +@@ -1324,6 +1324,34 @@ + case bfd_mach_avr6: + val = E_AVR_MACH_AVR6; + break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:22.050425000 -0700 -+++ ld/emulparams/avrxmega3.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:103 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ case bfd_mach_avrxmega1: ++ val = E_AVR_MACH_XMEGA1; ++ break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:25.784465400 -0700 -+++ ld/emulparams/avrxmega4.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:104 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ case bfd_mach_avrxmega2: ++ val = E_AVR_MACH_XMEGA2; ++ break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:25.784465400 -0700 -+++ ld/emulparams/avrxmega5.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:105 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ case bfd_mach_avrxmega3: ++ val = E_AVR_MACH_XMEGA3; ++ break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:25.784465400 -0700 -+++ ld/emulparams/avrxmega6.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:106 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ case bfd_mach_avrxmega4: ++ val = E_AVR_MACH_XMEGA4; ++ break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- /dev/null 2008-02-14 11:03:25.784465400 -0700 -+++ ld/emulparams/avrxmega7.sh 2008-02-14 09:08:29.546875000 -0700 -@@ -0,0 +1,12 @@ -+ARCH=avr:107 -+MACHINE= -+SCRIPT_NAME=avr -+OUTPUT_FORMAT="elf32-avr" -+MAXPAGESIZE=1 -+EMBEDDED=yes -+TEMPLATE_NAME=elf32 ++ case bfd_mach_avrxmega5: ++ val = E_AVR_MACH_XMEGA5; ++ break; + -+TEXT_LENGTH=1024K -+DATA_ORIGIN=0x802000 -+DATA_LENGTH=0xffa0 -+EXTRA_EM_FILE=avrelf ---- bfd/bfd-in2.h~ 2007-08-06 21:59:15.000000000 +0200 -+++ bfd/bfd-in2.h 2008-07-22 17:55:46.000000000 +0200 -@@ -2017,6 +2017,13 @@ - #define bfd_mach_avr4 4 ++ case bfd_mach_avrxmega6: ++ val = E_AVR_MACH_XMEGA6; ++ break; ++ ++ case bfd_mach_avrxmega7: ++ val = E_AVR_MACH_XMEGA7; ++ break; + } + + elf_elfheader (abfd)->e_machine = EM_AVR; +@@ -1386,6 +1414,34 @@ + case E_AVR_MACH_AVR6: + e_set = bfd_mach_avr6; + break; ++ ++ case E_AVR_MACH_XMEGA1: ++ e_set = bfd_mach_avrxmega1; ++ break; ++ ++ case E_AVR_MACH_XMEGA2: ++ e_set = bfd_mach_avrxmega2; ++ break; ++ ++ case E_AVR_MACH_XMEGA3: ++ e_set = bfd_mach_avrxmega3; ++ break; ++ ++ case E_AVR_MACH_XMEGA4: ++ e_set = bfd_mach_avrxmega4; ++ break; ++ ++ case E_AVR_MACH_XMEGA5: ++ e_set = bfd_mach_avrxmega5; ++ break; ++ ++ case E_AVR_MACH_XMEGA6: ++ e_set = bfd_mach_avrxmega6; ++ break; ++ ++ case E_AVR_MACH_XMEGA7: ++ e_set = bfd_mach_avrxmega7; ++ break; + } + } + return bfd_default_set_arch_mach (abfd, bfd_arch_avr, +--- ./opcodes/avr-dis.c.orig 2007-07-05 11:49:00.000000000 +0200 ++++ ./opcodes/avr-dis.c 2009-01-07 17:46:15.000000000 +0100 +@@ -50,7 +50,7 @@ + + static int + avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constraint, +- char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) ++ char *opcode_str, char *buf, char *comment, int regs, int *sym, bfd_vma *sym_addr) + { + int ok = 1; + *sym = 0; +@@ -118,8 +118,18 @@ + + case 'z': + *buf++ = 'Z'; +- if (insn & 0x1) +- *buf++ = '+'; ++ ++ /* Check for post-increment. */ ++ char *s; ++ for (s = opcode_str; *s; ++s) ++ { ++ if (*s == '+') ++ { ++ *buf++ = '+'; ++ break; ++ } ++ } ++ + *buf = '\0'; + if (AVR_UNDEF_P (insn)) + sprintf (comment, _("undefined")); +@@ -226,6 +236,10 @@ + sprintf (comment, "%d", x); + } + break; ++ ++ case 'E': ++ sprintf (buf, "%d", (insn >> 4) & 15); ++ break; + + case '?': + *buf = '\0'; +@@ -331,7 +345,8 @@ + + if (opcode->name) + { +- char *op = opcode->constraints; ++ char *constraints = opcode->constraints; ++ char *opcode_str = opcode->opcode; + + insn2 = 0; + ok = 1; +@@ -342,14 +357,14 @@ + cmd_len = 4; + } + +- if (*op && *op != '?') ++ if (*constraints && *constraints != '?') + { +- int regs = REGISTER_P (*op); ++ int regs = REGISTER_P (*constraints); + +- ok = avr_operand (insn, insn2, addr, *op, op1, comment1, 0, &sym_op1, &sym_addr1); ++ ok = avr_operand (insn, insn2, addr, *constraints, opcode_str, op1, comment1, 0, &sym_op1, &sym_addr1); + +- if (ok && *(++op) == ',') +- ok = avr_operand (insn, insn2, addr, *(++op), op2, ++ if (ok && *(++constraints) == ',') ++ ok = avr_operand (insn, insn2, addr, *(++constraints), opcode_str, op2, + *comment1 ? comment2 : comment1, regs, &sym_op2, &sym_addr2); + } + } +--- ./bfd/bfd-in2.h.orig 2009-01-08 17:41:43.000000000 +0100 ++++ ./bfd/bfd-in2.h 2009-01-08 17:42:06.000000000 +0100 +@@ -1979,6 +1979,13 @@ #define bfd_mach_avr5 5 + #define bfd_mach_avr51 51 #define bfd_mach_avr6 6 +#define bfd_mach_avrxmega1 101 +#define bfd_mach_avrxmega2 102 diff --git a/devel/avr-binutils/files/patch-zzz-atmega128rfa1 b/devel/avr-binutils/files/patch-zzz-atmega128rfa1 new file mode 100644 index 000000000000..1b17841aab78 --- /dev/null +++ b/devel/avr-binutils/files/patch-zzz-atmega128rfa1 @@ -0,0 +1,21 @@ +--- gas/config/tc-avr.c.orig 2009-01-07 17:46:28.000000000 +0100 ++++ gas/config/tc-avr.c 2009-01-07 17:51:17.000000000 +0100 +@@ -189,6 +189,7 @@ + {"atmega1280", AVR_ISA_AVR51, bfd_mach_avr51}, + {"atmega1281", AVR_ISA_AVR51, bfd_mach_avr51}, + {"atmega1284p",AVR_ISA_AVR51, bfd_mach_avr51}, ++ {"atmega128rfa1",AVR_ISA_AVR51, bfd_mach_avr51}, + {"at90can128", AVR_ISA_AVR51, bfd_mach_avr51}, + {"at90usb1286",AVR_ISA_AVR51, bfd_mach_avr51}, + {"at90usb1287",AVR_ISA_AVR51, bfd_mach_avr51}, +--- gas/doc/c-avr.texi.orig 2009-01-09 12:46:10.000000000 +0100 ++++ gas/doc/c-avr.texi 2009-01-09 14:43:18.000000000 +0100 +@@ -71,7 +71,7 @@ + + Instruction set avr51 is for the enhanced AVR core with exactly 128K program + memory space (MCU types: atmega128, atmega1280, atmega1281, atmega1284p, +-at90can128, at90usb1286, at90usb1287). ++atmega128rfa1, at90can128, at90usb1286, at90usb1287). + + Instruction set avr6 is for the enhanced AVR core with a 3-byte PC (MCU types: + atmega2560, atmega2561). diff --git a/devel/avr-binutils/pkg-plist b/devel/avr-binutils/pkg-plist index db6d99cbf06d..6c828d8ec0be 100644 --- a/devel/avr-binutils/pkg-plist +++ b/devel/avr-binutils/pkg-plist @@ -16,11 +16,26 @@ avr/lib/ldscripts/avr2.xbn avr/lib/ldscripts/avr2.xn avr/lib/ldscripts/avr2.xr avr/lib/ldscripts/avr2.xu +avr/lib/ldscripts/avr25.x +avr/lib/ldscripts/avr25.xbn +avr/lib/ldscripts/avr25.xn +avr/lib/ldscripts/avr25.xr +avr/lib/ldscripts/avr25.xu avr/lib/ldscripts/avr3.x avr/lib/ldscripts/avr3.xbn avr/lib/ldscripts/avr3.xn avr/lib/ldscripts/avr3.xr avr/lib/ldscripts/avr3.xu +avr/lib/ldscripts/avr31.x +avr/lib/ldscripts/avr31.xbn +avr/lib/ldscripts/avr31.xn +avr/lib/ldscripts/avr31.xr +avr/lib/ldscripts/avr31.xu +avr/lib/ldscripts/avr35.x +avr/lib/ldscripts/avr35.xbn +avr/lib/ldscripts/avr35.xn +avr/lib/ldscripts/avr35.xr +avr/lib/ldscripts/avr35.xu avr/lib/ldscripts/avr4.x avr/lib/ldscripts/avr4.xbn avr/lib/ldscripts/avr4.xn @@ -31,6 +46,11 @@ avr/lib/ldscripts/avr5.xbn avr/lib/ldscripts/avr5.xn avr/lib/ldscripts/avr5.xr avr/lib/ldscripts/avr5.xu +avr/lib/ldscripts/avr51.x +avr/lib/ldscripts/avr51.xbn +avr/lib/ldscripts/avr51.xn +avr/lib/ldscripts/avr51.xr +avr/lib/ldscripts/avr51.xu avr/lib/ldscripts/avr6.x avr/lib/ldscripts/avr6.xbn avr/lib/ldscripts/avr6.xn @@ -44,7 +64,7 @@ avr/lib/ldscripts/avrxmega1.xu avr/lib/ldscripts/avrxmega2.x avr/lib/ldscripts/avrxmega2.xbn avr/lib/ldscripts/avrxmega2.xn -avr/lib/ldscripts/avrxmega2.xr +avr/lib/ldscripts/avrxmega2.xr avr/lib/ldscripts/avrxmega2.xu avr/lib/ldscripts/avrxmega3.x avr/lib/ldscripts/avrxmega3.xbn |