diff options
author | Nick Clifton <nickc@redhat.com> | 2009-06-16 11:33:42 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-06-16 11:33:42 +0000 |
commit | 81694485e2c696e1aa8dfb3f92110d437c833b22 (patch) | |
tree | 8bf5c06413e1cee151e6d927ebc556f181babab2 /bfd | |
parent | 4e99ad6974d2233414bccf6989139dead4132704 (diff) | |
download | gdb-81694485e2c696e1aa8dfb3f92110d437c833b22.zip gdb-81694485e2c696e1aa8dfb3f92110d437c833b22.tar.gz gdb-81694485e2c696e1aa8dfb3f92110d437c833b22.tar.bz2 |
* elf32-arm.c (cortex_a8_erratum_scan): Change type of offset
to bfd_signed_vma. Cast constant operands which are used in
offset related expressions to bfd_signed_vma type as appropriate.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-arm.c | 37 |
2 files changed, 26 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b0f4726..281d56e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2009-06-16 Doug Kwan <dougkwan@google.com> + + * elf32-arm.c (cortex_a8_erratum_scan): Change type of offset + to bfd_signed_vma. Cast constant operands which are used in + offset related expressions to bfd_signed_vma type as appropriate. + 2009-06-16 Maciej W. Rozycki <macro@linux-mips.org> * elf32-vax.c (elf_vax_plt_sym_val): New function. diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index df4be8b..d06d369 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -1,6 +1,6 @@ /* 32-bit ELF support for ARM Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008 Free Software Foundation, Inc. + 2008, 2009 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -3884,11 +3884,12 @@ static struct elf_link_hash_entry *find_thumb_glue (struct bfd_link_info *, /* Helper function to scan code for sequences which might trigger the Cortex-A8 branch/TLB erratum. Fill in the table described by A8_FIXES_P, - NUM_A8_FIXES_P, A8_FIX_TABLE_SIZE_P. Return 1 if an error occurs, 0 + NUM_A8_FIXES_P, A8_FIX_TABLE_SIZE_P. Returns true if an error occurs, false otherwise. */ -static int -cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, +static bfd_boolean +cortex_a8_erratum_scan (bfd *input_bfd, + struct bfd_link_info *info, struct a8_erratum_fix **a8_fixes_p, unsigned int *num_a8_fixes_p, unsigned int *a8_fix_table_size_p, @@ -3922,7 +3923,7 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, if (elf_section_data (section)->this_hdr.contents != NULL) contents = elf_section_data (section)->this_hdr.contents; else if (! bfd_malloc_and_get_section (input_bfd, section, &contents)) - return 1; + return TRUE; sec_data = elf32_arm_section_data (section); @@ -3949,9 +3950,7 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, * The branch target is in the same 4KB region as the first half of the branch. * The instruction before the branch is a 32-bit - length non-branch instruction. - */ - + length non-branch instruction. */ for (i = span_start; i < span_end;) { unsigned int insn = bfd_getl16 (&contents[i]); @@ -3979,10 +3978,13 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, is_32bit_branch = is_b || is_bl || is_blx || is_bcc; - if (((base_vma + i) & 0xfff) == 0xffe && insn_32bit - && is_32bit_branch && last_was_32bit && !last_was_branch) + if (((base_vma + i) & 0xfff) == 0xffe + && insn_32bit + && is_32bit_branch + && last_was_32bit + && ! last_was_branch) { - bfd_vma offset; + bfd_signed_vma offset; bfd_boolean force_target_arm = FALSE; bfd_boolean force_target_thumb = FALSE; bfd_vma target; @@ -4031,7 +4033,7 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, offset |= (insn & 0x800) ? 0x80000 : 0; offset |= (insn & 0x4000000) ? 0x100000 : 0; if (offset & 0x100000) - offset |= ~0xfffff; + offset |= ~ ((bfd_signed_vma) 0xfffff); stub_type = arm_stub_a8_veneer_b_cond; } else if (is_b || is_bl || is_blx) @@ -4048,10 +4050,10 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, offset |= i1 << 23; offset |= s << 24; if (offset & 0x1000000) - offset |= ~0xffffff; + offset |= ~ ((bfd_signed_vma) 0xffffff); if (is_blx) - offset &= ~3u; + offset &= ~ ((bfd_signed_vma) 3); stub_type = is_blx ? arm_stub_a8_veneer_blx : is_bl ? arm_stub_a8_veneer_bl : arm_stub_a8_veneer_b; @@ -4084,14 +4086,15 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, } if (is_blx) - pc_for_insn &= ~3u; + pc_for_insn &= ~ ((bfd_vma) 3); /* If we found a relocation, use the proper destination, not the offset in the (unrelocated) instruction. Note this is always done if we switched the stub type above. */ if (found) - offset = found->destination - pc_for_insn; + offset = + (bfd_signed_vma) (found->destination - pc_for_insn); target = pc_for_insn + offset; @@ -4144,7 +4147,7 @@ cortex_a8_erratum_scan (bfd *input_bfd, struct bfd_link_info *info, *num_a8_fixes_p = num_a8_fixes; *a8_fix_table_size_p = a8_fix_table_size; - return 0; + return FALSE; } /* Determine and set the size of the stub section for a final link. |