Browse Source

* config/tc-hppa.c (CHECK_FIELD_WHERE): Define.

(md_apply_fix): Use it here.  Replace printf with equivalent
	as_bad_where.
	(tc_gen_reloc): Use as_bad_where instead of as_bad.
	(md_apply_fix): Here too.
	* config/tc-i386.c (tc_gen_reloc): Use as_bad_where instead of as_bad.
	* config/tc-m68k.c (tc_gen_reloc): Likewise.
	(md_convert_frag_1): Likewise.
dberlin-typesystem-branch
Alan Modra 26 years ago
parent
commit
b091f402a9
  1. 11
      gas/ChangeLog
  2. 54
      gas/config/tc-hppa.c
  3. 9
      gas/config/tc-i386.c
  4. 8
      gas/config/tc-m68k.c

11
gas/ChangeLog

@ -1,3 +1,14 @@
2001-06-21 Alan Modra <amodra@bigpond.net.au>
* config/tc-hppa.c (CHECK_FIELD_WHERE): Define.
(md_apply_fix): Use it here. Replace printf with equivalent
as_bad_where.
(tc_gen_reloc): Use as_bad_where instead of as_bad.
(md_apply_fix): Here too.
* config/tc-i386.c (tc_gen_reloc): Use as_bad_where instead of as_bad.
* config/tc-m68k.c (tc_gen_reloc): Likewise.
(md_convert_frag_1): Likewise.
2000-06-20 Tom Rix <trix@redhat.com> 2000-06-20 Tom Rix <trix@redhat.com>
* config/tc-ppc.c (ppc_comm): Change default alignment to 4 bytes. * config/tc-ppc.c (ppc_comm): Change default alignment to 4 bytes.

54
gas/config/tc-hppa.c

