[PATCH][SH] Ensure that offset alignments are valid

Kaz Kojima kkojima@rr.iij4u.or.jp
Fri Apr 11 23:47:00 GMT 2008

Andrew STUBBS <andrew.stubbs@st.com> wrote:
> The attached patch adds an error message, to the SH assembler, rejecting 
> all invalid BFD_RELOC_SH_PCRELIMM8BY4 relocations.
> Specifically, the PC to destination offset must not be negative, and the 
> destination must be 4-byte aligned.
> At present, incorrect values are silently mis-assembled.

Thanks for fixing this!  The line

+       as_bad_where (fixP->fx_file, fixP->fx_line, _("offset to unaligned destination"));

should be wrapped like as

+       as_bad_where (fixP->fx_file, fixP->fx_line,
+                     _("offset to unaligned destination"));

The patch itself looks fine with that change, though

> This patch has some fallout in the testsuite results (the arch tests use 
> misaligned targets). I shall fix that up if this patch is OK.

We should apply the above patch together with the tweaks of
affected testcases, shouldn't we?  I'm afraid that applying
the patch alone surprises people who run build/tests for
multiple targets including SH.


More information about the Binutils mailing list