(tc_gen_reloc): Use bfd_get_reloc_code_name in error message.

This commit is contained in:
Ken Raeburn 1994-09-07 23:58:32 +00:00
parent fa156ffebe
commit ade614d507
3 changed files with 54 additions and 13 deletions

View File

@ -130,6 +130,7 @@ static void emit_ldah_num PARAMS ((int, bfd_vma, int));
static void emit_addq_r PARAMS ((int, int, int));
static void emit_lda_n PARAMS ((int, bfd_vma, int));
static void emit_add64 PARAMS ((int, int, bfd_vma));
static int in_range PARAMS ((bfd_vma, int, int));
const pseudo_typeS md_pseudo_table[] =
{
@ -383,8 +384,8 @@ tc_gen_reloc (sec, fixp)
assert (reloc->howto != 0);
if (!fixp->fx_pcrel != !reloc->howto->pc_relative)
{
as_fatal ("bug in handling type-%d relocs", fixp->fx_r_type);
abort ();
as_fatal ("internal error? cannot generate `%s' relocation",
bfd_get_reloc_code_name (fixp->fx_r_type));
}
assert (!fixp->fx_pcrel == !reloc->howto->pc_relative);
@ -1074,7 +1075,6 @@ build_mem (opc, ra, rb, disp)
int opc, ra, rb;
bfd_signed_vma disp;
{
fprintf (stderr, "build_mem: disp=%lx\n", disp);
if ((disp >> 15) != 0
&& (disp >> 15) + 1 != 0)
abort ();
@ -1148,7 +1148,7 @@ emit_add64 (in, out, num)
emit_ldah_num (out, snum >> 16, in);
return;
}
/* I'm not sure this one is getting invoked when it could.
/* I'm not sure this one is getting invoked when it could. */
if ((num & 1) == 0 && in == ZERO)
{
if (in_range (snum >> 1, 16, 0))
@ -1195,7 +1195,6 @@ emit_add64 (in, out, num)
if (lo & 0x80000000)
lo -= ((bfd_vma)0x10000000 << 4);
snum -= lo;
printf ("splitting load of 0x%lx: 0x%lx 0x%lx\n", num, snum, lo);
emit_add64 (ZERO, out, snum >> 32);
emit_sll_n (out, 32, out);
if (lo != 0)

View File

@ -161,6 +161,8 @@ static reg_entry *ebp, *esp;
static int this_operand; /* current operand we are working on */
static int flag_do_long_jump; /* FIXME what does this do? */
/* Interface to relax_segment.
There are 2 relax states for 386 jump insns: one for conditional &
one for unconditional jumps. This is because the these two types
@ -1649,7 +1651,7 @@ md_assemble (line)
}
#ifdef DEBUG386
if (flagseen['D'])
if (flag_debug)
{
pi (line, &i);
}
@ -2242,7 +2244,7 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
{
long offset;
if (flagseen['m'])
if (flag_do_long_jump)
{
offset = to_addr - S_GET_VALUE (to_symbol);
md_number_to_chars (ptr, (valueT) 0xe9, 1);/* opcode for long jmp */
@ -2427,7 +2429,11 @@ parse_register (reg_string)
return (reg_entry *) hash_find (reg_hash, reg_name_given);
}
CONST char *md_shortopts = "";
#ifdef OBJ_ELF
CONST char *md_shortopts = "mVQ:";
#else
CONST char *md_shortopts = "m";
#endif
struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
@ -2438,13 +2444,36 @@ md_parse_option (c, arg)
int c;
char *arg;
{
return 0;
switch (c)
{
case 'm':
flag_do_long_jump = 1;
break;
#ifdef OBJ_ELF
/* -V: SVR4 argument to print version ID. */
case 'V':
print_version_id ();
break;
/* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
should be emitted or not. FIXME: Not implemented. */
case 'Q':
break;
#endif
default:
return 0;
}
return 1;
}
void
md_show_usage (stream)
FILE *stream;
{
fprintf (stream, "\
-m do long jump\n");
}
/* We have no need to default values of symbols. */
@ -2551,8 +2580,8 @@ tc_gen_reloc (section, fixp)
name = S_GET_NAME (fixp->fx_addsy);
if (name == NULL)
name = "<unknown>";
as_fatal ("Cannot find relocation type for symbol %s, code %d",
name, (int) code);
as_fatal ("Cannot generate relocation type for symbol %s, code %s",
name, bfd_get_reloc_code_name (code));
}
return rel;

View File

@ -1906,6 +1906,19 @@ md_apply_fix (fixP, value)
if (fixP->fx_r_type == BFD_RELOC_32_PCREL_S2 && fixP->fx_addsy)
val += fixP->fx_where + fixP->fx_frag->fr_address;
#ifdef OBJ_AOUT
/* FIXME: More ridiculous gas reloc hacking. If we are going to
generate a reloc, then we just want to let the reloc addend set
the value. We do not want to also stuff the addend into the
object file. Including the addend in the object file works when
doing a static link, because the linker will ignore the object
file contents. However, the dynamic linker does not ignore the
object file contents. */
if (fixP->fx_addsy != NULL
&& fixP->fx_r_type != BFD_RELOC_32_PCREL_S2)
val = 0;
#endif
switch (fixP->fx_r_type)
{
case BFD_RELOC_16:
@ -2113,8 +2126,8 @@ tc_gen_reloc (section, fixp)
if (reloc->howto == 0)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
"internal error: can't export reloc type %d",
fixp->fx_r_type);
"internal error: can't export reloc type %d (`%s')",
fixp->fx_r_type, bfd_get_reloc_code_name (code));
return 0;
}
assert (!fixp->fx_pcrel == !reloc->howto->pc_relative);