} \
}
+/* Variant of CHECK_FIELD for use in md_apply_fix and other places where
+ the current file and line number are not valid. */
+
+#define CHECK_FIELD_WHERE(FIELD, HIGH, LOW, FILENAME, LINE) \
+ { \
+ if ((FIELD) > (HIGH) || (FIELD) < (LOW)) \
+ { \
+ as_bad_where ((FILENAME), (LINE), \
+ _("Field out of range [%d..%d] (%d)."), (LOW), (HIGH), \
+ (int) (FIELD));\
+ break; \
+ } \
+ }
+
/* Simple alignment checking for FIELD againt ALIGN (a power of two).
IGNORE is used to suppress the error message. */
if (codes == NULL)
{
- as_bad (_("Cannot handle fixup at %s:%d"), fixp->fx_file, fixp->fx_line);
+ as_bad_where (fixp->fx_file, fixp->fx_line, _("Cannot handle fixup"));
abort ();
}
hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data;
if (hppa_fixP == NULL)
{
- printf (_("no hppa_fixup entry for fixup type 0x%x at %s:%d"),
- fixP->fx_r_type, fixP->fx_file, fixP->fx_line);
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("no hppa_fixup entry for fixup type 0x%x"),
+ fixP->fx_r_type);
return 0;
}
switch (fmt)
{
case 10:
- CHECK_FIELD (new_val, 8191, -8192, 0);
+ CHECK_FIELD_WHERE (new_val, 8191, -8192,
+ fixP->fx_file, fixP->fx_line);
val = new_val;
insn = (insn & ~ 0x3ff1) | (((val & 0x1ff8) << 1)
| ((val & 0x2000) >> 13));
break;
case -11:
- CHECK_FIELD (new_val, 8191, -8192, 0);
+ CHECK_FIELD_WHERE (new_val, 8191, -8192,
+ fixP->fx_file, fixP->fx_line);
val = new_val;
insn = (insn & ~ 0x3ff9) | (((val & 0x1ffc) << 1)
break;
/* Handle all opcodes with the 'j' operand type. */
case 14:
- CHECK_FIELD (new_val, 8191, -8192, 0);
+ CHECK_FIELD_WHERE (new_val, 8191, -8192,
+ fixP->fx_file, fixP->fx_line);
val = new_val;
insn = ((insn & ~ 0x3fff) | low_sign_unext (val, 14));
/* Handle all opcodes with the 'k' operand type. */
case 21:
- CHECK_FIELD (new_val, 1048575, -1048576, 0);
+ CHECK_FIELD_WHERE (new_val, 1048575, -1048576,
+ fixP->fx_file, fixP->fx_line);
val = new_val;
insn = (insn & ~ 0x1fffff) | re_assemble_21 (val);
/* Handle all the opcodes with the 'i' operand type. */
case 11:
- CHECK_FIELD (new_val, 1023, -1024, 0);
+ CHECK_FIELD_WHERE (new_val, 1023, -1024,
+ fixP->fx_file, fixP->fx_line);
val = new_val;
insn = (insn & ~ 0x7ff) | low_sign_unext (val, 11);
/* Handle all the opcodes with the 'w' operand type. */
case 12:
- CHECK_FIELD (new_val - 8, 8191, -8192, 0);
+ CHECK_FIELD_WHERE (new_val - 8, 8191, -8192,
+ fixP->fx_file, fixP->fx_line);
val = new_val - 8;
insn = (insn & ~ 0x1ffd) | re_assemble_12 (val >> 2);
range target, then we want to complain. */
if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL
&& (insn & 0xffe00000) == 0xe8000000)
- CHECK_FIELD (distance - 8, 262143, -262144, 0);
+ CHECK_FIELD_WHERE (distance - 8, 262143, -262144,
+ fixP->fx_file, fixP->fx_line);
- CHECK_FIELD (new_val - 8, 262143, -262144, 0);
+ CHECK_FIELD_WHERE (new_val - 8, 262143, -262144,
+ fixP->fx_file, fixP->fx_line);
val = new_val - 8;
insn = (insn & ~ 0x1f1ffd) | re_assemble_17 (val >> 2);
range target, then we want to complain. */
if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL
&& (insn & 0xffe00000) == 0xe8000000)
- CHECK_FIELD (distance - 8, 8388607, -8388608, 0);
+ CHECK_FIELD_WHERE (distance - 8, 8388607, -8388608,
+ fixP->fx_file, fixP->fx_line);
- CHECK_FIELD (new_val - 8, 8388607, -8388608, 0);
+ CHECK_FIELD_WHERE (new_val - 8, 8388607, -8388608,
+ fixP->fx_file, fixP->fx_line);
val = new_val - 8;
insn = (insn & ~ 0x3ff1ffd) | re_assemble_22 (val >> 2);
break;
default:
- as_bad (_("Unknown relocation encountered in md_apply_fix."));
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("Unknown relocation encountered in md_apply_fix."));
return 0;
}