PR 11297: Add support for 8-bit relocations to the AVR toolchain.

This commit is contained in:
Nick Clifton
2010-02-23 11:38:36 +00:00
parent 1c063135aa
commit 17e5723725
6 changed files with 57 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2010-02-23 Andrew Zabolotny <anpaza@mail.ru>
PR binutils/11297
* elf32-avr.c (elf_avr_howto_table): Add R_AVR_8.
(avr_reloc_map): Map BFD_RELOC_8 to R_AVR_8.
2010-02-22 Alan Modra <amodra@gmail.com>
* reloc.c (bfd_check_overflow): When forming addrmask, shift

View File

@ -473,7 +473,7 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A low 8 bit absolute relocation of 24 bit program memory address.
For LDI command. Will be changed when linker stubs are needed. */
For LDI command. Will be changed when linker stubs are needed. */
HOWTO (R_AVR_LO8_LDI_GS, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@ -488,7 +488,7 @@ static reloc_howto_type elf_avr_howto_table[] =
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A low 8 bit absolute relocation of 24 bit program memory address.
For LDI command. Will be changed when linker stubs are needed. */
For LDI command. Will be changed when linker stubs are needed. */
HOWTO (R_AVR_HI8_LDI_GS, /* type */
9, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
@ -501,7 +501,21 @@ static reloc_howto_type elf_avr_howto_table[] =
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 @@ static const struct avr_reloc_map avr_reloc_map[] =
{ 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

View File

@ -1,3 +1,9 @@
2010-02-23 Andrew Zabolotny <anpaza@mail.ru>
PR binutils/11297
* config/tc-avr.c (md_apply_fix): Handle BFD_RELOC_8.
(avr_cons_fix_new): Handle fixups of a single byte.
2010-02-22 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
PR 9861

View File

@ -1,7 +1,7 @@
/* tc-avr.c -- Assembler code for the ATMEL AVR
Copyright 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009
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.
@ -1153,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;
@ -1442,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);

View File

@ -1,3 +1,8 @@
2010-02-23 Andrew Zabolotny <anpaza@mail.ru>
PR binutils/11297
* avr.h: (R_AVR_8): New relocation number.
2010-02-18 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* arm.h (Tag_MPextension_use): Renumber.
@ -14,7 +19,7 @@
* common.h (NT_386_XSTATE): New.
2010-01-21 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* s390.h (EF_S390_HIGH_GPRS): Added macro definition.
2010-01-19 Daisuke Hatayama <d.hatayama@jp.fujitsu.com>
@ -78,11 +83,11 @@
R_push, R_const, R_add, R_sub, R_mult, R_div, R_mod, R_lshift,
R_rshift, R_and, R_or, R_xor, R_land, R_lor, R_len, R_neg, R_comp,
R_page, R_hwpage, R_addr, R_pltpc, R_got.
2009-08-09 Michael Eager <eager@eagercon.com>
* elf/common.h: Define EM_resnnn reserved values. Add EM_AVR32,
EM_STM8, EM_TILE64, EM_TILEPRO. Change EM_MICROBLAZE.
EM_STM8, EM_TILE64, EM_TILEPRO. Change EM_MICROBLAZE.
2009-08-06 Michael Eager <eager@eagercon.com>
@ -188,8 +193,8 @@
2009-03-14 Mark Kettenis <kettenis@gnu.org>
* common.h (NT_OPENBSD_PROCINFO, NT_OPENBSD_AUXV)
(NT_OPENBSD_REGS, NT_OPENBSD_FPREGS, NT_OPENBSD_XFPREGS)
* common.h (NT_OPENBSD_PROCINFO, NT_OPENBSD_AUXV)
(NT_OPENBSD_REGS, NT_OPENBSD_FPREGS, NT_OPENBSD_XFPREGS)
(NT_OPENBSD_WCOOKIE): New defines.
2009-03-16 Jan Kratochvil <jan.kratochvil@redhat.com>
@ -272,7 +277,7 @@
2008-11-14 Nathan Sidwell <nathan@codesourcery.com>
* internal.h (struct elf_segment_map): Add header_size field.
2008-10-13 Ulrich Weigand <uweigand@de.ibm.com>
* common.h (AT_BASE_PLATFORM, AT_EXECFN): Define.
@ -346,7 +351,7 @@
END_RELOC_NUMBERS symbol as a sentinel value.
2008-05-15 Christophe Lyon <christophe.lyon@st.com>
* arm.h (END_RELOC_NUMBERS): Provide a maximum value.
2008-04-16 David S. Miller <davem@davemloft.net>

View File

@ -1,5 +1,5 @@
/* AVR ELF support for BFD.
Copyright 1999, 2000, 2004, 2006 Free Software Foundation, Inc.
Copyright 1999, 2000, 2004, 2006, 2010 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
@ -69,6 +69,7 @@ START_RELOC_NUMBERS (elf_avr_reloc_type)
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 */