2010-03-15 Thomas Schwinge <thomas@codesourcery.com>
[binutils-gdb.git] / gas / config / tc-avr.c
index eae21024c917aa4e9a589dc6d076cdbf6f14b60f..a8840683ca8fd11a5e47ff9962dbde12223a9856 100644 (file)
@@ -1,7 +1,7 @@
 /* tc-avr.c -- Assembler code for the ATMEL AVR
 
-   Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008
-   Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009,
+   2010  Free Software Foundation, Inc.
    Contributed by Denis Chertykov <denisc@overta.ru>
 
    This file is part of GAS, the GNU Assembler.
@@ -99,15 +99,21 @@ static struct mcu_type_s mcu_types[] =
   {"attiny13",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny13a",  AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny2313", AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny2313a",AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny24",   AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny24a",  AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny4313", AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny44",   AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny44a",  AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny84",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny25",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny45",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny85",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny261",  AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny261a", AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny461",  AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny861",  AVR_ISA_AVR25,   bfd_mach_avr25},
+  {"attiny861a", AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny87",   AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny43u",  AVR_ISA_AVR25,   bfd_mach_avr25},
   {"attiny48",   AVR_ISA_AVR25,   bfd_mach_avr25},
@@ -122,6 +128,9 @@ static struct mcu_type_s mcu_types[] =
   {"attiny327",  AVR_ISA_AVR35,   bfd_mach_avr35},
   {"at90usb82",  AVR_ISA_AVR35,   bfd_mach_avr35},
   {"at90usb162", AVR_ISA_AVR35,   bfd_mach_avr35},
+  {"atmega8u2",  AVR_ISA_AVR35,   bfd_mach_avr35},
+  {"atmega16u2", AVR_ISA_AVR35,   bfd_mach_avr35},
+  {"atmega32u2", AVR_ISA_AVR35,   bfd_mach_avr35},
   {"atmega8",    AVR_ISA_M8,      bfd_mach_avr4},
   {"atmega48",   AVR_ISA_AVR4,    bfd_mach_avr4},
   {"atmega48p",  AVR_ISA_AVR4,    bfd_mach_avr4},
@@ -132,6 +141,8 @@ static struct mcu_type_s mcu_types[] =
   {"atmega8hva", AVR_ISA_AVR4,    bfd_mach_avr4},
   {"atmega4hvd", AVR_ISA_AVR4,    bfd_mach_avr4},
   {"atmega8hvd", AVR_ISA_AVR4,    bfd_mach_avr4},
+  {"atmega8c1",  AVR_ISA_AVR4,    bfd_mach_avr4},
+  {"atmega8m1",  AVR_ISA_AVR4,    bfd_mach_avr4},
   {"at90pwm1",   AVR_ISA_AVR4,    bfd_mach_avr4},
   {"at90pwm2",   AVR_ISA_AVR4,    bfd_mach_avr4},
   {"at90pwm2b",  AVR_ISA_AVR4,    bfd_mach_avr4},
@@ -149,6 +160,7 @@ static struct mcu_type_s mcu_types[] =
   {"atmega168p", AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega169",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega169p", AVR_ISA_AVR5,    bfd_mach_avr5},
+  {"atmega16c1", AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega32",   AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega323",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega324p", AVR_ISA_AVR5,    bfd_mach_avr5},
@@ -166,6 +178,7 @@ static struct mcu_type_s mcu_types[] =
   {"atmega640",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega644",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega644p", AVR_ISA_AVR5,    bfd_mach_avr5},
+  {"atmega644pa",AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega645",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega649",  AVR_ISA_AVR5,    bfd_mach_avr5},
   {"atmega6450", AVR_ISA_AVR5,    bfd_mach_avr5},
@@ -1140,6 +1153,13 @@ md_apply_fix (fixS *fixP, valueT * valP, segT seg)
          bfd_putl16 ((bfd_vma) value, where);
          break;
 
+       case BFD_RELOC_8:
+          if (value > 255 || value < -128)
+           as_warn_where (fixP->fx_file, fixP->fx_line,
+                           _("operand out of range: %ld"), value);
+          *where = value;
+         break;
+
        case BFD_RELOC_AVR_16_PM:
          bfd_putl16 ((bfd_vma) (value >> 1), where);
          break;
@@ -1353,6 +1373,8 @@ md_assemble (char *str)
   if (!avr_opt.all_opcodes && (opcode->isa & avr_mcu->isa) != opcode->isa)
     as_bad (_("illegal opcode %s for mcu %s"), opcode->name, avr_mcu->name);
 
+  dwarf2_emit_insn (0);
+
   /* We used to set input_line_pointer to the result of get_operands,
      but that is wrong.  Our caller assumes we don't change it.  */
   {
@@ -1427,7 +1449,9 @@ avr_cons_fix_new (fragS *frag,
 {
   if (exp_mod_pm == 0)
     {
-      if (nbytes == 2)
+      if (nbytes == 1)
+       fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_8);
+      else if (nbytes == 2)
        fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_16);
       else if (nbytes == 4)
        fix_new_exp (frag, where, nbytes, exp, FALSE, BFD_RELOC_32);