update to binutils 2.18, plus some new devices. based on the freebsd port.

This commit is contained in:
ckuethe 2008-10-01 04:46:19 +00:00
parent 0f0a23511a
commit d42c86d6b0
60 changed files with 6575 additions and 124 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.3 2007/09/16 02:52:57 merdely Exp $
# $OpenBSD: Makefile,v 1.4 2008/10/01 04:46:19 ckuethe Exp $
COMMENT= Atmel AVR 8-bit RISC microcontrollers' GNU binutils
VER= 2.15
VER= 2.18
DISTNAME= binutils-${VER}
PKGNAME= avr-binutils-${VER}p0
PKGNAME= avr-binutils-${VER}
EXTRACT_SUFX= .tar.bz2
HOMEPAGE= http://www.gnu.org/software/binutils/

View File

@ -1,5 +1,5 @@
MD5 (binutils-2.15.tar.bz2) = Yk5rdJg6xrKWDtry1SLKWA==
RMD160 (binutils-2.15.tar.bz2) = YrUKADPltJG1h7d98wTrKLxSpro=
SHA1 (binutils-2.15.tar.bz2) = msbke+jNeDhdPV4JxrtCDjV8TAc=
SHA256 (binutils-2.15.tar.bz2) = 7AZOaTqtgh8PuULW2ln39rXR2Z48wQBRSvg33rOUDSQ=
SIZE (binutils-2.15.tar.bz2) = 11515075
MD5 (binutils-2.18.tar.bz2) = nSLuTa+joZRFfK9HBvnPAQ==
RMD160 (binutils-2.18.tar.bz2) = eNB0dWZ8Vey/kGjbuQNio0RbKpk=
SHA1 (binutils-2.18.tar.bz2) = /eyS6d/GwyFVhp85EPRwQceOInc=
SHA256 (binutils-2.18.tar.bz2) = SHozpFLw7c8fi7j8I9/1x6gu3sPz+LZWMrbJRelh7ps=
SIZE (binutils-2.18.tar.bz2) = 14962245

View File

@ -0,0 +1,50 @@
$OpenBSD: patch-bfd_Makefile_am,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/Makefile.am.orig Tue Aug 28 13:20:14 2007
+++ bfd/Makefile.am Sat Sep 27 20:20:27 2008
@@ -208,6 +208,8 @@ BFD32_BACKENDS = \
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 @@ BFD32_BACKENDS_CFILES = \
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 @@ DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libto
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-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR
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 \

View File

@ -1,12 +1,60 @@
$OpenBSD: patch-bfd_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- bfd/Makefile.in.orig Sat Jun 25 09:30:30 2005
+++ bfd/Makefile.in Sat Jun 25 09:31:06 2005
@@ -1099,7 +1099,7 @@ install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
$OpenBSD: patch-bfd_Makefile_in,v 1.2 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/Makefile.in.orig Tue Aug 28 13:20:12 2007
+++ bfd/Makefile.in Sat Sep 27 20:20:27 2008
@@ -458,6 +458,8 @@ BFD32_BACKENDS = \
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 \
@@ -637,6 +639,8 @@ BFD32_BACKENDS_CFILES = \
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 \
@@ -1206,7 +1210,8 @@ installdirs-am:
for dir in "$(DESTDIR)$(bfdlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
-install: install-recursive
+#install: install-recursive
+install:
uninstall-am: uninstall-bfdlibLTLIBRARIES
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h
@@ -1556,13 +1561,13 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
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," \
@@ -1766,6 +1771,12 @@ coff-aux.lo: coff-aux.c $(INCDIR)/filenames.h $(INCDIR
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 \

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-bfd_archures_c,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/archures.c.orig Mon Aug 6 12:59:14 2007
+++ bfd/archures.c Sat Sep 27 20:20:27 2008
@@ -346,6 +346,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). *}

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-bfd_bfd-in2_h,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/bfd-in2.h.orig Mon Aug 6 12:59:15 2007
+++ bfd/bfd-in2.h Sat Sep 27 20:20:27 2008
@@ -2017,6 +2017,13 @@ enum bfd_architecture
#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). */

View File

