diff -ur binutils-2.18.orig/bfd/elf32-avr.c binutils-2.18/bfd/elf32-avr.c --- binutils-2.18.orig/bfd/elf32-avr.c 2007-08-06 23:59:24.000000000 +0400 +++ binutils-2.18/bfd/elf32-avr.c 2010-02-16 21:54:40.000000000 +0300 @@ -501,7 +501,21 @@ FALSE, /* partial_inplace */ 0xffff, /* src_mask */ 0xffff, /* dst_mask */ - FALSE) /* pcrel_offset */ + FALSE), /* pcrel_offset */ + /* 8 bit offset */ + HOWTO (R_AVR_8, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long) */ + 8, /* bitsize */ + FALSE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_bitfield,/* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_AVR_8", /* name */ + FALSE, /* partial_inplace */ + 0x000000ff, /* src_mask */ + 0x000000ff, /* dst_mask */ + FALSE), /* pcrel_offset */ }; /* Map BFD reloc types to AVR ELF reloc types. */ @@ -539,7 +553,8 @@ { BFD_RELOC_AVR_CALL, R_AVR_CALL }, { BFD_RELOC_AVR_LDI, R_AVR_LDI }, { BFD_RELOC_AVR_6, R_AVR_6 }, - { BFD_RELOC_AVR_6_ADIW, R_AVR_6_ADIW } + { BFD_RELOC_AVR_6_ADIW, R_AVR_6_ADIW }, + { BFD_RELOC_8, R_AVR_8 } }; /* Meant to be filled one day with the wrap around address for the diff -ur binutils-2.18.orig/gas/config/tc-avr.c binutils-2.18/gas/config/tc-avr.c --- binutils-2.18.orig/gas/config/tc-avr.c 2010-02-16 21:19:16.000000000 +0300 +++ binutils-2.18/gas/config/tc-avr.c 2010-02-16 21:17:43.000000000 +0300 @@ -1131,6 +1131,13 @@ 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; @@ -1418,7 +1425,9 @@ { 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); diff -ur binutils-2.18.orig/include/elf/avr.h binutils-2.18/include/elf/avr.h --- binutils-2.18.orig/include/elf/avr.h 2006-05-24 11:36:11.000000000 +0400 +++ binutils-2.18/include/elf/avr.h 2010-02-16 21:28:28.000000000 +0300 @@ -65,6 +65,7 @@ RELOC_NUMBER (R_AVR_MS8_LDI_NEG, 23) RELOC_NUMBER (R_AVR_LO8_LDI_GS, 24) RELOC_NUMBER (R_AVR_HI8_LDI_GS, 25) + RELOC_NUMBER (R_AVR_8, 26) END_RELOC_NUMBERS (R_AVR_max) #endif /* _ELF_AVR_H */