diff options
author | Mark Shinwell <shinwell@codesourcery.com> | 2007-03-23 10:43:35 +0000 |
---|---|---|
committer | Mark Shinwell <shinwell@codesourcery.com> | 2007-03-23 10:43:35 +0000 |
commit | 738755b09abcd97a6869857116135a38cdfd9bea (patch) | |
tree | 448e5453ce08d6b3ffd51763bfc0874aed2f03fe /gas | |
parent | a1ac8190312a85c3726a7cfbdd938462cec9907b (diff) | |
download | gdb-738755b09abcd97a6869857116135a38cdfd9bea.zip gdb-738755b09abcd97a6869857116135a38cdfd9bea.tar.gz gdb-738755b09abcd97a6869857116135a38cdfd9bea.tar.bz2 |
gas/
* config/tc-arm.c (md_apply_fix): Turn CZB instructions that
attempt to jump to the next instruction into NOPs.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-arm.c | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 87c80be..f66b59b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2007-03-23 Mark Shinwell <shinwell@codesourcery.com> + + * config/tc-arm.c (md_apply_fix): Turn CZB instructions that + attempt to jump to the next instruction into NOPs. + 2007-03-23 Alan Modra <amodra@bigpond.net.au> * config/tc-spu.c: Don't include opcode/spu.h. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index aa2ac05..72ff8f4 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -18101,16 +18101,32 @@ md_apply_fix (fixS * fixP, case BFD_RELOC_THUMB_PCREL_BRANCH7: /* CBZ */ /* CBZ can only branch forward. */ - if (value & ~0x7e) - as_bad_where (fixP->fx_file, fixP->fx_line, - _("branch out of range")); - if (fixP->fx_done || !seg->use_rela_p) + /* Attempts to use CBZ to branch to the next instruction + (which, strictly speaking, are prohibited) will be turned into + no-ops. + + FIXME: It may be better to remove the instruction completely and + perform relaxation. */ + if (value == -2) { newval = md_chars_to_number (buf, THUMB_SIZE); - newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3); + newval = 0xbf00; /* NOP encoding T1 */ md_number_to_chars (buf, newval, THUMB_SIZE); } + else + { + if (value & ~0x7e) + as_bad_where (fixP->fx_file, fixP->fx_line, + _("branch out of range")); + + if (fixP->fx_done || !seg->use_rela_p) + { + newval = md_chars_to_number (buf, THUMB_SIZE); + newval |= ((value & 0x3e) << 2) | ((value & 0x40) << 3); + md_number_to_chars (buf, newval, THUMB_SIZE); + } + } break; case BFD_RELOC_THUMB_PCREL_BRANCH9: /* Conditional branch. */ |