From: Mark Shinwell Date: Tue, 24 Oct 2006 14:06:25 +0000 (+0000) Subject: gas/ X-Git-Tag: binutils-csl-sourcerygxx-4_1-25~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b99317393aea423a186fb403fe7f58f3c4928e14;p=thirdparty%2Fbinutils-gdb.git gas/ * config/tc-arm.c (md_apply_fix): Turn CZB instructions that attempt to jump to the next instruction into NOPs. --- diff --git a/ChangeLog.csl b/ChangeLog.csl index d33c8bf19f1..a5162f4d478 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,9 @@ +2006-10-24 Mark Shinwell + + gas/ + * config/tc-arm.c (md_apply_fix): Turn CZB instructions that + attempt to jump to the next instruction into NOPs. + 2006-10-19 Joseph S. Myers Mark Mitchell diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 774723f18eb..263b500c6d7 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -17974,16 +17974,29 @@ md_apply_fix (fixS * fixP, case BFD_RELOC_THUMB_PCREL_BRANCH7: /* CZB */ /* CZB 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 CZB to branch to the next instruction + (which, strictly speaking, are prohibited) will be turned into + no-ops. */ + 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. */