diff options
Diffstat (limited to 'bfd/elf32-avr.c')
-rw-r--r-- | bfd/elf32-avr.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 1bc40c4403a..6d20aefdc21 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1,6 +1,6 @@ /* AVR-specific support for 32-bit ELF Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 Free Software Foundation, Inc. + 2010, 2011 Free Software Foundation, Inc. Contributed by Denis Chertykov <denisc@overta.ru> This file is part of BFD, the Binary File Descriptor library. @@ -2008,10 +2008,10 @@ elf32_avr_relax_section (bfd *abfd, if ((0x95 == next_insn_msb) && (0x08 == next_insn_lsb)) { /* The next insn is a ret. We possibly could delete - this ret. First we need to check for preceeding + this ret. First we need to check for preceding sbis/sbic/sbrs or cpse "skip" instructions. */ - int there_is_preceeding_non_skip_insn = 1; + int there_is_preceding_non_skip_insn = 1; bfd_vma address_of_ret; address_of_ret = dot + insn_size; @@ -2023,51 +2023,52 @@ elf32_avr_relax_section (bfd *abfd, printf ("found jmp / ret sequence at address 0x%x\n", (int) dot); - /* We have to make sure that there is a preceeding insn. */ + /* We have to make sure that there is a preceding insn. */ if (irel->r_offset >= 2) { - unsigned char preceeding_msb; - unsigned char preceeding_lsb; - preceeding_msb = + unsigned char preceding_msb; + unsigned char preceding_lsb; + + preceding_msb = bfd_get_8 (abfd, contents + irel->r_offset - 1); - preceeding_lsb = + preceding_lsb = bfd_get_8 (abfd, contents + irel->r_offset - 2); /* sbic. */ - if (0x99 == preceeding_msb) - there_is_preceeding_non_skip_insn = 0; + if (0x99 == preceding_msb) + there_is_preceding_non_skip_insn = 0; /* sbis. */ - if (0x9b == preceeding_msb) - there_is_preceeding_non_skip_insn = 0; + if (0x9b == preceding_msb) + there_is_preceding_non_skip_insn = 0; /* sbrc */ - if ((0xfc == (preceeding_msb & 0xfe) - && (0x00 == (preceeding_lsb & 0x08)))) - there_is_preceeding_non_skip_insn = 0; + if ((0xfc == (preceding_msb & 0xfe) + && (0x00 == (preceding_lsb & 0x08)))) + there_is_preceding_non_skip_insn = 0; /* sbrs */ - if ((0xfe == (preceeding_msb & 0xfe) - && (0x00 == (preceeding_lsb & 0x08)))) - there_is_preceeding_non_skip_insn = 0; + if ((0xfe == (preceding_msb & 0xfe) + && (0x00 == (preceding_lsb & 0x08)))) + there_is_preceding_non_skip_insn = 0; /* cpse */ - if (0x10 == (preceeding_msb & 0xfc)) - there_is_preceeding_non_skip_insn = 0; + if (0x10 == (preceding_msb & 0xfc)) + there_is_preceding_non_skip_insn = 0; - if (there_is_preceeding_non_skip_insn == 0) + if (there_is_preceding_non_skip_insn == 0) if (debug_relax) - printf ("preceeding skip insn prevents deletion of" - " ret insn at addr 0x%x in section %s\n", + printf ("preceding skip insn prevents deletion of" + " ret insn at Addy 0x%x in section %s\n", (int) dot + 2, sec->name); } else { /* There is no previous instruction. */ - there_is_preceeding_non_skip_insn = 0; + there_is_preceding_non_skip_insn = 0; } - if (there_is_preceeding_non_skip_insn) + if (there_is_preceding_non_skip_insn) { /* We now only have to make sure that there is no local label defined at the address of the ret |