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[] =
{
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);
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 ();
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))
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)
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
}
#ifdef DEBUG386
- if (flagseen['D'])
+ if (flag_debug)
{
pi (line, &i);
}
{
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 */
return (reg_entry *) hash_find (reg_hash, reg_name_given);
}
\f
-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}
};
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");
}
\f
/* We have no need to default values of symbols. */
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;
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:
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);