@ -0,0 +1,613 @@
$OpenBSD: patch-bfd_coff-avr_c,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/coff-avr.c.orig Sat Sep 27 20:20:27 2008
+++ bfd/coff-avr.c Sat Sep 27 20:20:27 2008
@@ -0,0 +1,609 @@
+/* BFD back-end for Atmel AVR COFF files.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003
+ Free Software Foundation, Inc.
+ Created mostly by substituting "avr" for "i860" in coff-i860.c
+
+This file is part of BFD, the Binary File Descriptor library.
+
+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. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+#include "coff/avr.h"
+
+#include "coff/internal.h"
+
+#include "libcoff.h"
+
+static bfd_reloc_status_type coff_avr_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *coff_avr_rtype_to_howto
+ PARAMS ((bfd *, asection *, struct internal_reloc *,
+ struct coff_link_hash_entry *, struct internal_syment *,
+ bfd_vma *));
+static const bfd_target * coff_avr_object_p PARAMS ((bfd *));
+
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+/* The page size is a guess based on ELF. */
+
+#define COFF_PAGE_SIZE 0x1000
+
+/* For some reason when using avr COFF the value stored in the .text
+ section for a reference to a common symbol is the value itself plus
+ any desired offset. Ian Taylor, Cygnus Support. */
+
+/* If we are producing relocateable output, we need to do some
+ adjustments to the object file that are not done by the
+ bfd_perform_relocation function. This function is called by every
+ reloc type to make any required adjustments. */
+
+static bfd_reloc_status_type
+coff_avr_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
+ error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section ATTRIBUTE_UNUSED;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ symvalue diff;
+
+ if (output_bfd == (bfd *) NULL)
+ return bfd_reloc_continue;
+
+ if (bfd_is_com_section (symbol->section))
+ {
+ /* We are relocating a common symbol. The current value in the
+ object file is ORIG + OFFSET, where ORIG is the value of the
+ common symbol as seen by the object file when it was compiled
+ (this may be zero if the symbol was undefined) and OFFSET is
+ the offset into the common symbol (normally zero, but may be
+ non-zero when referring to a field in a common structure).
+ ORIG is the negative of reloc_entry->addend, which is set by
+ the CALC_ADDEND macro below. We want to replace the value in
+ the object file with NEW + OFFSET, where NEW is the value of
+ the common symbol which we are going to put in the final
+ object file. NEW is symbol->value. */
+ diff = symbol->value + reloc_entry->addend;
+ }
+ else
+ {
+ /* For some reason bfd_perform_relocation always effectively
+ ignores the addend for a COFF target when producing
+ relocateable output. This seems to be always wrong for 860
+ COFF, so we handle the addend here instead. */
+ diff = reloc_entry->addend;
+ }
+
+#define DOIT(x) \
+ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
+
+ if (diff != 0)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, addr);
+ }
+ break;
+
+ case 1:
+ {
+ short x = bfd_get_16 (abfd, addr);
+ DOIT (x);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ case 2:
+ {
+ long x = bfd_get_32 (abfd, addr);
+ DOIT (x);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Now let bfd_perform_relocation finish everything up. */
+ return bfd_reloc_continue;
+}
+
+#ifndef PCRELOFFSET
+#define PCRELOFFSET FALSE
+#endif
+
+static reloc_howto_type howto_table[] =
+{
+ EMPTY_HOWTO (0),
+ EMPTY_HOWTO (1),
+ EMPTY_HOWTO (2),
+ EMPTY_HOWTO (3),
+ EMPTY_HOWTO (4),
+ EMPTY_HOWTO (5),
+ HOWTO (R_DIR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "dir32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ /* {7}, */
+ HOWTO (R_IMAGEBASE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "rva32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ EMPTY_HOWTO (010),
+ EMPTY_HOWTO (011),
+ EMPTY_HOWTO (012),
+ EMPTY_HOWTO (013),
+ EMPTY_HOWTO (014),
+ EMPTY_HOWTO (015),
+ EMPTY_HOWTO (016),
+ HOWTO (R_RELBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_RELWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_RELLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "DISP8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "DISP16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_avr_reloc, /* special_function */
+ "DISP32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET) /* pcrel_offset */
+};
+
+/* Turn a howto into a reloc nunmber */
+
+#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
+#define BADMAG(x) AVRBADMAG(x)
+#define AVR 1 /* Customize coffcode.h */
+
+#define RTYPE2HOWTO(cache_ptr, dst) \
+ (cache_ptr)->howto = howto_table + (dst)->r_type;
+
+/* For AVR COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
+ library. On some other COFF targets STYP_BSS is normally
+ STYP_NOLOAD. */
+#define BSS_NOLOAD_IS_SHARED_LIBRARY
+
+/* Compute the addend of a reloc. If the reloc is to a common symbol,
+ the object file contains the value of the common symbol. By the
+ time this is called, the linker may be using a different symbol
+ from a different object file with a different value. Therefore, we
+ hack wildly to locate the original symbol from this file so that we
+ can make the correct adjustment. This macro sets coffsym to the
+ symbol from the original file, and uses it to set the addend value
+ correctly. If this is not a common symbol, the usual addend
+ calculation is done, except that an additional tweak is needed for
+ PC relative relocs.
+ FIXME: This macro refers to symbols and asect; these are from the
+ calling function, not the macro arguments. */
+
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
+ { \
+ coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
+ coffsym = (obj_symbols (abfd) \
+ + (cache_ptr->sym_ptr_ptr - symbols)); \
+ else if (ptr) \
+ coffsym = coff_symbol_from (abfd, ptr); \
+ if (coffsym != (coff_symbol_type *) NULL \
+ && coffsym->native->u.syment.n_scnum == 0) \
+ cache_ptr->addend = - coffsym->native->u.syment.n_value; \
+ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
+ && ptr->section != (asection *) NULL) \
+ cache_ptr->addend = - (ptr->section->vma + ptr->value); \
+ else \
+ cache_ptr->addend = 0; \
+ if (ptr && howto_table[reloc.r_type].pc_relative) \
+ cache_ptr->addend += asect->vma; \
+ }
+
+/* We use the special COFF backend linker. */
+#define coff_relocate_section _bfd_coff_generic_relocate_section
+
+static reloc_howto_type *
+coff_avr_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+ struct internal_reloc *rel;
+ struct coff_link_hash_entry *h;
+ struct internal_syment *sym;
+ bfd_vma *addendp;
+{
+
+ reloc_howto_type *howto;
+
+ howto = howto_table + rel->r_type;
+
+ if (howto->pc_relative)
+ *addendp += sec->vma;
+
+ if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+ {
+ /* This is a common symbol. The section contents include the
+ size (sym->n_value) as an addend. The relocate_section
+ function will be adding in the final value of the symbol. We
+ need to subtract out the current size in order to get the
+ correct result. */
+
+ BFD_ASSERT (h != NULL);
+
+ /* I think we *do* want to bypass this. If we don't, I have seen some data
+ parameters get the wrong relcation address. If I link two versions
+ with and without this section bypassed and then do a binary comparison,
+ the addresses which are different can be looked up in the map. The
+ case in which this section has been bypassed has addresses which correspond
+ to values I can find in the map. */
+ *addendp -= sym->n_value;
+ }
+
+ /* If the output symbol is common (in which case this must be a
+ relocateable link), we need to add in the final size of the
+ common symbol. */
+ if (h != NULL && h->root.type == bfd_link_hash_common)
+ *addendp += h->root.u.c.size;
+
+ return howto;
+}
+
+#define coff_rtype_to_howto coff_avr_rtype_to_howto
+
+#include "coffcode.h"
+
+static const bfd_target *
+coff_avr_object_p(a)
+ bfd *a;
+{
+ return coff_object_p (a);
+}
+
+/* Handle all the abominations of AVR COFF:
+
+ Generic COFF always uses the D1 slot to indicate the "most
+ important" derived type, and the D2...Dn slots for decreasing
+ importance. E. g., a function symbol will always have its DT_FCN
+ element in D1, an array its DT_ARY (its first DT_ARY in a
+ multi-dimensional array). In contrast, AVR COFF expects this most
+ important derived type specifier in the upmost Dn slot that is
+ allocated at all (i. e. that is != 0).
+
+ Generic COFF says that "Any symbol that satisfies more than one
+ condition [... for AUX entries] should have a union format in its
+ auxiliary entry." AVR COFF uses sepearate AUX entries for multiple
+ derived types, and in some cases (like the ISFCN one), even puts
+ the most important one into the last allocated AUX entry. We
+ join/split them here at the border as well. Note that when
+ generating AUX entries (where we need to split them), the n_numaux
+ field must already have been set up properly (e. g. in
+ binutils/wrcoff.c) since the entry renumbering and pointerization
+ would not work otherwise. Thus, we only split the information into
+ multiple records if n_numaux > 1. For similar reasons, we keep
+ n_numaux > 1 on input to keep the appropriate AUX entries
+ allocated, so a symbol can be reconstructed if it is being passed
+ through one of the GNU tools.
+
+ Note that this adjustment is called after the symbol itself has
+ been swapped in, but before the AUX entries are swapped in. This
+ is the only hook available that could swap (or merge) AUX entries
+ at all, so we have to operate on the external AUX entries still. */
+
+void
+avr_coff_adjust_sym_in_post (abfd, ext, in)
+ bfd *abfd;
+ PTR ext;
+ PTR in;
+{
+ struct internal_syment *dst = (struct internal_syment *)in;
+ unsigned short dt, bt, ndt;
+ dt = dst->n_type & ~N_BTMASK;
+ bt = BTYPE (dst->n_type);
+
+ /* Some AVR COFF producers seem to violate the COFF specs, and
+ produce symbols for tag names that have the C_FOO filled in
+ properly, but T_NULL as the base type value. Patch up here,
+ since some of our generic COFF tools (in particular
+ binutils/rdcoff.c) rely on the correct data. */
+ if (bt == T_NULL)
+ switch (dst->n_sclass)
+ {
+ case C_STRTAG:
+ bt = T_STRUCT;
+ break;
+
+ case C_UNTAG:
+ bt = T_UNION;
+ break;
+
+ case C_ENTAG:
+ bt = T_ENUM;
+ break;
+ }
+
+ /* Swap the derived type slots. */
+ if (dt != 0)
+ {
+ ndt = 0;
+ while (dt != 0)
+ {
+ ndt = (ndt << N_TSHIFT) | (dt & (N_TMASK >> N_BTSHFT));
+ dt >>= N_TSHIFT;
+ }
+ dst->n_type = (ndt << N_BTSHFT) | bt;
+ }
+ else
+ dst->n_type = bt;
+
+ /* If the derived type is function, and there is more than one AUX
+ entry, swap the first and the last AUX entry, so the most
+ interesting one will become the first.
+
+ If the fundamental type is a tagged type (struct/union/enum), try
+ to find the AUX entry describing the tagged type (the one that
+ has x_sym.x_tagndx filled in), and merge the tag index into the
+ first AUX entry. Depending on the actual input file, there might
+ be further DT_PTR entries which we just ignore, since we could
+ not handle that information anyway. */
+ if (dst->n_numaux > 1 && dst->n_sclass != C_FILE)
+ {
+ AUXENT caux, *auxp1, *auxp2;
+ size_t symesz;
+ unsigned int i;
+
+ symesz = bfd_coff_symesz (abfd);
+ i = dst->n_numaux;
+
+ auxp1 = (AUXENT *)((char *)ext + symesz);
+ auxp2 = (AUXENT *)((char *)ext + i * symesz);
+
+ if (ISFCN (dst->n_type)
+ || (ISPTR(dst->n_type)
+ && (bt == T_STRUCT || bt == T_UNION || bt == T_ENUM)))
+ {
+ caux = *auxp2;
+ *auxp2 = *auxp1;
+ *auxp1 = caux;
+ }
+ else
+ caux = *auxp1;
+
+ if ((ISFCN (dst->n_type) || ISARY (dst->n_type))
+ && (bt == T_STRUCT || bt == T_UNION || bt == T_ENUM))
+ {
+ while (i > 1)
+ {
+ auxp2 = (AUXENT *)((char *)ext + i * symesz);
+
+ if (auxp2->x_sym.x_tagndx[0] != 0 || auxp2->x_sym.x_tagndx[1] != 0
+ || auxp2->x_sym.x_tagndx[2] != 0 || auxp2->x_sym.x_tagndx[3] != 0)
+ {
+ memcpy (caux.x_sym.x_tagndx, auxp2->x_sym.x_tagndx,
+ 4 * sizeof (char));
+ break;
+ }
+ i--;
+ }
+ if (i > 1)
+ *auxp1 = caux;
+ }
+ }
+}
+
+/* When exporting an AVR COFF file, just undo all that has been done
+ above. Again, we are called after the symbol itself has been
+ swapped out, but before the AUX entries are being written.
+ Unfortunately, we are only given a pointer to the symbol itself, so
+ we have to derive the pointer to the respective aux entries from
+ that address, which is a bit clumsy. */
+void
+avr_coff_adjust_sym_out_post (abfd, in, ext)
+ bfd *abfd;
+ PTR in;
+ PTR ext;
+{
+ struct internal_syment *src = (struct internal_syment *)(in);
+ struct external_syment *dst = (struct external_syment *)(ext);
+ unsigned short dt, bt, ndt;
+
+ dt = src->n_type & ~N_BTMASK;
+ bt = BTYPE (src->n_type);
+
+ if (dt != 0)
+ {
+ ndt = 0;
+ while (dt != 0)
+ {
+ ndt = (ndt << N_TSHIFT) | (dt & (N_TMASK >> N_BTSHFT));
+ dt >>= N_TSHIFT;
+ }
+ H_PUT_16 (abfd, (ndt << N_BTSHFT) | bt, dst->e_type);
+ }
+
+ if (src->n_numaux > 1 && src->n_sclass != C_FILE)
+ {
+ combined_entry_type *srce, *dste;
+ char *hackp;
+ unsigned int i;
+
+ /* Recover the original combinend_entry_type *. */
+ hackp = (char *)in;
+ hackp -= offsetof(combined_entry_type, u.syment);
+ srce = (combined_entry_type *)hackp;
+ srce++;
+
+ /* We simply duplicate the first AUX entry as many times as
+ needed. Since COFF itself normally uses just a single AUX
+ entry for all the information, this will work -- each COFF
+ consumer will then just pick the fields it is particularly
+ interested in. This would not work for the AVR COFF specific
+ DT_PTR AUX entries, but we don't support them anyway. */
+ for (i = 1; i < src->n_numaux; i++)
+ {
+ dste = srce + i;
+ *dste = *srce;
+ }
+ }
+}
+
+const bfd_target
+#ifdef TARGET_SYM
+ TARGET_SYM =
+#else
+ avrcoff_vec =
+#endif
+{
+#ifdef TARGET_NAME
+ TARGET_NAME,
+#else
+ "coff-avr", /* name */
+#endif
+ bfd_target_coff_flavour,
+ BFD_ENDIAN_LITTLE, /* data byte order is little */
+ BFD_ENDIAN_LITTLE, /* header byte order is little */
+
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT),
+
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ 0, /* leading char */
+ '/', /* ar_pad_char */
+ 15, /* ar_max_namelen */
+
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+/* Note that we allow an object file to be treated as a core file as well. */
+ {_bfd_dummy_target, coff_avr_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, coff_avr_object_p},
+ {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
+ bfd_false},
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (coff),
+ BFD_JUMP_TABLE_COPY (coff),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_SYMBOLS (coff),
+ BFD_JUMP_TABLE_RELOCS (coff),
+ BFD_JUMP_TABLE_WRITE (coff),
+ BFD_JUMP_TABLE_LINK (coff),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ NULL,
+
+ COFF_SWAP_TABLE
+};

View File

@ -0,0 +1,428 @@
$OpenBSD: patch-bfd_coff-ext-avr_c,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/coff-ext-avr.c.orig Sat Sep 27 20:20:27 2008
+++ bfd/coff-ext-avr.c Sat Sep 27 20:20:27 2008
@@ -0,0 +1,424 @@
+/* BFD back-end for Atmel AVR "extended" COFF files.
+ Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2003
+ Free Software Foundation, Inc.
+ This is mostly the same as avr-coff, except of the presence of the
+ COFF optional header.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+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. */
+
+#include "bfd.h"
+#include "sysdep.h"
+#include "libbfd.h"
+
+#define AVR_EXT_COFF 1
+#include "coff/avr.h"
+
+#include "coff/internal.h"
+
+#include "libcoff.h"
+
+static bfd_reloc_status_type coff_ext_avr_reloc
+ PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
+static reloc_howto_type *coff_ext_avr_rtype_to_howto
+ PARAMS ((bfd *, asection *, struct internal_reloc *,
+ struct coff_link_hash_entry *, struct internal_syment *,
+ bfd_vma *));
+static const bfd_target * coff_ext_avr_object_p PARAMS ((bfd *));
+
+#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
+/* The page size is a guess based on ELF. */
+
+#define COFF_PAGE_SIZE 0x1000
+
+/* For some reason when using avr COFF the value stored in the .text
+ section for a reference to a common symbol is the value itself plus
+ any desired offset. Ian Taylor, Cygnus Support. */
+
+/* If we are producing relocateable output, we need to do some
+ adjustments to the object file that are not done by the
+ bfd_perform_relocation function. This function is called by every
+ reloc type to make any required adjustments. */
+
+static bfd_reloc_status_type
+coff_ext_avr_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
+ error_message)
+ bfd *abfd;
+ arelent *reloc_entry;
+ asymbol *symbol;
+ PTR data;
+ asection *input_section ATTRIBUTE_UNUSED;
+ bfd *output_bfd;
+ char **error_message ATTRIBUTE_UNUSED;
+{
+ symvalue diff;
+
+ if (output_bfd == (bfd *) NULL)
+ return bfd_reloc_continue;
+
+ if (bfd_is_com_section (symbol->section))
+ {
+ /* We are relocating a common symbol. The current value in the
+ object file is ORIG + OFFSET, where ORIG is the value of the
+ common symbol as seen by the object file when it was compiled
+ (this may be zero if the symbol was undefined) and OFFSET is
+ the offset into the common symbol (normally zero, but may be
+ non-zero when referring to a field in a common structure).
+ ORIG is the negative of reloc_entry->addend, which is set by
+ the CALC_ADDEND macro below. We want to replace the value in
+ the object file with NEW + OFFSET, where NEW is the value of
+ the common symbol which we are going to put in the final
+ object file. NEW is symbol->value. */
+ diff = symbol->value + reloc_entry->addend;
+ }
+ else
+ {
+ /* For some reason bfd_perform_relocation always effectively
+ ignores the addend for a COFF target when producing
+ relocateable output. This seems to be always wrong for 860
+ COFF, so we handle the addend here instead. */
+ diff = reloc_entry->addend;
+ }
+
+#define DOIT(x) \
+ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
+
+ if (diff != 0)
+ {
+ reloc_howto_type *howto = reloc_entry->howto;
+ unsigned char *addr = (unsigned char *) data + reloc_entry->address;
+
+ switch (howto->size)
+ {
+ case 0:
+ {
+ char x = bfd_get_8 (abfd, addr);
+ DOIT (x);
+ bfd_put_8 (abfd, x, addr);
+ }
+ break;
+
+ case 1:
+ {
+ short x = bfd_get_16 (abfd, addr);
+ DOIT (x);
+ bfd_put_16 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ case 2:
+ {
+ long x = bfd_get_32 (abfd, addr);
+ DOIT (x);
+ bfd_put_32 (abfd, (bfd_vma) x, addr);
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Now let bfd_perform_relocation finish everything up. */
+ return bfd_reloc_continue;
+}
+
+#ifndef PCRELOFFSET
+#define PCRELOFFSET FALSE
+#endif
+
+static reloc_howto_type howto_table[] =
+{
+ EMPTY_HOWTO (0),
+ EMPTY_HOWTO (1),
+ EMPTY_HOWTO (2),
+ EMPTY_HOWTO (3),
+ EMPTY_HOWTO (4),
+ EMPTY_HOWTO (5),
+ HOWTO (R_DIR32, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "dir32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ TRUE), /* pcrel_offset */
+ /* {7}, */
+ HOWTO (R_IMAGEBASE, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "rva32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ FALSE), /* pcrel_offset */
+ EMPTY_HOWTO (010),
+ EMPTY_HOWTO (011),
+ EMPTY_HOWTO (012),
+ EMPTY_HOWTO (013),
+ EMPTY_HOWTO (014),
+ EMPTY_HOWTO (015),
+ EMPTY_HOWTO (016),
+ HOWTO (R_RELBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_RELWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_RELLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_bitfield, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRBYTE, /* type */
+ 0, /* rightshift */
+ 0, /* size (0 = byte, 1 = short, 2 = long) */
+ 8, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "DISP8", /* name */
+ TRUE, /* partial_inplace */
+ 0x000000ff, /* src_mask */
+ 0x000000ff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRWORD, /* type */
+ 0, /* rightshift */
+ 1, /* size (0 = byte, 1 = short, 2 = long) */
+ 16, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "DISP16", /* name */
+ TRUE, /* partial_inplace */
+ 0x0000ffff, /* src_mask */
+ 0x0000ffff, /* dst_mask */
+ PCRELOFFSET), /* pcrel_offset */
+ HOWTO (R_PCRLONG, /* type */
+ 0, /* rightshift */
+ 2, /* size (0 = byte, 1 = short, 2 = long) */
+ 32, /* bitsize */
+ TRUE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_signed, /* complain_on_overflow */
+ coff_ext_avr_reloc, /* special_function */
+ "DISP32", /* name */
+ TRUE, /* partial_inplace */
+ 0xffffffff, /* src_mask */
+ 0xffffffff, /* dst_mask */
+ PCRELOFFSET) /* pcrel_offset */
+};
+
+/* Turn a howto into a reloc nunmber */
+
+#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
+#define BADMAG(x) AVRBADMAG(x)
+#define AVR 1 /* Customize coffcode.h */
+
+#define RTYPE2HOWTO(cache_ptr, dst) \
+ (cache_ptr)->howto = howto_table + (dst)->r_type;
+
+/* For AVR COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
+ library. On some other COFF targets STYP_BSS is normally
+ STYP_NOLOAD. */
+#define BSS_NOLOAD_IS_SHARED_LIBRARY
+
+/* Compute the addend of a reloc. If the reloc is to a common symbol,
+ the object file contains the value of the common symbol. By the
+ time this is called, the linker may be using a different symbol
+ from a different object file with a different value. Therefore, we
+ hack wildly to locate the original symbol from this file so that we
+ can make the correct adjustment. This macro sets coffsym to the
+ symbol from the original file, and uses it to set the addend value
+ correctly. If this is not a common symbol, the usual addend
+ calculation is done, except that an additional tweak is needed for
+ PC relative relocs.
+ FIXME: This macro refers to symbols and asect; these are from the
+ calling function, not the macro arguments. */
+
+#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
+ { \
+ coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
+ if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
+ coffsym = (obj_symbols (abfd) \
+ + (cache_ptr->sym_ptr_ptr - symbols)); \
+ else if (ptr) \
+ coffsym = coff_symbol_from (abfd, ptr); \
+ if (coffsym != (coff_symbol_type *) NULL \
+ && coffsym->native->u.syment.n_scnum == 0) \
+ cache_ptr->addend = - coffsym->native->u.syment.n_value; \
+ else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
+ && ptr->section != (asection *) NULL) \
+ cache_ptr->addend = - (ptr->section->vma + ptr->value); \
+ else \
+ cache_ptr->addend = 0; \
+ if (ptr && howto_table[reloc.r_type].pc_relative) \
+ cache_ptr->addend += asect->vma; \
+ }
+
+/* We use the special COFF backend linker. */
+#define coff_relocate_section _bfd_coff_generic_relocate_section
+
+static reloc_howto_type *
+coff_ext_avr_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *sec;
+ struct internal_reloc *rel;
+ struct coff_link_hash_entry *h;
+ struct internal_syment *sym;
+ bfd_vma *addendp;
+{
+
+ reloc_howto_type *howto;
+
+ howto = howto_table + rel->r_type;
+
+ if (howto->pc_relative)
+ *addendp += sec->vma;
+
+ if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
+ {
+ /* This is a common symbol. The section contents include the
+ size (sym->n_value) as an addend. The relocate_section
+ function will be adding in the final value of the symbol. We
+ need to subtract out the current size in order to get the
+ correct result. */
+
+ BFD_ASSERT (h != NULL);
+
+ /* I think we *do* want to bypass this. If we don't, I have seen some data
+ parameters get the wrong relcation address. If I link two versions
+ with and without this section bypassed and then do a binary comparison,
+ the addresses which are different can be looked up in the map. The
+ case in which this section has been bypassed has addresses which correspond
+ to values I can find in the map. */
+ *addendp -= sym->n_value;
+ }
+
+ /* If the output symbol is common (in which case this must be a
+ relocateable link), we need to add in the final size of the
+ common symbol. */
+ if (h != NULL && h->root.type == bfd_link_hash_common)
+ *addendp += h->root.u.c.size;
+
+ return howto;
+}
+
+#define coff_rtype_to_howto coff_ext_avr_rtype_to_howto
+
+#include "coffcode.h"
+
+static const bfd_target *
+coff_ext_avr_object_p(a)
+ bfd *a;
+{
+ return coff_object_p (a);
+}
+
+const bfd_target
+#ifdef TARGET_SYM
+ TARGET_SYM =
+#else
+ avrextcoff_vec =
+#endif
+{
+#ifdef TARGET_NAME
+ TARGET_NAME,
+#else
+ "coff-ext-avr", /* name */
+#endif
+ bfd_target_coff_flavour,
+ BFD_ENDIAN_LITTLE, /* data byte order is little */
+ BFD_ENDIAN_LITTLE, /* header byte order is little */
+
+ (HAS_RELOC | EXEC_P | /* object flags */
+ HAS_LINENO | HAS_DEBUG |
+ HAS_SYMS | HAS_LOCALS | WP_TEXT),
+
+ (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+ 0, /* leading char */
+ '/', /* ar_pad_char */
+ 15, /* ar_max_namelen */
+
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
+ bfd_getl64, bfd_getl_signed_64, bfd_putl64,
+ bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+ bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
+
+/* Note that we allow an object file to be treated as a core file as well. */
+ {_bfd_dummy_target, coff_ext_avr_object_p, /* bfd_check_format */
+ bfd_generic_archive_p, coff_ext_avr_object_p},
+ {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
+ bfd_false},
+ {bfd_false, coff_write_object_contents, /* bfd_write_contents */
+ _bfd_write_archive_contents, bfd_false},
+
+ BFD_JUMP_TABLE_GENERIC (coff),
+ BFD_JUMP_TABLE_COPY (coff),
+ BFD_JUMP_TABLE_CORE (_bfd_nocore),
+ BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
+ BFD_JUMP_TABLE_SYMBOLS (coff),
+ BFD_JUMP_TABLE_RELOCS (coff),
+ BFD_JUMP_TABLE_WRITE (coff),
+ BFD_JUMP_TABLE_LINK (coff),
+ BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
+
+ NULL,
+
+ COFF_SWAP_TABLE
+};

View File

@ -0,0 +1,178 @@
$OpenBSD: patch-bfd_coffcode_h,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/coffcode.h.orig Mon Aug 6 12:59:19 2007
+++ bfd/coffcode.h Sat Sep 27 20:20:27 2008
@@ -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 @@ coff_mkobject (bfd * abfd)
coff->relocbase = 0;
coff->local_toc_sym_map = 0;
+ /* These members communicate important constants about the symbol
+ table to GDB's symbol-reading code. These `constants'
+ unfortunately vary among coff implementations... */
+ coff->local_n_btmask = N_BTMASK;
+ coff->local_n_btshft = N_BTSHFT;
+ coff->local_n_tmask = N_TMASK;
+ coff->local_n_tshift = N_TSHIFT;
+ coff->local_symesz = bfd_coff_symesz (abfd);
+ coff->local_auxesz = bfd_coff_auxesz (abfd);
+ coff->local_linesz = bfd_coff_linesz (abfd);
+
/* make_abs_section(abfd);*/
return TRUE;
@@ -1793,17 +1805,6 @@ coff_mkobject_hook (bfd * abfd,
coff->sym_filepos = internal_f->f_symptr;
- /* These members communicate important constants about the symbol
- table to GDB's symbol-reading code. These `constants'
- unfortunately vary among coff implementations... */
- coff->local_n_btmask = N_BTMASK;
- coff->local_n_btshft = N_BTSHFT;
- coff->local_n_tmask = N_TMASK;
- coff->local_n_tshift = N_TSHIFT;
- coff->local_symesz = bfd_coff_symesz (abfd);
- coff->local_auxesz = bfd_coff_auxesz (abfd);
- coff->local_linesz = bfd_coff_linesz (abfd);
-
coff->timestamp = internal_f->f_timdat;
obj_raw_syment_count (abfd) =
@@ -1930,6 +1931,11 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
}
break;
#endif
+#ifdef AVRMAGIC
+ case AVRMAGIC:
+ arch = bfd_arch_avr;
+ break;
+#endif
#ifdef MC68MAGIC
case MC68MAGIC:
case M68MAGIC:
@@ -2726,6 +2732,13 @@ coff_set_flags (bfd * abfd,
return TRUE;
#endif
+#ifdef AVRMAGIC
+ case bfd_arch_avr:
+ *magicp = AVRMAGIC;
+ return TRUE;
+ break;
+#endif
+
#ifdef PPCMAGIC
case bfd_arch_powerpc:
*magicp = PPCMAGIC;
@@ -3522,6 +3535,11 @@ coff_write_object_contents (bfd * abfd)
section.s_page = coff_get_section_load_page (current);
#endif
+#ifdef AVR
+ /* AVR uses s_paddr the way GNU uses s_vaddr, and effectively
+ ignores s_vaddr. */
+ section.s_paddr = current->vma;
+#endif
#ifdef COFF_WITH_PE
section.s_paddr = 0;
#endif
@@ -3866,6 +3884,17 @@ coff_write_object_contents (bfd * abfd)
internal_a.magic = ZMAGIC;
#endif
+#ifdef AVR
+ /* a.out is a dummy for non-extended COFF */
+ internal_a.magic = AVRAOUTMAGIC;
+ /* Upper nibble of f_flags must be set for historical reasons.
+ The upper byte remains blank on coff-avr, so undo the F_AR32WR
+ setting performed above. */
+ internal_f.f_flags |= F_JUNK;
+ internal_f.f_flags &= ~F_UNUSED;
+#define __A_MAGIC_SET__
+#endif /* AVR */
+
#if defined(PPC_PE)
#define __A_MAGIC_SET__
internal_a.magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
@@ -3933,8 +3962,16 @@ coff_write_object_contents (bfd * abfd)
#endif
}
+#ifdef AVR_EXT_COFF
+ /* Note that we do not set F_PTRINFO because the GNU toolchain
+ doesn't provide any information about the target of a pointer,
+ so we cannot derive which section our pointer target would be
+ in. */
+ internal_a.vstamp = F_FULLPATHS | F_STRUCTINFO;
+#else
/* FIXME: Does anybody ever set this to another value? */
internal_a.vstamp = 0;
+#endif
/* Now should write relocs, strings, syms. */
obj_sym_filepos (abfd) = sym_base;
@@ -4120,22 +4157,29 @@ coff_write_object_contents (bfd * abfd)
char * buff;
bfd_size_type amount = bfd_coff_aoutsz (abfd);
- buff = bfd_malloc (amount);
- if (buff == NULL)
- return FALSE;
+ /* Do not attempt to malloc() zero bytes. According to the
+ C standard, the behaviour is implementation-defined, and
+ malloc() might return NULL in that case, which would confuse
+ us to assume an error where it actually isn't. */
+ if (amount != 0)
+ {
+ buff = bfd_malloc (amount);
+ if (buff == NULL)
+ return FALSE;
- coff_swap_aouthdr_out (abfd, & internal_a, buff);
- amount = bfd_bwrite (buff, amount, abfd);
+ coff_swap_aouthdr_out (abfd, & internal_a, buff);
+ amount = bfd_bwrite (buff, amount, abfd);
- free (buff);
+ free (buff);
- if (amount != bfd_coff_aoutsz (abfd))
- return FALSE;
+ if (amount != bfd_coff_aoutsz (abfd))
+ return FALSE;
#ifdef COFF_IMAGE_WITH_PE
- if (! coff_apply_checksum (abfd))
- return FALSE;
+ if (! coff_apply_checksum (abfd))
+ return FALSE;
#endif
+ }
}
#ifdef RS6000COFF_C
else
@@ -4491,6 +4535,10 @@ coff_slurp_symbol_table (bfd * abfd)
/* In PE, 0x69 (105) denotes a weak external symbol. */
case C_NT_WEAK:
#endif
+#ifdef AVR
+ /* Some AVR COFF compilers handle EXTDEF like EXT. */
+ case C_EXTDEF: /* external definition */
+#endif
switch (coff_classify_symbol (abfd, &src->u.syment))
{
case COFF_SYMBOL_GLOBAL:
@@ -4714,7 +4762,9 @@ coff_slurp_symbol_table (bfd * abfd)
&& src->u.syment.n_scnum == 0)
break;
/* Fall through. */
+#if !defined(AVR)
case C_EXTDEF: /* External definition. */
+#endif
case C_ULABEL: /* Undefined label. */
case C_USTATIC: /* Undefined static. */
#ifndef COFF_WITH_PE

View File

@ -0,0 +1,106 @@
$OpenBSD: patch-bfd_coffgen_c,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/coffgen.c.orig Sun Aug 12 18:43:34 2007
+++ bfd/coffgen.c Sat Sep 27 20:20:27 2008
@@ -687,6 +687,20 @@ coff_renumber_symbols (bfd *bfd_ptr, int *first_undef)
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 @@ coff_fix_symbol_name (bfd *abfd,
{
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 @@ coff_write_symbols (bfd *abfd)
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 @@ coff_get_normalized_symtab (bfd *abfd)
{
/* 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 @@ coff_bfd_make_debug_symbol (bfd *abfd,
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;

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-bfd_coffswap_h,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/coffswap.h.orig Mon Aug 6 12:59:19 2007
+++ bfd/coffswap.h Sat Sep 27 20:20:27 2008
@@ -383,7 +383,11 @@ coff_swap_aux_in (bfd *abfd,
void * ext1,
int type,
int class,
- int indx,
+ int indx
+#if defined(AVR) && __GNUC__
+ __attribute__((unused))
+#endif
+ ,
int numaux,
void * in1)
{
@@ -409,9 +413,13 @@ coff_swap_aux_in (bfd *abfd,
#else
if (numaux > 1)
{
+#if defined(AVR)
+ memcpy (in->x_file.x_fname, ext->x_file.x_fname, sizeof (AUXENT));
+#else
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_fname,
numaux * sizeof (AUXENT));
+#endif
}
else
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-bfd_config_bfd,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/config.bfd.orig Tue Aug 28 10:19:33 2007
+++ bfd/config.bfd Sat Sep 27 20:20:27 2008
@@ -327,6 +327,7 @@ case "${targ}" in
avr-*-*)
targ_defvec=bfd_elf32_avr_vec
+ targ_selvecs="bfd_elf32_avr_vec avrcoff_vec avrextcoff_vec"
;;
bfin-*-*)

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-bfd_configure,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/configure.orig Tue Aug 28 13:19:51 2007
+++ bfd/configure Sat Sep 27 20:20:27 2008
@@ -19034,6 +19034,8 @@ do
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" ;;

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-bfd_configure_in,v 1.1 2008/10/01 04:46:19 ckuethe Exp $
--- bfd/configure.in.orig Tue Aug 28 13:19:56 2007
+++ bfd/configure.in Sat Sep 27 20:20:27 2008
@@ -612,6 +612,8 @@ do
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" ;;

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-bfd_cpu-avr_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- bfd/cpu-avr.c.orig Mon Aug 6 12:59:20 2007
+++ bfd/cpu-avr.c Sat Sep 27 20:20:27 2008
@@ -86,7 +86,29 @@ static const bfd_arch_info_type arch_info_struct[] =
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]),
+
+ /* 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 =

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-bfd_targets_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- bfd/targets.c.orig Mon Aug 6 12:59:42 2007
+++ bfd/targets.c Sat Sep 27 20:20:27 2008
@@ -558,6 +558,8 @@ extern const bfd_target armpe_big_vec;
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 @@ static const bfd_target * const _bfd_target_vector[] =
&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,

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-binutils_Makefile_am,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/Makefile.am.orig Mon Aug 6 12:55:08 2007
+++ binutils/Makefile.am Sat Sep 27 20:20:27 2008
@@ -98,7 +98,7 @@ CFILES = \
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 @@ GENERATED_CFILES = \
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

View File

@ -1,12 +1,30 @@
$OpenBSD: patch-binutils_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- binutils/Makefile.in.orig Fri Nov 28 05:58:41 2003
+++ binutils/Makefile.in Sat Jun 25 15:44:24 2005
@@ -120,7 +120,7 @@ INTLLIBS = @INTLLIBS@
$OpenBSD: patch-binutils_Makefile_in,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/Makefile.in.orig Mon Aug 6 13:29:53 2007
+++ binutils/Makefile.in Sat Sep 27 20:20:27 2008
@@ -129,7 +129,7 @@ am_nm_new_OBJECTS = nm.$(OBJEXT) $(am__objects_1)
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 @@ CFILES = \
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
AUTOMAKE_OPTIONS = cygnus dejagnu
GENERATED_CFILES = \
@@ -426,7 +426,7 @@ GENERATED_CFILES = \
defparse.c deflex.c nlmheader.c rcparse.c mcparse.c
-SUBDIRS = doc po
+SUBDIRS = doc
tooldir = $(exec_prefix)/$(target_alias)
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

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-binutils_bucomm_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/bucomm.c.orig Mon Aug 6 12:55:09 2007
+++ binutils/bucomm.c Sat Sep 27 20:20:27 2008
@@ -501,6 +501,32 @@ parse_vma (const char *s, const char *arg)
return ret;
}
+/* Return the basename of "file", i. e. everything minus whatever
+ directory part has been provided. Stolen from bfd/archive.c.
+ Should we also handle the VMS case (as in bfd/archive.c)? */
+const char *
+bu_basename (file)
+ const char *file;
+{
+ const char *filename = strrchr (file, '/');
+
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+ {
+ /* We could have foo/bar\\baz, or foo\\bar, or d:bar. */
+ char *bslash = strrchr (file, '\\');
+ if (filename == NULL || (bslash != NULL && bslash > filename))
+ filename = bslash;
+ if (filename == NULL && file[0] != '\0' && file[1] == ':')
+ filename = file + 1;
+ }
+#endif
+ if (filename != (char *) NULL)
+ filename++;
+ else
+ filename = file;
+ return filename;
+}
+
/* 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. */

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-binutils_bucomm_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/bucomm.h.orig Mon Aug 6 12:55:09 2007
+++ binutils/bucomm.h Sat Sep 27 20:20:27 2008
@@ -54,6 +54,8 @@ bfd_vma parse_vma (const char *, const char *);
off_t get_file_size (const char *);
+const char *bu_basename PARAMS ((const char *));
+
extern char *program_name;
/* filemode.c */

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-binutils_budbg_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/budbg.h.orig Mon Aug 6 12:55:09 2007
+++ binutils/budbg.h Sat Sep 27 20:20:27 2008
@@ -51,8 +51,11 @@ extern bfd_boolean parse_ieee (void *, bfd *, const bf
extern bfd_boolean write_ieee_debugging_info (bfd *, void *);
-/* Routine used to read COFF debugging information. */
+/* 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

View File

@ -0,0 +1,132 @@
$OpenBSD: patch-binutils_debug_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/debug.c.orig Mon Aug 6 12:55:10 2007
+++ binutils/debug.c Sat Sep 27 20:20:27 2008
@@ -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_real_list
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 @@ static bfd_boolean debug_type_samep
(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 @@ debug_set_filename (void *handle, const char *name)
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 @@ debug_start_source (void *handle, const char *name)
if (name == NULL)
name = "";
+ else
+ name = debug_xlat_pathname (name);
if (info->current_unit == NULL)
{
@@ -3369,4 +3392,70 @@ debug_class_type_samep (struct debug_handle *info, str
}
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;
}

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-binutils_debug_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/debug.h.orig Mon Aug 6 12:55:10 2007
+++ binutils/debug.h Sat Sep 27 20:20:27 2008
@@ -440,6 +440,12 @@ extern bfd_boolean debug_set_filename (void *, const c
extern bfd_boolean debug_start_source (void *, const char *);
+/* Register a pathname translation for source (and include) filenames.
+ This is used by the --change-pathname option of objcopy. */
+
+extern void debug_register_pathname_xlat
+ PARAMS ((const char *, const char *));
+
/* 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.

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-binutils_doc_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- binutils/doc/Makefile.in.orig Sat Jun 25 09:35:03 2005
+++ binutils/doc/Makefile.in Sat Jun 25 09:35:21 2005
@@ -166,7 +166,7 @@ CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi`
TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
-INFO_DEPS = binutils.info
+INFO_DEPS =
DVIS = binutils.dvi
TEXINFOS = binutils.texi
man1dir = $(mandir)/man1

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-binutils_doc_objcopy_1,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/doc/objcopy.1.orig Mon Aug 6 13:39:33 2007
+++ binutils/doc/objcopy.1 Sat Sep 27 20:20:27 2008
@@ -193,6 +193,8 @@ objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIb
[\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 @@ This option is used to build a \fI.sym\fR file for a V
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

View File

@ -0,0 +1,109 @@
$OpenBSD: patch-binutils_objcopy_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/objcopy.c.orig Mon Aug 6 12:56:13 2007
+++ binutils/objcopy.c Sat Sep 27 20:20:27 2008
@@ -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 @@ enum command_line_switch
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 @@ static struct option copy_options[] =
{"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 @@ copy_usage (FILE *stream, int exit_status)
--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 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
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 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
|| 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 @@ write_debugging_info (bfd *obfd, void *dhandle,
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 @@ copy_main (int argc, char *argv[])
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:

View File

@ -0,0 +1,147 @@
$OpenBSD: patch-binutils_rdcoff_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- binutils/rdcoff.c.orig Mon Aug 6 12:56:14 2007
+++ binutils/rdcoff.c Sat Sep 27 20:20:27 2008
@@ -82,6 +82,9 @@ struct coff_types
struct coff_slots *slots;
/* Basic types. */
debug_type basic[T_MAX + 1];
+ /* Some general information, kept here for convenience. */
+ size_t intsize; /* sizeof (int) */
+ size_t doublesize; /* sizeof (double) */
};
static debug_type *coff_get_slot (struct coff_types *, int);
@@ -101,6 +104,7 @@ static bfd_boolean parse_coff_symbol
(bfd *, struct coff_types *, asymbol *, long, struct internal_syment *,
void *, debug_type, bfd_boolean);
static bfd_boolean external_coff_symbol_p (int sym_class);
+static bfd_vma coff_convert_register (bfd *, bfd_vma);
/* Return the slot for a type. */
@@ -271,8 +275,7 @@ parse_coff_base_type (bfd *abfd, struct coff_symbols *
break;
case T_INT:
- /* FIXME: Perhaps the size should depend upon the architecture. */
- ret = debug_make_int_type (dhandle, 4, FALSE);
+ ret = debug_make_int_type (dhandle, types->intsize, FALSE);
name = "int";
break;
@@ -287,7 +290,7 @@ parse_coff_base_type (bfd *abfd, struct coff_symbols *
break;
case T_DOUBLE:
- ret = debug_make_float_type (dhandle, 8);
+ ret = debug_make_float_type (dhandle, types->doublesize);
name = "double";
break;
@@ -307,7 +310,7 @@ parse_coff_base_type (bfd *abfd, struct coff_symbols *
break;
case T_UINT:
- ret = debug_make_int_type (dhandle, 4, TRUE);
+ ret = debug_make_int_type (dhandle, types->intsize, TRUE);
name = "unsigned int";
break;
@@ -565,6 +568,8 @@ parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct
case C_WEAKEXT:
case C_EXT:
+ /* AVR COFF abuses C_EXTDEF */
+ case C_EXTDEF:
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
DEBUG_GLOBAL, bfd_asymbol_value (sym)))
return FALSE;
@@ -580,9 +585,9 @@ parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct
break;
case C_REG:
- /* FIXME: We may need to convert the register number. */
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
- DEBUG_REGISTER, bfd_asymbol_value (sym)))
+ DEBUG_REGISTER,
+ coff_convert_register (abfd, bfd_asymbol_value (sym))))
return FALSE;
break;
@@ -596,9 +601,9 @@ parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct
break;
case C_REGPARM:
- /* FIXME: We may need to convert the register number. */
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
- DEBUG_PARM_REG, bfd_asymbol_value (sym)))
+ DEBUG_PARM_REG,
+ coff_convert_register (abfd, bfd_asymbol_value (sym))))
return FALSE;
break;
@@ -648,6 +653,28 @@ external_coff_symbol_p (int sym_class)
return FALSE;
}
+static bfd_vma
+coff_convert_register (abfd, val)
+ bfd *abfd;
+ bfd_vma val;
+{
+
+ switch (bfd_get_arch (abfd))
+ {
+ case bfd_arch_avr:
+ /* AVR COFF wants to describe up to four registers by the four
+ bytes of the 32-bit value. Unused bytes are filled with
+ 0xff. In theory, this would allow for non-contiguous
+ register usage to hold a single value, but hopefully, no
+ compiler is going to use that feature. We could not handle
+ it anyway. */
+ return val & 0xff;
+
+ default:
+ return val;
+ }
+}
+
/* This is the main routine. It looks through all the symbols and
handles them. */
@@ -674,7 +701,18 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount,
types.slots = NULL;
for (i = 0; i <= T_MAX; i++)
types.basic[i] = DEBUG_TYPE_NULL;
+ switch (bfd_get_arch (abfd))
+ {
+ case bfd_arch_avr:
+ types.intsize = 2;
+ types.doublesize = 4;
+ break;
+ default:
+ types.intsize = 4;
+ types.doublesize = 8;
+ }
+
next_c_file = -1;
fnname = NULL;
fnclass = 0;
@@ -734,7 +772,6 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount,
switch (syment.n_sclass)
{
case C_EFCN:
- case C_EXTDEF:
case C_ULABEL:
case C_USTATIC:
case C_LINE:
@@ -757,6 +794,8 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount,
/* Fall through. */
case C_WEAKEXT:
case C_EXT:
+ /* AVR COFF abuses C_EXTDEF for C_EXT */
+ case C_EXTDEF:
if (ISFCN (syment.n_type))
{
fnname = name;

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
$OpenBSD: patch-etc_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- etc/Makefile.in.orig Sat Jun 25 09:33:45 2005
+++ etc/Makefile.in Sat Jun 25 09:34:45 2005
@@ -54,7 +54,7 @@ DVIFILES = standards.dvi configure.dvi
all:
$OpenBSD: patch-etc_Makefile_in,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
--- etc/Makefile.in.orig Tue Mar 27 11:09:32 2007
+++ etc/Makefile.in Sat Sep 27 20:20:27 2008
@@ -64,7 +64,8 @@ PDFFILES = standards.pdf configure.pdf
HTMLFILES = standards.html configure.html
# We want install to imply install-info as per GNU standards.
all: info
-install: install-info
+#install: install-info
+install:
uninstall:

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-gas_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- gas/Makefile.in.orig Sat Jun 25 09:41:13 2005
+++ gas/Makefile.in Sat Jun 25 09:41:37 2005
@@ -243,7 +243,7 @@ target_os = @target_os@
target_vendor = @target_vendor@
te_file = @te_file@
AUTOMAKE_OPTIONS = 1.8 cygnus dejagnu
-SUBDIRS = doc po
+SUBDIRS = doc
# Automake should figure this out on its own. It doesn't, because
# of the "cygnus" option. But distclean still wants it.
DIST_SUBDIRS = $(SUBDIRS)

View File

@ -0,0 +1,195 @@
$OpenBSD: patch-gas_config_tc-avr_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- gas/config/tc-avr.c.orig Mon Aug 6 12:59:55 2007
+++ gas/config/tc-avr.c Sat Sep 27 20:20:27 2008
@@ -27,20 +27,21 @@
struct avr_opcodes_s
{
- char * name;
- char * constraints;
- int insn_size; /* In words. */
- int isa;
+ char *name;
+ char *constraints;
+ char *opcode;
+ int insn_size; /* In words. */
+ int isa;
unsigned int bin_opcode;
};
#define AVR_INSN(NAME, CONSTR, OPCODE, SIZE, ISA, BIN) \
-{#NAME, CONSTR, SIZE, ISA, BIN},
+{#NAME, CONSTR, OPCODE, SIZE, ISA, BIN},
struct avr_opcodes_s avr_opcodes[] =
{
#include "opcode/avr.h"
- {NULL, NULL, 0, 0, 0}
+ {NULL, NULL, NULL, 0, 0, 0}
};
const char comment_chars[] = ";";
@@ -63,10 +64,20 @@ static struct mcu_type_s mcu_types[] =
{
{"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},
- {"avr6", AVR_ISA_ALL, bfd_mach_avr6},
+ {"avr5", AVR_ISA_M323, bfd_mach_avr5},
+ {"avr51", AVR_ISA_M128, bfd_mach_avr5},
+ {"avr6", AVR_ISA_M256, bfd_mach_avr6},
+ {"avrxmega1", AVR_ISA_XMEGA, bfd_mach_avrxmega1},
+ {"avrxmega2", AVR_ISA_XMEGA, bfd_mach_avrxmega2},
+ {"avrxmega3", AVR_ISA_XMEGA, bfd_mach_avrxmega3},
+ {"avrxmega4", AVR_ISA_XMEGA, bfd_mach_avrxmega4},
+ {"avrxmega5", AVR_ISA_XMEGA, bfd_mach_avrxmega5},
+ {"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},
@@ -85,7 +96,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 +108,32 @@ static struct mcu_type_s mcu_types[] =
{"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 +142,7 @@ static struct mcu_type_s mcu_types[] =
{"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 +150,14 @@ static struct mcu_type_s mcu_types[] =
{"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 +166,7 @@ static struct mcu_type_s mcu_types[] =
{"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,15 +175,20 @@ static struct mcu_type_s mcu_types[] =
{"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},
{"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},
{NULL, 0, 0}
};
@@ -645,7 +675,9 @@ avr_ldi_expression (expressionS *exp)
break;
default:
- as_warn (_("expression dangerous with linker stubs"));
+ /* PR 5523: Do not generate a warning here,
+ legitimate code can trigger this case. */
+ break;
}
}
return reloc_to_return;
@@ -790,7 +822,12 @@ avr_operand (struct avr_opcodes_s *opcode,
if (*str == '+')
{
++str;
- op_mask |= 1;
+ char *s;
+ for (s = opcode->opcode; *s; ++s)
+ {
+ if (*s == '+')
+ op_mask |= (1 << (15 - (s - opcode->opcode)));
+ }
}
break;
@@ -901,6 +938,16 @@ avr_operand (struct avr_opcodes_s *opcode,
}
break;
+ case 'E':
+ {
+ unsigned int x;
+
+ x = avr_get_constant (str, 15);
+ str = input_line_pointer;
+ op_mask |= (x << 4);
+ }
+ break;
+
case '?':
break;

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-gas_doc_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- gas/doc/Makefile.in.orig Sat Jun 25 09:36:03 2005
+++ gas/doc/Makefile.in Sat Jun 25 09:36:58 2005
@@ -51,7 +51,7 @@ depcomp =
am__depfiles_maybe =
SOURCES =
DIST_SOURCES =
-INFO_DEPS = $(srcdir)/as.info
+INFO_DEPS =
TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
am__TEXINFO_TEX_DIR = $(top_srcdir)/../texinfo
DVIS = as.dvi

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-gas_doc_c-avr_texi,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- gas/doc/c-avr.texi.orig Mon Aug 6 13:00:08 2007
+++ gas/doc/c-avr.texi Sat Sep 27 20:20:27 2008
@@ -41,24 +41,26 @@ Instruction set avr2 (default) is for the classic AVR
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).
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

View File

@ -0,0 +1,114 @@
$OpenBSD: patch-include_coff_avr_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- include/coff/avr.h.orig Sat Sep 27 20:20:27 2008
+++ include/coff/avr.h Sat Sep 27 20:20:27 2008
@@ -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

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-include_coff_internal_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- include/coff/internal.h.orig Mon Aug 6 12:59:46 2007
+++ include/coff/internal.h Sat Sep 27 20:20:27 2008
@@ -630,6 +630,8 @@ union internal_auxent
};
+#define NAUXENTS 10 /* number of pre-allocated aux entries */
+
/********************** RELOCATION DIRECTIVES **********************/
struct internal_reloc

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-include_elf_avr_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- include/elf/avr.h.orig Wed May 24 00:36:11 2006
+++ include/elf/avr.h Sat Sep 27 20:20:27 2008
@@ -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)

View File

@ -0,0 +1,61 @@
$OpenBSD: patch-include_opcode_avr_h,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- include/opcode/avr.h.orig Fri Apr 7 08:18:08 2006
+++ include/opcode/avr.h Sat Sep 27 20:20:28 2008
@@ -30,21 +30,31 @@
#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)
#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)
#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
@@ -90,6 +100,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,
@@ -150,7 +161,8 @@ AVR_INSN (reti, "", "1001010100011000", 1, AVR_ISA_
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)
@@ -263,4 +275,7 @@ AVR_INSN (st, "e,r", "100!001rrrrree-+", 1, AVR_ISA_
(>128K program memory, PC = EIND:Z). */
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)

View File

@ -0,0 +1,52 @@
$OpenBSD: patch-ld_Makefile_am,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/Makefile.am.orig Mon Aug 6 13:00:17 2007
+++ ld/Makefile.am Sat Sep 27 20:20:28 2008
@@ -138,6 +138,13 @@ ALL_EMULATIONS = \
eavr4.o \
eavr5.o \
eavr6.o \
+ eavrxmega1.o \
+ eavrxmega2.o \
+ eavrxmega3.o \
+ eavrxmega4.o \
+ eavrxmega5.o \
+ eavrxmega6.o \
+ eavrxmega7.o \
ecoff_i860.o \
ecoff_sparc.o \
eelf32_spu.o \
@@ -622,6 +629,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $(srcdir)/emulte
$(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
${GENSCRIPTS} avr6 "$(tdir_avr2)"
+eavrxmega1.c: $(srcdir)/emulparams/avrxmega1.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega1 "$(tdir_avr2)"
+eavrxmega2.c: $(srcdir)/emulparams/avrxmega2.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega2 "$(tdir_avr2)"
+eavrxmega3.c: $(srcdir)/emulparams/avrxmega3.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega3 "$(tdir_avr2)"
+eavrxmega4.c: $(srcdir)/emulparams/avrxmega4.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega4 "$(tdir_avr2)"
+eavrxmega5.c: $(srcdir)/emulparams/avrxmega5.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega5 "$(tdir_avr2)"
+eavrxmega6.c: $(srcdir)/emulparams/avrxmega6.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega6 "$(tdir_avr2)"
+eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega7 "$(tdir_avr2)"
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)"

View File

@ -1,21 +1,52 @@
$OpenBSD: patch-ld_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- ld/Makefile.in.orig Sat Jun 25 09:38:16 2005
+++ ld/Makefile.in Sat Jun 25 09:38:44 2005
@@ -114,7 +114,7 @@ INTLLIBS = @INTLLIBS@
AUTOMAKE_OPTIONS = cygnus dejagnu
-SUBDIRS = po
+SUBDIRS =
tooldir = $(exec_prefix)/$(target_alias)
@@ -588,7 +588,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
TEXI2DVI = `if test -f $(top_srcdir)/../texinfo/util/texi2dvi; then echo $(top_srcdir)/../texinfo/util/texi2dvi; else echo texi2dvi; fi`
TEXINFO_TEX = $(top_srcdir)/../texinfo/texinfo.tex
-INFO_DEPS = ld.info
+INFO_DEPS =
DVIS = ld.dvi
TEXINFOS = ld.texinfo
man1dir = $(mandir)/man1
$OpenBSD: patch-ld_Makefile_in,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
--- ld/Makefile.in.orig Mon Aug 6 13:29:54 2007
+++ ld/Makefile.in Sat Sep 27 20:20:28 2008
@@ -385,6 +385,13 @@ ALL_EMULATIONS = \
eavr4.o \
eavr5.o \
eavr6.o \
+ eavrxmega1.o \
+ eavrxmega2.o \
+ eavrxmega3.o \
+ eavrxmega4.o \
+ eavrxmega5.o \
+ eavrxmega6.o \
+ eavrxmega7.o \
ecoff_i860.o \
ecoff_sparc.o \
eelf32_spu.o \
@@ -1448,6 +1455,34 @@ eavr6.c: $(srcdir)/emulparams/avr6.sh $(srcdir)/emulte
$(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
${GENSCRIPTS} avr6 "$(tdir_avr2)"
+eavrxmega1.c: $(srcdir)/emulparams/avrxmega1.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega1 "$(tdir_avr2)"
+eavrxmega2.c: $(srcdir)/emulparams/avrxmega2.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega2 "$(tdir_avr2)"
+eavrxmega3.c: $(srcdir)/emulparams/avrxmega3.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega3 "$(tdir_avr2)"
+eavrxmega4.c: $(srcdir)/emulparams/avrxmega4.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega4 "$(tdir_avr2)"
+eavrxmega5.c: $(srcdir)/emulparams/avrxmega5.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega5 "$(tdir_avr2)"
+eavrxmega6.c: $(srcdir)/emulparams/avrxmega6.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega6 "$(tdir_avr2)"
+eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
+ ${GEN_DEPENDS}
+ ${GENSCRIPTS} avrxmega7 "$(tdir_avr2)"
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i860coff.sc ${GEN_DEPENDS}
${GENSCRIPTS} coff_i860 "$(tdir_coff_i860)"

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-ld_configure_tgt,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/configure.tgt.orig Tue Aug 28 10:19:42 2007
+++ ld/configure.tgt Sat Sep 27 20:20:28 2008
@@ -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"

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-ld_emulparams_avr1_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr1.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr1.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-ld_emulparams_avr2_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr2.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr2.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-ld_emulparams_avr3_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr3.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr3.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=128K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-ld_emulparams_avr4_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr4.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr4.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=8K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-ld_emulparams_avr5_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr5.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr5.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=128K
+DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-ld_emulparams_avr6_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avr6.sh.orig Wed May 24 00:36:11 2006
+++ ld/emulparams/avr6.sh Sat Sep 27 20:20:28 2008
@@ -7,5 +7,6 @@ EMBEDDED=yes
TEMPLATE_NAME=elf32
TEXT_LENGTH=1024K
-DATA_LENGTH=0xffa0
+DATA_ORIGIN=0x800200
+DATA_LENGTH=0xfe00
EXTRA_EM_FILE=avrelf

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega1_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega1.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega1.sh Sat Sep 27 20:20:28 2008
@@ -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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega2_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega2.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega2.sh Sat Sep 27 20:20:28 2008
@@ -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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega3_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega3.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega3.sh Sat Sep 27 20:20:28 2008
@@ -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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega4_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega4.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega4.sh Sat Sep 27 20:20:28 2008
@@ -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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega5_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega5.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega5.sh Sat Sep 27 20:20:28 2008
@@ -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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega6_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega6.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega6.sh Sat Sep 27 20:20:28 2008
@@ -0,0 +1,12 @@
+ARCH=avr:106
+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

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-ld_emulparams_avrxmega7_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emulparams/avrxmega7.sh.orig Sat Sep 27 20:20:28 2008
+++ ld/emulparams/avrxmega7.sh Sat Sep 27 20:20:28 2008
@@ -0,0 +1,12 @@
+ARCH=avr:107
+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

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-ld_emultempl_avrelf_em,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/emultempl/avrelf.em.orig Mon Aug 6 13:00:21 2007
+++ ld/emultempl/avrelf.em Sat Sep 27 20:20:28 2008
@@ -71,8 +71,15 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
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. */
+ 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 ();

View File

@ -0,0 +1,50 @@
$OpenBSD: patch-ld_genscripts_sh,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/genscripts.sh.orig Sun Aug 12 12:00:07 2007
+++ ld/genscripts.sh Sat Sep 27 20:20:28 2008
@@ -390,30 +390,30 @@ case " $EMULATION_LIBPATH " in
*" ${EMULATION_NAME} "*) COMPILE_IN=true;;
esac
-if test -n "${BASH+set}"; then
+#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()
{
- 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
}
fragment()
{
cat >> e${EMULATION_NAME}.c
}
-fi
+#fi
# Generate e${EMULATION_NAME}.c.
# Start with an empty file, then the sourced .em script

View File

@ -0,0 +1,44 @@
$OpenBSD: patch-ld_scripttempl_avr_sc,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- ld/scripttempl/avr.sc.orig Wed May 24 00:36:12 2006
+++ ld/scripttempl/avr.sc Sat Sep 27 20:20:28 2008
@@ -4,9 +4,12 @@ OUTPUT_ARCH(${ARCH})
MEMORY
{
- text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
- data (rw!x) : ORIGIN = 0x800060, LENGTH = $DATA_LENGTH
- eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+ text (rx) : ORIGIN = 0, LENGTH = $TEXT_LENGTH
+ data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+ fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
+ lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
+ signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
}
SECTIONS
@@ -195,6 +198,24 @@ SECTIONS
*(.eeprom*)
${RELOCATING+ __eeprom_end = . ; }
} ${RELOCATING+ > eeprom}
+
+ .fuse ${RELOCATING-0}:
+ {
+ KEEP(*(.fuse))
+ KEEP(*(.lfuse))
+ KEEP(*(.hfuse))
+ KEEP(*(.efuse))
+ } ${RELOCATING+ > fuse}
+
+ .lock ${RELOCATING-0}:
+ {
+ KEEP(*(.lock*))
+ } ${RELOCATING+ > lock}
+
+ .signature ${RELOCATING-0}:
+ {
+ KEEP(*(.signature*))
+ } ${RELOCATING+ > signature}
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }

View File

@ -1,12 +1,13 @@
$OpenBSD: patch-libiberty_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- libiberty/Makefile.in.orig Sat Jun 25 09:29:23 2005
+++ libiberty/Makefile.in Sat Jun 25 09:29:55 2005
@@ -266,7 +266,7 @@ libiberty.html : $(srcdir)/libiberty.tex
$OpenBSD: patch-libiberty_Makefile_in,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
--- libiberty/Makefile.in.orig Mon Aug 6 12:59:45 2007
+++ libiberty/Makefile.in Sat Sep 27 20:20:28 2008
@@ -344,7 +344,8 @@ libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
@MAINT@ echo stamp > stamp-functions
INSTALL_DEST = @INSTALL_DEST@
-install: install_to_$(INSTALL_DEST) install-subdir
+#install: install_to_$(INSTALL_DEST) install-subdir
+install:
install_to_libdir: all
${mkinstalldirs} $(DESTDIR)$(libdir)$(MULTISUBDIR)
# This is tricky. Even though CC in the Makefile contains
# multilib-specific flags, it's overridden by FLAGS_TO_PASS from the

View File

@ -1,12 +1,13 @@
$OpenBSD: patch-opcodes_Makefile_in,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
--- opcodes/Makefile.in.orig Sat Jun 25 09:32:09 2005
+++ opcodes/Makefile.in Sat Jun 25 09:32:40 2005
@@ -754,7 +754,7 @@ install-data: install-data-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
$OpenBSD: patch-opcodes_Makefile_in,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
--- opcodes/Makefile.in.orig Mon Aug 6 13:21:34 2007
+++ opcodes/Makefile.in Sat Sep 27 20:20:28 2008
@@ -876,7 +876,8 @@ installdirs-am:
for dir in "$(DESTDIR)$(bfdlibdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
-install: install-recursive
+#install: install-recursive
+install:
uninstall-am: uninstall-bfdlibLTLIBRARIES
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) config.h

View File

@ -0,0 +1,74 @@
$OpenBSD: patch-opcodes_avr-dis_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
--- opcodes/avr-dis.c.orig Mon Aug 6 12:58:38 2007
+++ opcodes/avr-dis.c Sat Sep 27 20:20:28 2008
@@ -50,7 +50,7 @@ static const char * comment_start = "0x";
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 int insn2, un
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 int insn2, un
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, disassemble_info *info)
if (opcode->name)
{
- char *op = opcode->constraints;
+ char *constraints = opcode->constraints;
+ char *opcode_str = opcode->opcode;
insn2 = 0;
ok = 1;
@@ -342,14 +357,14 @@ print_insn_avr (bfd_vma addr, disassemble_info *info)
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);
}
}

View File

@ -1,12 +1,14 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2005/09/20 15:22:43 aanriot Exp $
@comment $OpenBSD: PLIST,v 1.2 2008/10/01 04:46:20 ckuethe Exp $
avr/
avr/bin/
avr/bin/ar
avr/bin/as
avr/bin/ld
avr/bin/nm
avr/bin/ranlib
avr/bin/strip
@bin avr/bin/ar
@bin avr/bin/as
@bin avr/bin/ld
@bin avr/bin/nm
@bin avr/bin/objcopy
@bin avr/bin/objdump
@bin avr/bin/ranlib
@bin avr/bin/strip
avr/lib/
avr/lib/ldscripts/
avr/lib/ldscripts/avr1.x
@ -34,24 +36,70 @@ avr/lib/ldscripts/avr5.xbn
avr/lib/ldscripts/avr5.xn
avr/lib/ldscripts/avr5.xr
avr/lib/ldscripts/avr5.xu
bin/avr-addr2line
bin/avr-ar
bin/avr-as
bin/avr-c++filt
bin/avr-ld
bin/avr-nm
bin/avr-objcopy
bin/avr-objdump
bin/avr-ranlib
bin/avr-readelf
bin/avr-size
bin/avr-strings
bin/avr-strip
avr/lib/ldscripts/avr6.x
avr/lib/ldscripts/avr6.xbn
avr/lib/ldscripts/avr6.xn
avr/lib/ldscripts/avr6.xr
avr/lib/ldscripts/avr6.xu
avr/lib/ldscripts/avrxmega1.x
avr/lib/ldscripts/avrxmega1.xbn
avr/lib/ldscripts/avrxmega1.xn
avr/lib/ldscripts/avrxmega1.xr
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.xu
avr/lib/ldscripts/avrxmega3.x
avr/lib/ldscripts/avrxmega3.xbn
avr/lib/ldscripts/avrxmega3.xn
avr/lib/ldscripts/avrxmega3.xr
avr/lib/ldscripts/avrxmega3.xu
avr/lib/ldscripts/avrxmega4.x
avr/lib/ldscripts/avrxmega4.xbn
avr/lib/ldscripts/avrxmega4.xn
avr/lib/ldscripts/avrxmega4.xr
avr/lib/ldscripts/avrxmega4.xu
avr/lib/ldscripts/avrxmega5.x
avr/lib/ldscripts/avrxmega5.xbn
avr/lib/ldscripts/avrxmega5.xn
avr/lib/ldscripts/avrxmega5.xr
avr/lib/ldscripts/avrxmega5.xu
avr/lib/ldscripts/avrxmega6.x
avr/lib/ldscripts/avrxmega6.xbn
avr/lib/ldscripts/avrxmega6.xn
avr/lib/ldscripts/avrxmega6.xr
avr/lib/ldscripts/avrxmega6.xu
avr/lib/ldscripts/avrxmega7.x
avr/lib/ldscripts/avrxmega7.xbn
avr/lib/ldscripts/avrxmega7.xn
avr/lib/ldscripts/avrxmega7.xr
avr/lib/ldscripts/avrxmega7.xu
@bin bin/avr-addr2line
@bin bin/avr-ar
@bin bin/avr-as
@bin bin/avr-c++filt
@bin bin/avr-gprof
@bin bin/avr-ld
@bin bin/avr-nm
@bin bin/avr-objcopy
@bin bin/avr-objdump
@bin bin/avr-ranlib
@bin bin/avr-readelf
@bin bin/avr-size
@bin bin/avr-strings
@bin bin/avr-strip
@info info/as.info
@info info/binutils.info
@info info/gprof.info
@info info/ld.info
@man man/man1/avr-addr2line.1
@man man/man1/avr-ar.1
@man man/man1/avr-as.1
@man man/man1/avr-c++filt.1
@man man/man1/avr-dlltool.1
@man man/man1/avr-gprof.1
@man man/man1/avr-ld.1
@man man/man1/avr-nlmconv.1
@man man/man1/avr-nm.1
@ -62,4 +110,5 @@ bin/avr-strip
@man man/man1/avr-size.1
@man man/man1/avr-strings.1
@man man/man1/avr-strip.1
@man man/man1/avr-windmc.1
@man man/man1/avr-windres.1