@ -1153,6 +1153,20 @@ static struct default_space_dict pa_def_spaces[] =
} \ } \
} }
/* 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). /* Simple alignment checking for FIELD againt ALIGN (a power of two).
IGNORE is used to suppress the error message. */ IGNORE is used to suppress the error message. */
@ -4055,7 +4069,7 @@ tc_gen_reloc (section, fixp)
if (codes == NULL) 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 (); abort ();
} }
@ -4426,8 +4440,9 @@ md_apply_fix (fixP, valp)
hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data; hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data;
if (hppa_fixP == NULL) if (hppa_fixP == NULL)
{ {
printf (_("no hppa_fixup entry for fixup type 0x%x at %s:%d"), as_bad_where (fixP->fx_file, fixP->fx_line,
fixP->fx_r_type, fixP->fx_file, fixP->fx_line); _("no hppa_fixup entry for fixup type 0x%x"),
fixP->fx_r_type);
return 0; return 0;
} }
@ -4493,14 +4508,16 @@ md_apply_fix (fixP, valp)
switch (fmt) switch (fmt)
{ {
case 10: 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; val = new_val;
insn = (insn & ~ 0x3ff1) | (((val & 0x1ff8) << 1) insn = (insn & ~ 0x3ff1) | (((val & 0x1ff8) << 1)
| ((val & 0x2000) >> 13)); | ((val & 0x2000) >> 13));
break; break;
case -11: 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; val = new_val;
insn = (insn & ~ 0x3ff9) | (((val & 0x1ffc) << 1) insn = (insn & ~ 0x3ff9) | (((val & 0x1ffc) << 1)
@ -4508,7 +4525,8 @@ md_apply_fix (fixP, valp)
break; break;
/* Handle all opcodes with the 'j' operand type. */ /* Handle all opcodes with the 'j' operand type. */
case 14: 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; val = new_val;
insn = ((insn & ~ 0x3fff) | low_sign_unext (val, 14)); insn = ((insn & ~ 0x3fff) | low_sign_unext (val, 14));
@ -4516,7 +4534,8 @@ md_apply_fix (fixP, valp)
/* Handle all opcodes with the 'k' operand type. */ /* Handle all opcodes with the 'k' operand type. */
case 21: 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; val = new_val;
insn = (insn & ~ 0x1fffff) | re_assemble_21 (val); insn = (insn & ~ 0x1fffff) | re_assemble_21 (val);
@ -4524,7 +4543,8 @@ md_apply_fix (fixP, valp)
/* Handle all the opcodes with the 'i' operand type. */ /* Handle all the opcodes with the 'i' operand type. */
case 11: 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; val = new_val;
insn = (insn & ~ 0x7ff) | low_sign_unext (val, 11); insn = (insn & ~ 0x7ff) | low_sign_unext (val, 11);
@ -4532,7 +4552,8 @@ md_apply_fix (fixP, valp)
/* Handle all the opcodes with the 'w' operand type. */ /* Handle all the opcodes with the 'w' operand type. */
case 12: 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; val = new_val - 8;
insn = (insn & ~ 0x1ffd) | re_assemble_12 (val >> 2); insn = (insn & ~ 0x1ffd) | re_assemble_12 (val >> 2);
@ -4547,9 +4568,11 @@ md_apply_fix (fixP, valp)
range target, then we want to complain. */ range target, then we want to complain. */
if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL
&& (insn & 0xffe00000) == 0xe8000000) && (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; val = new_val - 8;
insn = (insn & ~ 0x1f1ffd) | re_assemble_17 (val >> 2); insn = (insn & ~ 0x1f1ffd) | re_assemble_17 (val >> 2);
@ -4564,9 +4587,11 @@ md_apply_fix (fixP, valp)
range target, then we want to complain. */ range target, then we want to complain. */
if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL if (fixP->fx_r_type == (int) R_HPPA_PCREL_CALL
&& (insn & 0xffe00000) == 0xe8000000) && (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; val = new_val - 8;
insn = (insn & ~ 0x3ff1ffd) | re_assemble_22 (val >> 2); insn = (insn & ~ 0x3ff1ffd) | re_assemble_22 (val >> 2);
@ -4593,7 +4618,8 @@ md_apply_fix (fixP, valp)
break; break;
default: 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; return 0;
} }

9
gas/config/tc-i386.c

@ -4780,8 +4780,9 @@ tc_gen_reloc (section, fixp)
switch (fixp->fx_size) switch (fixp->fx_size)
{ {
default: default:
as_bad (_("can not do %d byte pc-relative relocation"), as_bad_where (fixp->fx_file, fixp->fx_line,
fixp->fx_size); _("can not do %d byte pc-relative relocation"),
fixp->fx_size);
code = BFD_RELOC_32_PCREL; code = BFD_RELOC_32_PCREL;
break; break;
case 1: code = BFD_RELOC_8_PCREL; break; case 1: code = BFD_RELOC_8_PCREL; break;
@ -4794,7 +4795,9 @@ tc_gen_reloc (section, fixp)
switch (fixp->fx_size) switch (fixp->fx_size)
{ {
default: default:
as_bad (_("can not do %d byte relocation"), fixp->fx_size); as_bad_where (fixp->fx_file, fixp->fx_line,
_("can not do %d byte relocation"),
fixp->fx_size);
code = BFD_RELOC_32; code = BFD_RELOC_32;
break; break;
case 1: code = BFD_RELOC_8; break; case 1: code = BFD_RELOC_8; break;

8
gas/config/tc-m68k.c

@ -900,8 +900,9 @@ tc_gen_reloc (section, fixp)
if (fixp->fx_tcbit) if (fixp->fx_tcbit)
{ {
if (fixp->fx_addsy) if (fixp->fx_addsy)
as_bad (_("Unable to produce reloc against symbol '%s'"), as_bad_where (fixp->fx_file, fixp->fx_line,
S_GET_NAME (fixp->fx_addsy)); _("Unable to produce reloc against symbol '%s'"),
S_GET_NAME (fixp->fx_addsy));
return NULL; return NULL;
} }
@ -4374,7 +4375,8 @@ md_convert_frag_1 (fragP)
case TAB (BRANCHBW, BYTE): case TAB (BRANCHBW, BYTE):
know (issbyte (disp)); know (issbyte (disp));
if (disp == 0) if (disp == 0)
as_bad (_("short branch with zero offset: use :w")); as_bad_where (fragP->fr_file, fragP->fr_line,
_("short branch with zero offset: use :w"));
fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol, fixP = fix_new (fragP, fragP->fr_fix - 1, 1, fragP->fr_symbol,
fragP->fr_offset, 1, RELAX_RELOC_PC8); fragP->fr_offset, 1, RELAX_RELOC_PC8);
fixP->fx_pcrel_adjust = -1; fixP->fx_pcrel_adjust = -1;

Loading…
Cancel
Save