+2007-02-18 Alan Modra <amodra@bigpond.net.au>
+
+ * write.c (TC_FX_SIZE_SLACK): Define.
+ (write_relocs): Reinstate check for fixup within frag.
+ * config/tc-bfin.h (TC_FX_SIZE_SLACK): Define.
+ * config/tc-h8300.h (TC_FX_SIZE_SLACK): Define.
+ * config/tc-mmix.h (TC_FX_SIZE_SLACK): Define.
+ * config/tc-sh.h (TC_FX_SIZE_SLACK): Define.
+ * config/tc-xstormy16.h (TC_FX_SIZE_SLACK): Define.
+
2007-02-17 Mark Mitchell <mark@codesourcery.com>
Nathan Sidwell <nathan@codesourcery.com>
Vladimir Prus <vladimir@codesourcery.com
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
extern long md_pcrel_from_section (struct fix *, segT);
+/* SH_COUNT relocs are allowed outside of frag.
+ The target is also buggy and sets fix size too large for other relocs. */
+#define TC_FX_SIZE_SLACK(FIX) \
+ ((FIX)->fx_r_type == BFD_RELOC_SH_COUNT ? -1 : 2)
+
#define IGNORE_NONSTANDARD_ESCAPES
#define LISTING_HEADER \
#define TC_FAKE_LABEL(NAME) (strcmp ((NAME), FAKE_LABEL_NAME) == 0)
#endif
+/* Positive values of TC_FX_SIZE_SLACK allow a target to define
+ fixups that far past the end of a frag. Having such fixups
+ is of course most most likely a bug in setting fx_size correctly.
+ A negative value disables the fixup check entirely, which is
+ appropriate for something like the Renesas / SuperH SH_COUNT
+ reloc. */
+#ifndef TC_FX_SIZE_SLACK
+#define TC_FX_SIZE_SLACK(FIX) 0
+#endif
+
/* Used to control final evaluation of expressions. */
int finalize_syms = 0;
{
arelent *reloc;
bfd_reloc_status_type s;
+ int fx_size, slack;
+ offsetT loc;
if (fixp->fx_done)
{
continue;
}
- /*
- This test is triggered inappropriately for the SH:
- if (fixp->fx_where + fixp->fx_size
- > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
- abort ();
- */
+ fx_size = fixp->fx_size;
+ slack = TC_FX_SIZE_SLACK (fixp);
+ if (slack > 0)
+ fx_size = fx_size > slack ? fx_size - slack : 0;
+ loc = fixp->fx_where + fx_size;
+ if (slack >= 0
+ && loc > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("internal error: fixup not contained within frag"));
s = bfd_install_relocation (stdoutput, reloc,
fixp->fx_frag->fr_literal,
arelent **reloc;
bfd_reloc_status_type s;
int j;
+ int fx_size, slack;
+ offsetT loc;
if (fixp->fx_done)
{
relocs[i++] = reloc[j];
assert (i <= n);
}
- if (fixp->fx_where + fixp->fx_size
- > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
+
+ fx_size = fixp->fx_size;
+ slack = TC_FX_SIZE_SLACK (fixp);
+ if (slack > 0)
+ fx_size = fx_size > slack ? fx_size - slack : 0;
+ loc = fixp->fx_where + fx_size;
+ if (slack >= 0
+ && loc > fixp->fx_frag->fr_fix + fixp->fx_frag->fr_offset)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("internal error: fixup not contained within frag"));
+
for (j = 0; reloc[j]; j++)
{
s = bfd_install_relocation (stdoutput, reloc[j],