2008-04-11 Andrew Stubbs * config/tc-sh.c (md_apply_fix): Make sure BFD_RELOC_SH_PCRELIMM8BY4 relocations are properly aligned, and not negative. Index: src/gas/config/tc-sh.c =================================================================== --- src.orig/gas/config/tc-sh.c 2007-10-17 17:45:55.000000000 +0100 +++ src/gas/config/tc-sh.c 2008-04-11 15:01:17.000000000 +0100 @@ -4018,6 +4018,17 @@ md_apply_fix (fixS *fixP, valueT *valP, break; case BFD_RELOC_SH_PCRELIMM8BY4: + /* Don't silently move the destination due to misalignment. + The absolute address is the fragment base plus the offset into + the fragment plus the pc relative offset to the label. */ + if ((fixP->fx_frag->fr_address + fixP->fx_where + val) & 3) + as_bad_where (fixP->fx_file, fixP->fx_line, _("offset to unaligned destination")); + + /* The displacement cannot be zero or backward even if aligned. + Allow -2 because val has already been adjusted somewhere. */ + if (val < -2) + as_bad_where (fixP->fx_file, fixP->fx_line, _("negative offset")); + /* The lower two bits of the PC are cleared before the displacement is added in. We can assume that the destination is on a 4 byte boundary. If this instruction is also on a 4