+2001-11-15 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * write.c (fixup_segment): Remove referrences to md_apply_fix and
+ TC_HANDLE_FX_DONE.
+ * cgen.c, config/obj-coff.c, config/tc-*.c: Update all occurances
+ of md_apply_fix to md_apply_fix3.
+ Make all md_apply_fix3 functions void.
+ * cgen.h, config/obj-coff.h, tc-*.h: Remove all definitions of
+ MD_APPLY_FIX3 and TC_HANDLE_FX_DONE.
+ * doc/internals.texi: Update references to md_apply_fix3.
+ * tc.h: Update prototype for md_apply_fix3.
+
2001-11-15 Alan Modra <amodra@bigpond.net.au>
* config/tc-i386.h (md_end): Define.
At this point we do not use a bfd_reloc_code_real_type for
operands residing in the insn, but instead just use the
operand index. This lets us easily handle fixups for any
- operand type. We pick a BFD reloc type in md_apply_fix. */
+ operand type. We pick a BFD reloc type in md_apply_fix3. */
fixS *
gas_cgen_record_fixup (frag, where, insn, length, operand, opinfo, symbol, offset)
At this point we do not use a bfd_reloc_code_real_type for
operands residing in the insn, but instead just use the
operand index. This lets us easily handle fixups for any
- operand type. We pick a BFD reloc type in md_apply_fix. */
+ operand type. We pick a BFD reloc type in md_apply_fix3. */
fixS *
gas_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
handles the rest. bfd_install_relocation (or some other bfd function)
should handle them all. */
-int
-gas_cgen_md_apply_fix3 (fixP, valueP, seg)
+void
+gas_cgen_md_apply_fix3 (fixP, valP, seg)
fixS * fixP;
- valueT * valueP;
+ valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{
char *where = fixP->fx_frag->fr_literal + fixP->fx_where;
- valueT value;
+ valueT value = * valP;
/* Canonical name, since used a lot. */
CGEN_CPU_DESC cd = gas_cgen_cpu_desc;
result of md_pcrel_from. This is confusing. */
if (fixP->fx_addsy == (symbolS *) NULL)
- {
- value = *valueP;
- fixP->fx_done = 1;
- }
+ fixP->fx_done = 1;
+
else if (fixP->fx_pcrel)
- value = *valueP;
+ ;
+
else
{
value = fixP->fx_offset;
+
if (fixP->fx_subsy != (symbolS *) NULL)
{
if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
}
if (fixP->fx_done)
- return 1;
+ return;
/* The operand isn't fully resolved. Determine a BFD reloc value
based on the operand information and leave it to
partial_inplace == false. */
reloc_type = md_cgen_lookup_reloc (insn, operand, fixP);
+
if (reloc_type != BFD_RELOC_NONE)
- {
- fixP->fx_r_type = reloc_type;
- }
+ fixP->fx_r_type = reloc_type;
else
{
as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
fixP->fx_done = 1;
- return 1;
+ return;
}
}
else if (fixP->fx_done)
See the comment describing fx_addnumber in write.h.
This field is misnamed (or misused :-). */
fixP->fx_addnumber = value;
-
- return 1;
}
/* Translate internal representation of relocation info to BFD target format.
expressionS *));
/* md_apply_fix3 handler */
-extern int gas_cgen_md_apply_fix3 PARAMS ((fixS *, valueT *, segT));
+extern void gas_cgen_md_apply_fix3 PARAMS ((fixS *, valueT *, segT));
/* tc_gen_reloc handler */
extern arelent *gas_cgen_tc_gen_reloc PARAMS ((asection *, fixS *));
#endif
} /* if pcrel */
-#ifdef MD_APPLY_FIX3
- md_apply_fix3 (fixP, (valueT *) &add_number, this_segment_type);
-#else
- md_apply_fix (fixP, add_number);
-#endif
+ md_apply_fix3 (fixP, (valueT *) & add_number, this_segment_type);
if (!fixP->fx_bit_fixP && ! fixP->fx_no_overflow)
{
#ifdef TE_PE
#define TARGET_FORMAT "pe-shl"
#else
+
+#if 0 /* FIXME: The "shl" varaible does not appear to exist. What happened to it ? */
#define TARGET_FORMAT \
(shl \
? (sh_small ? "coff-shl-small" : "coff-shl") \
: (sh_small ? "coff-sh-small" : "coff-sh"))
+#else
+#define TARGET_FORMAT \
+ (sh_small ? "coff-shl-small" : "coff-shl")
+#endif
+
#endif
#endif
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- fixP->fx_addnumber = val; /* Remember value for emit_reloc */
+ fixP->fx_addnumber = val; /* Remember value for emit_reloc. */
know (fixP->fx_size == 4);
know (fixP->fx_r_type < NO_RELOC);
/* This is a hack. There should be a better way to handle this. */
if (fixP->fx_r_type == RELOC_WDISP30 && fixP->fx_addsy)
- {
- val += fixP->fx_where + fixP->fx_frag->fr_address;
- }
+ val += fixP->fx_where + fixP->fx_frag->fr_address;
switch (fixP->fx_r_type)
{
-
case RELOC_32:
buf[0] = val >> 24;
buf[1] = val >> 16;
else if (fixP->fx_pcrel)
{
long v = val >> 17;
+
if (v != 0 && v != -1)
as_bad_where (fixP->fx_file, fixP->fx_line,
"call/jmp target out of range");
}
else
- /* this case was supposed to be handled in machine_ip */
+ /* This case was supposed to be handled in machine_ip. */
abort ();
buf[1] = val >> 10; /* Holds bits 0003FFFC of address */
buf[3] = val >> 2;
as_bad (_("bad relocation type: 0x%02x"), fixP->fx_r_type);
break;
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
#ifdef OBJ_COFF
the distance to the "lda" instruction for setting the addend to
GPDISP. */
-int
+void
md_apply_fix3 (fixP, valueP, seg)
fixS *fixP;
- valueT *valueP;
+ valueT * valP;
segT seg;
{
char * const fixpos = fixP->fx_frag->fr_literal + fixP->fx_where;
- valueT value = *valueP;
+ valueT value = * valP;
unsigned image, size;
switch (fixP->fx_r_type)
md_number_to_chars (fixpos, value, size);
goto done;
}
- return 1;
+ return;
#ifdef OBJ_ECOFF
case BFD_RELOC_GPREL32:
case BFD_RELOC_GPREL16:
case BFD_RELOC_ALPHA_GPREL_HI16:
case BFD_RELOC_ALPHA_GPREL_LO16:
- return 1;
+ return;
case BFD_RELOC_23_PCREL_S2:
if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0)
image = (image & ~0x1FFFFF) | ((value >> 2) & 0x1FFFFF);
goto write_done;
}
- return 1;
+ return;
case BFD_RELOC_ALPHA_HINT:
if (fixP->fx_pcrel == 0 && fixP->fx_addsy == 0)
image = (image & ~0x3FFF) | ((value >> 2) & 0x3FFF);
goto write_done;
}
- return 1;
+ return;
#ifdef OBJ_ECOFF
case BFD_RELOC_ALPHA_LITERAL:
md_number_to_chars (fixpos, value, 2);
- return 1;
+ return;
#endif
case BFD_RELOC_ALPHA_ELF_LITERAL:
case BFD_RELOC_ALPHA_LITUSE:
case BFD_RELOC_ALPHA_LINKAGE:
case BFD_RELOC_ALPHA_CODEADDR:
- return 1;
+ return;
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
- return 1;
+ return;
default:
{
}
if (fixP->fx_addsy != 0 || fixP->fx_pcrel != 0)
- return 1;
+ return;
else
{
as_warn_where (fixP->fx_file, fixP->fx_line,
done:
fixP->fx_done = 1;
- return 0;
}
-/*
- * Look for a register name in the given symbol.
- */
+/* Look for a register name in the given symbol. */
symbolS *
md_undefined_symbol (name)
/* This file is tc-alpha.h
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Written by Ken Raeburn <raeburn@cygnus.com>.
: "unknown-format")
#define NEED_LITERAL_POOL
-#define TC_HANDLES_FX_DONE
#define REPEAT_CONS_EXPRESSIONS
extern int alpha_force_relocation PARAMS ((struct fix *));
#define TC_FORCE_RELOCATION(FIXP) alpha_force_relocation (FIXP)
#define tc_fix_adjustable(FIXP) alpha_fix_adjustable (FIXP)
#define RELOC_REQUIRES_SYMBOL
-#define MD_APPLY_FIX3
/* This expression evaluates to false if the relocation is for a local
object for which we still want to do the relocation at runtime.
operands residing in the insn, but instead just use the
operand index. This lets us easily handle fixups for any
operand type, although that is admittedly not a very exciting
- feature. We pick a BFD reloc type in md_apply_fix.
+ feature. We pick a BFD reloc type in md_apply_fix3.
Limm values (4 byte immediate "constants") must be treated
normally because they're not part of the actual insn word
and we attempt to completely resolve the reloc. If we can not do
that, we determine the correct reloc code and put it back in the fixup. */
-int
-md_apply_fix3 (fixP, valueP, seg)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT *valueP;
+ valueT * valP;
segT seg;
{
#if 0
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
#endif
- valueT value;
+ valueT value = * valP;
/* FIXME FIXME FIXME: The value we are passed in *valueP includes
the symbol values. Since we are using BFD_ASSEMBLER, if we are
result of md_pcrel_from. This is confusing. */
if (fixP->fx_addsy == (symbolS *) NULL)
- {
- value = *valueP;
- fixP->fx_done = 1;
- }
+ fixP->fx_done = 1;
+
else if (fixP->fx_pcrel)
{
- value = *valueP;
/* ELF relocations are against symbols.
If this symbol is in a different section then we need to leave it for
the linker to deal with. Unfortunately, md_pcrel_from can't tell,
if (fixP->fx_done)
{
/* Nothing else to do here. */
- return 1;
+ return;
}
/* Determine a BFD reloc value based on the operand information.
as_bad_where (fixP->fx_file, fixP->fx_line,
"unresolved expression that must be resolved");
fixP->fx_done = 1;
- return 1;
+ return;
}
}
else
}
fixP->fx_addnumber = value;
-
- return 1;
}
/* Translate internal representation of relocation info to BFD target
#define LISTING_HEADER "ARC GAS "
-#define TC_HANDLES_FX_DONE
-
-#define MD_APPLY_FIX3
-
/* The ARC needs to parse reloc specifiers in .word. */
extern void arc_parse_cons_expression PARAMS ((struct expressionS *, unsigned));
return FAIL;
}
-int
-md_apply_fix3 (fixP, val, seg)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS * fixP;
- valueT * val;
+ valueT * valP;
segT seg;
{
- offsetT value = * val;
+ offsetT value = * valP;
offsetT newval;
unsigned int newimm;
unsigned long temp;
&& S_GET_SEGMENT (fixP->fx_addsy) == seg)
{
/* Get pc relative value to go into the branch. */
- value = * val;
+ value = * valP;
/* Permit a backward branch provided that enough bits
are set. Allow a forwards branch, provided that
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
- return 1;
+ return;
case BFD_RELOC_NONE:
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Bad relocation fixup type (%d)"), fixP->fx_r_type);
}
-
- return 1;
}
/* Translate internal representation of relocation info to BFD target
#define md_operand(x)
-#define TC_HANDLES_FX_DONE
-
-#define MD_APPLY_FIX3
-
#define LOCAL_LABEL(name) (name[0] == '.' && (name[1] == 'L'))
#define LOCAL_LABELS_FB 1
#ifdef OBJ_ELF
/* GAS will call this for each fixup. It should store the correct
value in the object file. */
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
segT seg;
{
unsigned char *where;
unsigned long insn;
- long value;
+ long value = * (long *) valP;
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
{
- segT s = S_GET_SEGMENT (fixp->fx_addsy);
+ segT s = S_GET_SEGMENT (fixP->fx_addsy);
- if (fixp->fx_addsy && (s == seg || s == absolute_section))
+ if (fixP->fx_addsy && (s == seg || s == absolute_section))
{
- value = S_GET_VALUE (fixp->fx_addsy) + *valuep;
- fixp->fx_done = 1;
+ value = S_GET_VALUE (fixP->fx_addsy) + *valuep;
+ fixP->fx_done = 1;
}
- else
- value = *valuep;
}
else
{
- value = fixp->fx_offset;
+ value = fixP->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
{
- value -= S_GET_VALUE (fixp->fx_subsy);
- fixp->fx_done = 1;
+ value -= S_GET_VALUE (fixP->fx_subsy);
+ fixP->fx_done = 1;
}
else
{
/* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
}
}
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
default:
- fixp->fx_no_overflow = 1;
+ fixP->fx_no_overflow = 1;
break;
case BFD_RELOC_AVR_7_PCREL:
case BFD_RELOC_AVR_13_PCREL:
break;
}
- if (fixp->fx_done)
+ if (fixP->fx_done)
{
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn = bfd_getl16 (where);
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_AVR_7_PCREL:
if (value & 1)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("odd address operand: %ld"), value);
/* Instruction addresses are always right-shifted by 1. */
--value; /* Correct PC. */
if (value < -64 || value > 63)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
value = (value << 3) & 0x3f8;
bfd_putl16 ((bfd_vma) (value | insn), where);
case BFD_RELOC_AVR_13_PCREL:
if (value & 1)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("odd address operand: %ld"), value);
/* Instruction addresses are always right-shifted by 1. */
{
/* No wrap for devices with >8K of program memory. */
if ((avr_mcu->isa & AVR_ISA_MEGA) || avr_opt.no_wrap)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("operand out of range: %ld"), value);
}
x = bfd_getl16 (where);
if (value & 1)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("odd address operand: %ld"), value);
value >>= 1;
x |= ((value & 0x10000) | ((value << 3) & 0x1f00000)) >> 16;
default:
as_fatal (_("line %d: unknown relocation type: 0x%x"),
- fixp->fx_line, fixp->fx_r_type);
+ fixP->fx_line, fixP->fx_r_type);
break;
}
}
else
{
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case -BFD_RELOC_AVR_HI8_LDI_NEG:
case -BFD_RELOC_AVR_HI8_LDI:
case -BFD_RELOC_AVR_LO8_LDI_NEG:
case -BFD_RELOC_AVR_LO8_LDI:
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("only constant expression allowed"));
- fixp->fx_done = 1;
+ fixP->fx_done = 1;
break;
default:
break;
}
- fixp->fx_addnumber = value;
+ fixP->fx_addnumber = value;
}
- return 0;
}
/* A `BFD_ASSEMBLER' GAS will call this to generate a reloc. GAS
/* This file is tc-avr.h
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
`md_create_short_jump' to create a short jump around a long jump,
and define `md_create_long_jump' to create a long jump. */
-#define MD_APPLY_FIX3
-
-#define TC_HANDLES_FX_DONE
-
#undef RELOC_EXPANSION_POSSIBLE
/* If you define this macro, it means that `tc_gen_reloc' may return
multiple relocation entries for a single fixup. In this case, the
/* Apply a fixS (fixup of an instruction or data that we didn't have
enough info to complete immediately) to the data in a frag. */
-int
+void
md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
valueT *valP;
segT seg;
{
- long val = *valP;
-
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
val -= S_GET_VALUE (fixP->fx_subsy);
else
- {
- /* We can't actually support subtracting a symbol. */
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("expression too complex"));
- }
+ /* We can't actually support subtracting a symbol. */
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("expression too complex"));
}
cris_number_to_imm (buf, val, fixP->fx_size, fixP, seg);
}
-
- return 1;
}
/* All relocations are relative to the location just after the fixup;
extern const struct relax_type md_cris_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_cris_relax_table
-#define TC_HANDLES_FX_DONE
-
#define TC_FORCE_RELOCATION(fixp) md_cris_force_relocation (fixp)
extern int md_cris_force_relocation PARAMS ((struct fix *));
-#define MD_APPLY_FIX3
-
#define IS_CRIS_PIC_RELOC(X) \
((X) == BFD_RELOC_CRIS_16_GOT \
|| (X) == BFD_RELOC_CRIS_32_GOT \
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{
char *where;
unsigned long insn;
- long value;
+ long value = * (long *) valP;
int op_type;
int left = 0;
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- value = *valuep;
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
+
else
{
- value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ value = fixP->fx_offset;
+
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixp->fx_subsy);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
{
/* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
}
}
- op_type = fixp->fx_r_type;
+ op_type = fixP->fx_r_type;
if (op_type & 2048)
{
op_type -= 2048;
if (op_type & 1024)
{
op_type -= 1024;
- fixp->fx_r_type = BFD_RELOC_D10V_10_PCREL_L;
+ fixP->fx_r_type = BFD_RELOC_D10V_10_PCREL_L;
left = 1;
}
else if (op_type & 4096)
{
op_type -= 4096;
- fixp->fx_r_type = BFD_RELOC_D10V_18;
+ fixP->fx_r_type = BFD_RELOC_D10V_18;
}
else
- fixp->fx_r_type =
+ fixP->fx_r_type =
get_reloc ((struct d10v_operand *) &d10v_operands[op_type]);
}
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn = bfd_getb32 ((unsigned char *) where);
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_D10V_10_PCREL_L:
case BFD_RELOC_D10V_10_PCREL_R:
case BFD_RELOC_D10V_18:
/* Instruction addresses are always right-shifted by 2. */
value >>= AT_WORD_RIGHT_SHIFT;
- if (fixp->fx_size == 2)
+ if (fixP->fx_size == 2)
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
else
{
&& value < 4)
as_fatal
(_("line %d: rep or repi must include at least 4 instructions"),
- fixp->fx_line);
+ fixP->fx_line);
insn =
- d10v_insert_operand (insn, op_type, (offsetT) value, left, fixp);
+ d10v_insert_operand (insn, op_type, (offsetT) value, left, fixP);
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
}
break;
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
- fixp->fx_done = 0;
- return 1;
+ fixP->fx_done = 0;
+ return;
default:
as_fatal (_("line %d: unknown relocation type: 0x%x"),
- fixp->fx_line, fixp->fx_r_type);
+ fixP->fx_line, fixP->fx_r_type);
}
- return 0;
}
/* d10v_cleanup() is called after the assembler has finished parsing
/* tc-d10v.h -- Header file for tc-d10v.c.
- Copyright 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Martin Hunt, Cygnus Support.
This file is part of GAS, the GNU Assembler.
#define TARGET_FORMAT "elf32-d10v"
-#define MD_APPLY_FIX3
-
-/* call md_pcrel_from_section, not md_pcrel_from */
+/* Call md_pcrel_from_section, not md_pcrel_from. */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
long md_pcrel_from_section PARAMS ((fixS *, segT));
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
segT seg;
{
char *where;
unsigned long insn, insn2;
- long value;
+ long value = * (long *) valP;
+
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- value = *valuep;
else
{
- value = fixp->fx_offset;
+ value = fixP->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixp->fx_subsy);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
- {
- /* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
- _("expression too complex"));
- }
+ /* We don't actually support subtracting a symbol. */
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("expression too complex"));
}
}
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn = bfd_getb32 ((unsigned char *) where);
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_8: /* Check for a bad .byte directive. */
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
as_bad (_("line %d: unable to place address of symbol '%s' into a byte"),
- fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
+ fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
else if (((unsigned)value) > 0xff)
as_bad (_("line %d: unable to place value %x into a byte"),
- fixp->fx_line, value);
+ fixP->fx_line, value);
else
*(unsigned char *) where = value;
break;
case BFD_RELOC_16: /* Check for a bad .short directive. */
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
as_bad (_("line %d: unable to place address of symbol '%s' into a short"),
- fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
+ fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
else if (((unsigned)value) > 0xffff)
as_bad (_("line %d: unable to place value %x into a short"),
- fixp->fx_line, value);
+ fixP->fx_line, value);
else
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
break;
case BFD_RELOC_64: /* Check for a bad .quad directive. */
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
as_bad (_("line %d: unable to place address of symbol '%s' into a quad"),
- fixp->fx_line, S_GET_NAME (fixp->fx_addsy));
+ fixP->fx_line, S_GET_NAME (fixP->fx_addsy));
else
{
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
break;
case BFD_RELOC_D30V_6:
- check_size (value, 6, fixp->fx_file, fixp->fx_line);
+ check_size (value, 6, fixP->fx_file, fixP->fx_line);
insn |= value & 0x3F;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
case BFD_RELOC_D30V_9_PCREL:
- if (fixp->fx_where & 0x7)
+ if (fixP->fx_where & 0x7)
{
- if (fixp->fx_done)
+ if (fixP->fx_done)
value += 4;
else
- fixp->fx_r_type = BFD_RELOC_D30V_9_PCREL_R;
+ fixP->fx_r_type = BFD_RELOC_D30V_9_PCREL_R;
}
- check_size (value, 9, fixp->fx_file, fixp->fx_line);
+ check_size (value, 9, fixP->fx_file, fixP->fx_line);
insn |= ((value >> 3) & 0x3F) << 12;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
case BFD_RELOC_D30V_15:
- check_size (value, 15, fixp->fx_file, fixp->fx_line);
+ check_size (value, 15, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0xFFF;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
case BFD_RELOC_D30V_15_PCREL:
- if (fixp->fx_where & 0x7)
+ if (fixP->fx_where & 0x7)
{
- if (fixp->fx_done)
+ if (fixP->fx_done)
value += 4;
else
- fixp->fx_r_type = BFD_RELOC_D30V_15_PCREL_R;
+ fixP->fx_r_type = BFD_RELOC_D30V_15_PCREL_R;
}
- check_size (value, 15, fixp->fx_file, fixp->fx_line);
+ check_size (value, 15, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0xFFF;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
case BFD_RELOC_D30V_21:
- check_size (value, 21, fixp->fx_file, fixp->fx_line);
+ check_size (value, 21, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0x3FFFF;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
case BFD_RELOC_D30V_21_PCREL:
- if (fixp->fx_where & 0x7)
+ if (fixP->fx_where & 0x7)
{
- if (fixp->fx_done)
+ if (fixP->fx_done)
value += 4;
else
- fixp->fx_r_type = BFD_RELOC_D30V_21_PCREL_R;
+ fixP->fx_r_type = BFD_RELOC_D30V_21_PCREL_R;
}
- check_size (value, 21, fixp->fx_file, fixp->fx_line);
+ check_size (value, 21, fixP->fx_file, fixP->fx_line);
insn |= (value >> 3) & 0x3FFFF;
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
break;
default:
as_bad (_("line %d: unknown relocation type: 0x%x"),
- fixp->fx_line, fixp->fx_r_type);
+ fixP->fx_line, fixP->fx_r_type);
}
-
- return 0;
}
/* Called after the assembler has finished parsing the input file or
/* tc-310v.h -- Header file for tc-d30v.c.
- Copyright 1997, 1998, 2000 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
Written by Martin Hunt, Cygnus Support.
This file is part of GAS, the GNU Assembler.
#define md_operand(x)
-#define MD_APPLY_FIX3
-
-/* call md_pcrel_from_section, not md_pcrel_from */
-
+/* Call md_pcrel_from_section, not md_pcrel_from. */
extern long md_pcrel_from_section PARAMS ((fixS *fixp, segT sec));
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
/* tc-fr30.h -- Header file for tc-fr30.c.
- Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-#define MD_APPLY_FIX3
#define md_apply_fix3 gas_cgen_md_apply_fix3
#define obj_fix_adjustable(fixP) fr30_fix_adjustable (fixP)
#define TC_FORCE_RELOCATION(fix) fr30_force_relocation (fix)
extern int fr30_force_relocation PARAMS ((struct fix *));
-#define TC_HANDLES_FX_DONE
-
#define tc_gen_reloc gas_cgen_tc_gen_reloc
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
#endif
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
- fixS *fixP;
- valueT *valp;
-#else
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
-#endif
+ valueT *valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
-#ifdef BFD_ASSEMBLER
- long val = *valp;
-#endif
+ long val = * (long *) valP;
switch (fixP->fx_size)
{
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
if (fixP->fx_r_type == 0)
- {
- fixP->fx_r_type = fixP->fx_size == 4 ? R_H8500_IMM32 : R_H8500_IMM16;
- }
+ fixP->fx_r_type = fixP->fx_size == 4 ? R_H8500_IMM32 : R_H8500_IMM16;
switch (fixP->fx_r_type)
{
-
case R_H8500_IMM8:
case R_H8500_PCREL8:
*buf++ = val;
break;
default:
abort ();
-
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
-/*
-called just before address relaxation, return the length
-by which a fragment must grow to reach it's destination
-*/
+/* Called just before address relaxation, return the length
+ by which a fragment must grow to reach it's destination. */
+
int
md_estimate_size_before_relax (fragP, segment_type)
register fragS *fragP;
} \
}
-/* Variant of CHECK_FIELD for use in md_apply_fix and other places where
+/* Variant of CHECK_FIELD for use in md_apply_fix3 and other places where
the current file and line number are not valid. */
#define CHECK_FIELD_WHERE(FIELD, HIGH, LOW, FILENAME, LINE) \
/* Apply a fixup to an instruction. */
-int
-md_apply_fix (fixP, valp)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
valueT *valp;
+ segT seg ATTRIBUTE_UNUSED;
{
unsigned char *buf;
struct hppa_fix_struct *hppa_fixP;
offsetT new_val;
int insn, val, fmt;
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
+
/* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
never be "applied" (they are just markers). Likewise for
R_HPPA_BEGIN_BRTAB and R_HPPA_END_BRTAB. */
|| fixP->fx_r_type == R_HPPA_BEGIN_BRTAB
|| fixP->fx_r_type == R_HPPA_END_BRTAB
|| fixP->fx_r_type == R_HPPA_BEGIN_TRY)
- return 1;
+ return;
/* Disgusting. We must set fx_offset ourselves -- R_HPPA_END_TRY
fixups are considered not adjustable, which in turn causes
adjust_reloc_syms to not set fx_offset. Ugh. */
if (fixP->fx_r_type == R_HPPA_END_TRY)
{
- fixP->fx_offset = *valp;
- return 1;
+ fixP->fx_offset = * valP;
+ return;
}
#endif
#ifdef OBJ_ELF
if (fixP->fx_r_type == (int) R_PARISC_GNU_VTENTRY
|| fixP->fx_r_type == (int) R_PARISC_GNU_VTINHERIT)
- return 1;
+ return;
#endif
/* There should have been an HPPA specific fixup associated
as_bad_where (fixP->fx_file, fixP->fx_line,
_("no hppa_fixup entry for fixup type 0x%x"),
fixP->fx_r_type);
- return 0;
+ return;
}
buf = fixP->fx_frag->fr_literal + fixP->fx_where;
else if (fmt == 32
&& fixP->fx_addsy != NULL
&& S_GET_SEGMENT (fixP->fx_addsy) != bfd_com_section_ptr)
- new_val = hppa_field_adjust (*valp - S_GET_VALUE (fixP->fx_addsy),
+ new_val = hppa_field_adjust (* valP - S_GET_VALUE (fixP->fx_addsy),
0, hppa_fixP->fx_r_field);
#endif
else
- new_val = hppa_field_adjust (*valp, 0, hppa_fixP->fx_r_field);
+ new_val = hppa_field_adjust (* valP, 0, hppa_fixP->fx_r_field);
/* Handle pc-relative exceptions from above. */
if ((fmt == 12 || fmt == 17 || fmt == 22)
&& !arg_reloc_stub_needed (symbol_arg_reloc_info (fixP->fx_addsy),
hppa_fixP->fx_arg_reloc)
#ifdef OBJ_ELF
- && (*valp - 8 + 8192 < 16384
- || (fmt == 17 && *valp - 8 + 262144 < 524288)
- || (fmt == 22 && *valp - 8 + 8388608 < 16777216))
+ && (* valP - 8 + 8192 < 16384
+ || (fmt == 17 && * valP - 8 + 262144 < 524288)
+ || (fmt == 22 && * valP - 8 + 8388608 < 16777216))
#endif
#ifdef OBJ_SOM
- && (*valp - 8 + 262144 < 524288
- || (fmt == 22 && *valp - 8 + 8388608 < 16777216))
+ && (* valP - 8 + 262144 < 524288
+ || (fmt == 22 && * valP - 8 + 8388608 < 16777216))
#endif
&& !S_IS_EXTERNAL (fixP->fx_addsy)
&& !S_IS_WEAK (fixP->fx_addsy)
&& !(fixP->fx_subsy
&& S_GET_SEGMENT (fixP->fx_subsy) != hppa_fixP->segment))
{
- new_val = hppa_field_adjust (*valp, 0, hppa_fixP->fx_r_field);
+ new_val = hppa_field_adjust (* valP, 0, hppa_fixP->fx_r_field);
}
switch (fmt)
/* Handle some of the opcodes with the 'W' operand type. */
case 17:
{
- offsetT distance = *valp;
+ offsetT distance = * valP;
/* If this is an absolute branch (ie no link) with an out of
range target, then we want to complain. */
case 22:
{
- offsetT distance = *valp;
+ offsetT distance = * valP;
/* If this is an absolute branch (ie no link) with an out of
range target, then we want to complain. */
default:
as_bad_where (fixP->fx_file, fixP->fx_line,
_("Unknown relocation encountered in md_apply_fix."));
- return 0;
+ return;
}
/* Insert the relocation. */
bfd_put_32 (stdoutput, insn, buf);
- return 1;
}
/* Exactly what point is a PC-relative offset relative TO?
BFD_RELOC_UNUSED plus the operand index. This lets us easily
handle fixups for any operand type, although that is admittedly
not a very exciting feature. We pick a BFD reloc type in
- md_apply_fix. */
+ md_apply_fix3. */
for (i = 0; i < fc; i++)
{
const struct i370_operand *operand;
going on here ...
*/
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
segT seg;
{
- valueT value;
+ valueT value = * valP;
- value = *valuep;
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
{
/* Notes:
- Branches to labels will come in here with fixp->fx_pcrel set to 1
- and fixp->fx_subsy not null, and holding the value of the base
+ Branches to labels will come in here with fixP->fx_pcrel set to 1
+ and fixP->fx_subsy not null, and holding the value of the base
(i.e. the value of the .using). These we want to ignore.
'Strong' and 'weak' symbols will come in here with
- fixp->fx_pcrel==0, fixp->fx_addsy defined, and
+ fixP->fx_pcrel==0, fixP->fx_addsy defined, and
*valuep holding the value of the symbol.
'Strong' symbols will have S_GET_VALUE(fx_addsy) equal to zero,
subsy will hold the base address (i.e. the .using address).
*/
- if (fixp->fx_addsy->sy_used_in_reloc
- && S_GET_SEGMENT (fixp->fx_addsy) != absolute_section
- && S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
- && ! bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy)))
- value -= S_GET_VALUE (fixp->fx_addsy);
+ if (fixP->fx_addsy->sy_used_in_reloc
+ && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section
+ && S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
+ && ! bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)))
+ value -= S_GET_VALUE (fixP->fx_addsy);
#ifdef DEBUG
printf ("\nmd_apply_fix3: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
- S_GET_NAME (fixp->fx_addsy),
- fixp->fx_frag->fr_address + fixp->fx_where,
- fixp->fx_file, fixp->fx_line,
- S_GET_VALUE (fixp->fx_addsy), value);
+ S_GET_NAME (fixP->fx_addsy),
+ fixP->fx_frag->fr_address + fixP->fx_where,
+ fixP->fx_file, fixP->fx_line,
+ S_GET_VALUE (fixP->fx_addsy), value);
#endif
}
else
{
- fixp->fx_done = 1;
- return 1;
+ fixP->fx_done = 1;
+ return;
}
/* Apply fixups to operands. Note that there should be no relocations
for any operands, since no instruction ever takes an operand
that requires reloc. */
- if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex;
const struct i370_operand *operand;
char *where;
i370_insn_t insn;
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &i370_operands[opindex];
#ifdef DEBUG
printf ("\nmd_apply_fix3: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
operand->name,
- fixp->fx_frag->fr_address + fixp->fx_where,
- fixp->fx_file, fixp->fx_line,
+ fixP->fx_frag->fr_address + fixP->fx_where,
+ fixP->fx_file, fixP->fx_line,
value);
#endif
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again.
fisxp->fx_size is the length of the instruction. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn.i[0] = bfd_getb32 ((unsigned char *) where);
- if (6 <= fixp->fx_size)
- { /* deal with 48-bit insn's */
- insn.i[1] = bfd_getb32 (((unsigned char *) where)+4);
- }
+
+ if (6 <= fixP->fx_size)
+ /* Deal with 48-bit insn's. */
+ insn.i[1] = bfd_getb32 (((unsigned char *) where)+4);
+
insn = i370_insert_operand (insn, operand, (offsetT) value);
bfd_putb32 ((bfd_vma) insn.i[0], (unsigned char *) where);
- if (6 <= fixp->fx_size)
- { /* deal with 48-bit insn's */
- bfd_putb32 ((bfd_vma) insn.i[1], (((unsigned char *) where)+4));
- }
- /* we are done, right? right !! */
- fixp->fx_done = 1;
- if (fixp->fx_done)
- {
- /* Nothing else to do here. */
- return 1;
- }
+ if (6 <= fixP->fx_size)
+ /* Deal with 48-bit insn's. */
+ bfd_putb32 ((bfd_vma) insn.i[1], (((unsigned char *) where)+4));
+
+ /* We are done, right? right !! */
+ fixP->fx_done = 1;
+ if (fixP->fx_done)
+ /* Nothing else to do here. */
+ return;
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into
if ((operand->flags & I370_OPERAND_RELATIVE) != 0
&& operand->bits == 12
&& operand->shift == 0)
- fixp->fx_r_type = BFD_RELOC_I370_D12;
+ fixP->fx_r_type = BFD_RELOC_I370_D12;
else
#endif
{
/* Use expr_symbol_where to see if this is an expression
symbol. */
- if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (expr_symbol_where (fixP->fx_addsy, &sfile, &sline))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
"unresolved expression that must be resolved");
else
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
"unsupported relocation type");
- fixp->fx_done = 1;
- return 1;
+ fixP->fx_done = 1;
+ return;
}
}
else
{
/* We branch to here if the fixup is not to a symbol that
- * appears in an instruction operand, but is rather some
- * declared storage.
- */
+ appears in an instruction operand, but is rather some
+ declared storage. */
#ifdef OBJ_ELF
- i370_elf_validate_fix (fixp, seg);
+ i370_elf_validate_fix (fixP, seg);
#endif
#ifdef DEBUG
printf ("md_apply_fix3: reloc case %d in segment %s %s:%d\n",
- fixp->fx_r_type, segment_name (seg), fixp->fx_file, fixp->fx_line);
+ fixP->fx_r_type, segment_name (seg), fixP->fx_file, fixP->fx_line);
printf ("\tcurrent fixup value is 0x%x \n", value);
#endif
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_32:
case BFD_RELOC_CTOR:
- if (fixp->fx_pcrel)
- fixp->fx_r_type = BFD_RELOC_32_PCREL;
- /* fall through */
+ if (fixP->fx_pcrel)
+ fixP->fx_r_type = BFD_RELOC_32_PCREL;
+ /* Fall through. */
case BFD_RELOC_RVA:
case BFD_RELOC_32_PCREL:
case BFD_RELOC_32_BASEREL:
#ifdef DEBUG
printf ("\t32 bit relocation at 0x%x\n",
- fixp->fx_frag->fr_address + fixp->fx_where);
+ fixP->fx_frag->fr_address + fixP->fx_where);
#endif
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 4);
break;
case BFD_RELOC_LO16:
case BFD_RELOC_16:
- if (fixp->fx_pcrel)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (fixP->fx_pcrel)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
"cannot emit PC relative %s relocation%s%s",
- bfd_get_reloc_code_name (fixp->fx_r_type),
- fixp->fx_addsy != NULL ? " against " : "",
- (fixp->fx_addsy != NULL
- ? S_GET_NAME (fixp->fx_addsy)
+ bfd_get_reloc_code_name (fixP->fx_r_type),
+ fixP->fx_addsy != NULL ? " against " : "",
+ (fixP->fx_addsy != NULL
+ ? S_GET_NAME (fixP->fx_addsy)
: ""));
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 2);
break;
lis %r3,(L1-L2)@ha
where L1 and L2 are defined later. */
case BFD_RELOC_HI16:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value >> 16, 2);
break;
case BFD_RELOC_HI16_S:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
(value + 0x8000) >> 16, 2);
break;
case BFD_RELOC_8:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 1);
break;
default:
fprintf (stderr,
- "Gas failure, reloc value %d\n", fixp->fx_r_type);
+ "Gas failure, reloc value %d\n", fixP->fx_r_type);
fflush (stderr);
abort ();
}
}
- fixp->fx_addnumber = value;
-
- return 1;
+ fixP->fx_addnumber = value;
}
/* Generate a reloc for a fixup. */
/* tc-i370.h -- Header file for tc-i370.c.
- Copyright 1994, 1995, 1996, 1997, 1998, 2000
+ Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-/* We set the fx_done field appropriately in md_apply_fix. */
-#define TC_HANDLES_FX_DONE
-\f
-
-#ifdef OBJ_ELF
-
-/* Branch prediction relocations must force relocation. */
-#define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) 1
-
-/* Support for SHF_EXCLUDE and SHT_ORDERED */
-extern int i370_section_letter PARAMS ((int, char **));
-extern int i370_section_type PARAMS ((char *, size_t));
-extern int i370_section_word PARAMS ((char *, size_t));
-extern int i370_section_flags PARAMS ((int, int, int));
-
-#define md_elf_section_letter(LETTER, PTR_MSG) i370_section_letter (LETTER, PTR_MSG)
-#define md_elf_section_type(STR, LEN) i370_section_type (STR, LEN)
-#define md_elf_section_word(STR, LEN) i370_section_word (STR, LEN)
-#define md_elf_section_flags(FLAGS, ATTR, TYPE) i370_section_flags (FLAGS, ATTR, TYPE)
-
-#define tc_comment_chars i370_comment_chars
-extern const char *i370_comment_chars;
-
-/* We must never ever try to resolve references to externally visible
- symbols in the assembler, because the .o file might go into a shared
- library, and some other shared library might override that symbol. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
-
-#endif /* OBJ_ELF */
-
-/* call md_apply_fix3 with segment instead of md_apply_fix */
-#define MD_APPLY_FIX3
-
-/* call md_pcrel_from_section, not md_pcrel_from */
+/* Call md_pcrel_from_section, not md_pcrel_from. */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
the same (little-endian) format, so we don't need to care about which
we are handling. */
-int
-md_apply_fix3 (fixP, valp, seg)
+void
+md_apply_fix3 (fixP, valP, seg)
/* The fix we're to put in. */
fixS *fixP;
-
/* Pointer to the value of the bits. */
- valueT *valp;
-
+ valueT * valP;
/* Segment fix is from. */
segT seg ATTRIBUTE_UNUSED;
{
- register char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
- valueT value = *valp;
+ char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
+ valueT value = * valP;
#if defined (BFD_ASSEMBLER) && !defined (TE_Mach)
if (fixP->fx_pcrel)
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
- return 1;
+ return;
default:
break;
}
#endif /* defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) */
- *valp = value;
+ * valP = value;
#endif /* defined (BFD_ASSEMBLER) && !defined (TE_Mach) */
-#ifndef BFD_ASSEMBLER
- md_number_to_chars (p, value, fixP->fx_size);
-#else
/* Are we finished with this relocation now? */
- if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
fixP->fx_done = 1;
+#ifdef BFD_ASSEMBLER
else if (use_rela_relocations)
{
fixP->fx_no_overflow = 1;
value = 0;
}
- md_number_to_chars (p, value, fixP->fx_size);
#endif
-
- return 1;
+ md_number_to_chars (p, value, fixP->fx_size);
}
\f
#define MAX_LITTLENUMS 6
- fragP->fr_address \
- fragP->fr_fix));
-/* call md_apply_fix3 with segment instead of md_apply_fix */
-#define MD_APPLY_FIX3
-
void i386_print_statistics PARAMS ((FILE *));
#define tc_print_statistics i386_print_statistics
/* Attempt to simplify or eliminate a fixup. To indicate that a fixup
has been eliminated, set fix->fx_done. If fix->fx_addsy is non-NULL,
we will have to generate a reloc entry. */
-int
-md_apply_fix3 (fix, valuep, seg)
- fixS *fix;
- valueT *valuep;
+
+void
+md_apply_fix3 (fix, valP, seg)
+ fixS * fix;
+ valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{
-
char *buf;
- long val = (long) (*valuep);
+ long val = * (long *) valP
unsigned long insn;
valueT fup;
}
}
else if (fup & OP_IMM_U16)
- {
- abort ();
- }
+ abort ();
+
else if (fup & OP_IMM_SPLIT16)
{
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
fix->fx_done = 1;
}
}
-
- /* Return value ignored. */
- return 0;
}
/* Generate a machine dependent reloc from a fixup. */
/* tc-i860.h -- Header file for the i860.
- Copyright 1991, 1992, 1995, 1998, 2000
+ Copyright 1991, 1992, 1995, 1998, 2000, 2001
Free Software Foundation, Inc.
Brought back from the dead and completely reworked
#endif
#define WORKING_DOT_WORD
-#define MD_APPLY_FIX3
-#define TC_HANDLES_FX_DONE
#define DIFF_EXPR_OK
/* Permit temporary numeric labels. */
return fixP->fx_where + fixP->fx_frag->fr_address;
}
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
- fixS *fixP;
- valueT *valp;
-#else
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
-#endif
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
-#ifdef BFD_ASSEMBLER
- long val = *valp;
-#endif
+ long val = * (long *) valP;
char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
if (!fixP->fx_bit_fixP)
else
md_number_to_field (place, val, fixP->fx_bit_fixP);
-#ifdef BFD_ASSEMBLER
- return 0;
-#endif
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
#if defined(OBJ_AOUT) | defined(OBJ_BOUT)
fix = fix_new_exp (f, where, nbytes, exp, 0, code);
/* We need to store the byte order in effect in case we're going
to fix an 8 or 16 bit relocation (for which there no real
- relocs available). See md_apply_fix(). */
+ relocs available). See md_apply_fix3(). */
fix->tc_fix_data.bigendian = target_big_endian;
}
If fixp->fx_addsy is non-NULL, we'll have to generate a reloc entry
(if possible). */
-int
-md_apply_fix3 (fix, valuep, seg)
+
+void
+md_apply_fix3 (fix, valP, seg)
fixS *fix;
- valueT *valuep;
+ valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{
char *fixpos;
- valueT value = *valuep;
+ valueT value = * valP;
int adjust = 0;
fixpos = fix->fx_frag->fr_literal + fix->fx_where;
"%s must have a constant value",
elf64_ia64_operands[fix->tc_fix_data.opnd].desc);
fix->fx_done = 1;
- return 1;
+ return;
}
/* ??? This is a hack copied from tc-i386.c to make PCREL relocs
else
number_to_chars_littleendian (fixpos, value, fix->fx_size);
fix->fx_done = 1;
- return 1;
}
else
{
fix_insn (fix, elf64_ia64_operands + fix->tc_fix_data.opnd, value);
fix->fx_done = 1;
- return 1;
}
- return 1;
}
/* Generate the BFD reloc to be stuck in the object file from the
#define TARGET_ARCH bfd_arch_ia64
#define DOUBLESLASH_LINE_COMMENTS /* allow //-style comments */
-#define TC_HANDLES_FX_DONE
#define NEED_LITERAL_POOL /* need gp literal pool */
#define RELOC_REQUIRES_SYMBOL
#define MAX_MEM_FOR_RS_ALIGN_CODE (15 + 16)
-/* Call md_apply_fix3 with segment instead of md_apply_fix. */
-#define MD_APPLY_FIX3
-
#define WORKING_DOT_WORD /* don't do broken word processing for now */
#define ELF_TC_SPECIAL_SECTIONS \
#define FX_OPINFO_R_TYPE(f) ((f)->fx_cgen.opinfo)
/* Sort any unmatched HI16 relocs so that they immediately precede
- the corresponding LO16 reloc. This is called before md_apply_fix and
+ the corresponding LO16 reloc. This is called before md_apply_fix3 and
tc_gen_reloc. */
void
#define MAX_MEM_FOR_RS_ALIGN_CODE (1 + 2 + 4)
-#define MD_APPLY_FIX3
#define md_apply_fix3 gas_cgen_md_apply_fix3
#define obj_fix_adjustable(fixP) m32r_fix_adjustable(fixP)
HI16 relocs and queue them up for later sorting. */
#define md_cgen_record_fixup_exp m32r_cgen_record_fixup_exp
-#define TC_HANDLES_FX_DONE
-
#define tc_gen_reloc gas_cgen_tc_gen_reloc
#define tc_frob_file() m32r_frob_file ()
return md_relax_table[fragP->fr_subtype].rlx_length;
}
-int
-md_apply_fix (fixp, valuep)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT *valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *where;
- long value;
+ long value = * valP;
int op_type;
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- {
- value = *valuep;
- }
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
+
else
{
- value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ value = fixP->fx_offset;
+
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- {
- value -= S_GET_VALUE (fixp->fx_subsy);
- }
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
- {
- /* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
- _("Expression too complex."));
- }
+ /* We don't actually support subtracting a symbol. */
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("Expression too complex."));
}
}
- op_type = fixp->fx_r_type;
+ op_type = fixP->fx_r_type;
/* Patch the instruction with the resolved operand. Elf relocation
info will also be generated to take care of linker/loader fixups.
relax table, bcc, bra, bsr transformations)
The BFD_RELOC_32 is necessary for the support of --gstabs. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_32:
bfd_putb32 ((bfd_vma) value, (unsigned char *) where);
case BFD_RELOC_16_PCREL:
bfd_putb16 ((bfd_vma) value, (unsigned char *) where);
if (value < -65537 || value > 65535)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value out of 16-bit range."));
break;
((bfd_byte *) where)[0] = (bfd_byte) value;
if (value < -128 || value > 127)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("Value %ld too large for 8-bit PC-relative branch."),
value);
break;
case BFD_RELOC_M68HC11_3B:
if (value <= 0 || value > 8)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("Auto increment/decrement offset '%ld' is out of range."),
value);
if (where[0] & 0x8)
default:
as_fatal (_("Line %d: unknown relocation type: 0x%x."),
- fixp->fx_line, fixp->fx_r_type);
+ fixP->fx_line, fixP->fx_r_type);
}
-
- return 0;
}
static void s_mri_until PARAMS ((int));
static void s_mri_while PARAMS ((int));
static void s_mri_endw PARAMS ((int));
-static void md_apply_fix_2 PARAMS ((fixS *, offsetT));
static void md_convert_frag_1 PARAMS ((fragS *));
static int current_architecture;
my lord ghod hath spoken, so we do it this way. Excuse the ugly var
names. */
- register const struct m68k_opcode *ins;
- register struct m68k_incant *hack, *slak;
- register const char *retval = 0; /* empty string, or error msg text */
- register int i;
- register char c;
+ const struct m68k_opcode *ins;
+ struct m68k_incant *hack, *slak;
+ const char *retval = 0; /* empty string, or error msg text */
+ int i;
if (flag_mri)
{
number_to_chars_bigendian (buf, val, n);
}
-static void
-md_apply_fix_2 (fixP, val)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- offsetT val;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ valueT val = * valP;
addressT upper_limit;
offsetT lower_limit;
val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000;
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
+
#ifdef OBJ_ELF
if (fixP->fx_addsy)
{
switch (fixP->fx_size)
{
- /* The cast to offsetT below are necessary to make code correct for
- machines where ints are smaller than offsetT */
+ /* The cast to offsetT below are necessary to make code
+ correct for machines where ints are smaller than offsetT. */
case 1:
*buf++ = val;
upper_limit = 0x7f;
as_bad_where (fixP->fx_file, fixP->fx_line, _("invalid byte branch offset"));
}
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
- fixS *fixP;
- valueT *valp;
-{
- md_apply_fix_2 (fixP, (addressT) *valp);
- return 1;
-}
-#else
-void md_apply_fix (fixP, val)
- fixS *fixP;
- long val;
-{
- md_apply_fix_2 (fixP, (addressT) val);
-}
-#endif
-
/* *fragP has been relaxed to its final size, and now needs to have
the bytes inside it modified to conform to the new size There is UGLY
MAGIC here. ..
file itself. */
void
-md_apply_fix (fixp, val)
- fixS *fixp;
- long val;
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long value = * (long *) valP;
char *buf;
- buf = fixp->fx_frag->fr_literal + fixp->fx_where;
- fixp->fx_offset = 0;
+ buf = fixP->fx_frag->fr_literal + fixP->fx_where;
+ fixP->fx_offset = 0;
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case RELOC_IW16:
- fixp->fx_offset = val >> 16;
+ fixP->fx_offset = val >> 16;
buf[2] = val >> 8;
buf[3] = val;
break;
case RELOC_LO16:
- fixp->fx_offset = val >> 16;
+ fixP->fx_offset = val >> 16;
buf[0] = val >> 8;
buf[1] = val;
break;
case RELOC_HI16:
- fixp->fx_offset = val >> 16;
+ fixP->fx_offset = val >> 16;
buf[0] = val >> 8;
buf[1] = val;
break;
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
/* Where a PC relative offset is calculated from. On the m88k they
/* Applies the desired value to the specified location.
Also sets up addends for 'rela' type relocations. */
-int
-md_apply_fix3 (fixP, valp, segment)
+
+void
+md_apply_fix3 (fixP, valP, segment)
fixS * fixP;
- valueT * valp;
+ valueT * valP;
segT segment;
{
char * buf = fixP->fx_where + fixP->fx_frag->fr_literal;
char * file = fixP->fx_file ? fixP->fx_file : _("unknown");
const char * symname;
/* Note: use offsetT because it is signed, valueT is unsigned. */
- offsetT val = (offsetT) * valp;
+ offsetT val = * (offsetT *) valP;
symname = fixP->fx_addsy ? S_GET_NAME (fixP->fx_addsy) : _("<unknown>");
/* Save this for the addend in the relocation record. */
/* For ELF we can just return and let the reloc that will be generated
take care of everything. For COFF we still have to insert 'val'
into the insn since the addend field will be ignored. */
- return 0;
+ return;
#endif
}
else
}
break;
}
-
- return 0; /* Return value is ignored. */
}
void
/* This file is tc-mcore.h
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
/* Want the section information too... */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-#define MD_APPLY_FIX3 /* We want the segment as well. */
-
#ifdef OBJ_COFF
#define TARGET_FORMAT (target_big_endian ? "pe-mcore-big" : "pe-mcore-little")
extern void md_create_long_jump
PARAMS ((char *, addressT, addressT, fragS *, symbolS *));
extern void md_convert_frag PARAMS ((bfd *, segT, fragS *));
-extern int md_apply_fix3 PARAMS ((fixS *, valueT *, segT));
extern void md_operand PARAMS ((expressionS *));
extern int md_estimate_size_before_relax PARAMS ((fragS *, segT));
extern void md_number_to_chars PARAMS ((char *, valueT, int));
}
/* Sort any unmatched HI16_S relocs so that they immediately precede
- the corresponding LO reloc. This is called before md_apply_fix and
+ the corresponding LO reloc. This is called before md_apply_fix3 and
tc_gen_reloc. Unmatched HI16_S relocs can only be generated by
explicit use of the %hi modifier. */
/* Apply a fixup to the object file. */
-int
-md_apply_fix (fixP, valueP)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT *valueP;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
unsigned char *buf;
long insn;
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY);
- value = *valueP;
+ value = * valP;
/* If we aren't adjusting this fixup to be against the section
symbol, we need to adjust the value. */
{
valueT symval = S_GET_VALUE (fixP->fx_addsy);
+
value -= symval;
if (value != 0
&& ! fixP->fx_pcrel
}
#endif
- fixP->fx_addnumber = value; /* Remember value for tc_gen_reloc */
+ fixP->fx_addnumber = value; /* Remember value for tc_gen_reloc. */
if (fixP->fx_addsy == NULL && ! fixP->fx_pcrel)
fixP->fx_done = 1;
default:
internalError ();
}
-
- return 1;
}
#if 0
#define TC_FORCE_RELOCATION(fixp) mips_force_relocation (fixp)
extern int mips_force_relocation PARAMS ((struct fix *));
-/* md_apply_fix sets fx_done correctly. */
+/* md_apply_fix3 sets fx_done correctly. */
#define TC_HANDLE_FX_DONE 1
/* Register mask variables. These are set by the MIPS assembly code
Note that this function isn't called when linkrelax != 0. */
-int
-md_apply_fix3 (fixP, valp, segment)
+void
+md_apply_fix3 (fixP, valP, segment)
fixS * fixP;
- valueT * valp;
+ valueT * valP;
segT segment;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
/* Note: use offsetT because it is signed, valueT is unsigned. */
- offsetT val = (offsetT) * valp;
+ offsetT val = (offsetT) * valP;
segT symsec
= (fixP->fx_addsy == NULL
? absolute_section : S_GET_SEGMENT (fixP->fx_addsy));
&& symsec != real_reg_section)))))
{
fixP->fx_done = 0;
- return 0;
+ return;
}
else if (fixP->fx_r_type == BFD_RELOC_MMIX_LOCAL
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
{
/* These are never "fixed". */
fixP->fx_done = 0;
- return 0;
+ return;
}
else
/* We assume every other relocation is "fixed". */
case BFD_RELOC_MMIX_BASE_PLUS_OFFSET:
/* These are never "fixed". */
fixP->fx_done = 0;
- return 0;
+ return;
case BFD_RELOC_MMIX_PUSHJ_1:
case BFD_RELOC_MMIX_PUSHJ_2:
/* Make sure that for completed fixups we have the value around for
use by e.g. mmix_frob_file. */
fixP->fx_offset = val;
-
- return 0; /* Return value is ignored. */
}
/* A bsearch function for looking up a value against offsets for GREG
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
-#define MD_APPLY_FIX3
-
-#define TC_HANDLES_FX_DONE
-
#define md_section_align(seg, size) (size)
#define LISTING_HEADER "GAS for MMIX"
op++;
}
- /* This is both a simplification (we don't have to write md_apply_fix)
+ /* This is both a simplification (we don't have to write md_apply_fix3)
and support for future optimizations (branch shortening and similar
stuff in the linker. */
linkrelax = 1;
#endif
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
- segT seg;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS * fixP;
+ valueT * valP ATTRIBUTE_UNUSED;
+ segT seg ATTRIBUTE_UNUSED;
{
/* We shouldn't ever get here because linkrelax is nonzero. */
abort ();
- fixp->fx_done = 1;
- return 0;
+ fixP->fx_done = 1;
}
/* Insert an operand value into an instruction. */
/* tc-mn10200.h -- Header file for tc-mn10200.c.
- Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#define TARGET_FORMAT "elf32-mn10200"
-#define MD_APPLY_FIX3
#define md_operand(x)
/* Permit temporary numeric labels. */
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS * fixP;
+ valueT * valP;
segT seg;
{
- char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal;
+ char * fixpos = fixP->fx_where + fixP->fx_frag->fr_literal;
int size = 0;
- int value;
+ int value = (int) * valP;
- assert (fixp->fx_r_type < BFD_RELOC_UNUSED);
+ assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
/* This should never happen. */
if (seg->flags & SEC_ALLOC)
- abort ();
+ abort ();
/* The value we are passed in *valuep includes the symbol values.
Since we are using BFD_ASSEMBLER, if we are doing this relocation
*valuep, and must use fx_offset instead. However, if the reloc
is PC relative, we do want to use *valuep since it includes the
result of md_pcrel_from. */
- if (fixp->fx_addsy == (symbolS *) NULL || fixp->fx_pcrel)
- value = *valuep;
- else
- value = fixp->fx_offset;
+ if (fixP->fx_addsy != (symbolS *) NULL && ! fixP->fx_pcrel)
+ value = fixP->fx_offset;
/* If the fix is relative to a symbol which is not defined, or not
in the same segment as the fix, we cannot resolve it here. */
- if (fixp->fx_addsy != NULL
- && (! S_IS_DEFINED (fixp->fx_addsy)
- || (S_GET_SEGMENT (fixp->fx_addsy) != seg)))
+ if (fixP->fx_addsy != NULL
+ && (! S_IS_DEFINED (fixP->fx_addsy)
+ || (S_GET_SEGMENT (fixP->fx_addsy) != seg)))
{
- fixp->fx_done = 0;
- return 0;
+ fixP->fx_done = 0;
+ return;
}
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_8:
case BFD_RELOC_8_PCREL:
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
- fixp->fx_done = 0;
- return 1;
+ fixP->fx_done = 0;
+ return;
case BFD_RELOC_NONE:
default:
- as_bad_where (fixp->fx_file, fixp->fx_line,
- _("Bad relocation fixup type (%d)"), fixp->fx_r_type);
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("Bad relocation fixup type (%d)"), fixP->fx_r_type);
}
md_number_to_chars (fixpos, value, size);
/* If a symbol remains, pass the fixup, as a reloc, onto the linker. */
- if (fixp->fx_addsy == NULL)
- fixp->fx_done = 1;
-
- return 0;
+ if (fixP->fx_addsy == NULL)
+ fixP->fx_done = 1;
}
/* Return nonzero if the fixup in FIXP will require a relocation,
/* tc-mn10300.h -- Header file for tc-mn10300.c.
- Copyright 1996, 1997, 2000 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
#define TC_FORCE_RELOCATION(fixp) mn10300_force_relocation (fixp)
extern int mn10300_force_relocation PARAMS ((struct fix *));
-#define TC_HANDLES_FX_DONE
-
#define obj_fix_adjustable(fixP) mn10300_fix_adjustable (fixP)
extern boolean mn10300_fix_adjustable PARAMS ((struct fix *));
-#define MD_APPLY_FIX3 md_apply_fix3
-
/* Fixup debug sections since we will never relax them. */
#define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
out separate functions for each kind of thing we could be fixing.
They all get called from here. */
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
- fixS *fixP;
- valueT *valp;
-#else
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
-#endif
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
-#ifdef BFD_ASSEMBLER
- long val = *valp;
-#endif
+ long val = * (long *) valP;
fragS *fragP = fixP->fx_frag;
-
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
if (fix_bit_fixP (fixP))
- { /* Bitfields to fix, sigh. */
- md_number_to_field (buf, val, fix_bit_fixP (fixP));
- }
- else
- switch (fix_im_disp (fixP))
- {
- case 0: /* Immediate field. */
- md_number_to_imm (buf, val, fixP->fx_size);
- break;
+ /* Bitfields to fix, sigh. */
+ md_number_to_field (buf, val, fix_bit_fixP (fixP));
- case 1: /* Displacement field. */
- /* Calculate offset */
- {
- md_number_to_disp (buf,
- (fixP->fx_pcrel ? val + md_fix_pcrel_adjust (fixP)
- : val), fixP->fx_size);
- }
- break;
+ else switch (fix_im_disp (fixP))
+ {
+ case 0:
+ /* Immediate field. */
+ md_number_to_imm (buf, val, fixP->fx_size);
+ break;
- case 2: /* Pointer in a data object. */
- md_number_to_chars (buf, val, fixP->fx_size);
- break;
- }
-#ifdef BSD_ASSEMBLER
- return 1;
-#endif
+ case 1:
+ /* Displacement field. */
+ /* Calculate offset */
+ md_number_to_disp (buf,
+ (fixP->fx_pcrel ? val + md_fix_pcrel_adjust (fixP)
+ : val), fixP->fx_size);
+ break;
+
+ case 2:
+ /* Pointer in a data object. */
+ md_number_to_chars (buf, val, fixP->fx_size);
+ break;
+ }
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
\f
/* Convert a relaxed displacement to ditto in final output */
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-#define MD_APPLY_FIX3
#define md_apply_fix3 gas_cgen_md_apply_fix3
extern boolean openrisc_fix_adjustable PARAMS ((struct fix *));
extern int openrisc_force_relocation PARAMS ((struct fix *));
#define TC_FORCE_RELOCATION(fix) openrisc_force_relocation (fix)
-#define TC_HANDLES_FX_DONE
-
#define tc_gen_reloc gas_cgen_tc_gen_reloc
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
}
/* Fix up some data or instructions after we find out the value of a symbol
- that they reference. */
+ that they reference. Knows about order of bytes in address. */
-int /* Knows about order of bytes in address. */
-md_apply_fix (fixP, value)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT *value;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
valueT code;
valueT mask;
+ valueT val = * valP;
char *buf;
int shift;
int size;
}
if (fixP->fx_addsy != NULL)
- *value += symbol_get_bfdsym (fixP->fx_addsy)->section->vma;
+ val += symbol_get_bfdsym (fixP->fx_addsy)->section->vma;
/* *value += fixP->fx_addsy->bsym->section->vma; */
code &= ~mask;
- code |= (*value >> shift) & mask;
+ code |= (val >> shift) & mask;
number_to_chars_littleendian (buf, code, size);
- return 0;
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
long
*reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
- /* this is taken account for in md_apply_fix() */
+ /* This is taken account for in md_apply_fix3(). */
reloc->addend = -symbol_get_bfdsym (fixp->fx_addsy)->section->vma;
switch (fixp->fx_r_type)
/* Apply a fixup to the object file. */
-int
-md_apply_fix (fixP, valp)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT *valp;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- long val = *valp;
+ long val = * (long *) valP;
long max, min;
int shift;
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
- return 0;
+ return;
case BFD_RELOC_PJ_CODE_REL16:
if (val < -0x8000 || val >= 0x7fff)
if (max != 0 && (val < min || val > max))
as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range"));
- return 0;
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
/* Put number into target byte order. Always put values in an
BFD_RELOC_UNUSED plus the operand index. This lets us easily
handle fixups for any operand type, although that is admittedly
not a very exciting feature. We pick a BFD reloc type in
- md_apply_fix. */
+ md_apply_fix3. */
for (i = 0; i < fc; i++)
{
const struct powerpc_operand *operand;
that, we determine the correct reloc code and put it back in the
fixup. */
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT * valP;
segT seg ATTRIBUTE_UNUSED;
{
- valueT value;
+ valueT value = * valP;
#ifdef OBJ_ELF
- value = *valuep;
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
{
/* `*valuep' may contain the value of the symbol on which the reloc
will be based; we have to remove it. */
- if (symbol_used_in_reloc_p (fixp->fx_addsy)
- && S_GET_SEGMENT (fixp->fx_addsy) != absolute_section
- && S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
- && ! bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy)))
- value -= S_GET_VALUE (fixp->fx_addsy);
+ if (symbol_used_in_reloc_p (fixP->fx_addsy)
+ && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section
+ && S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
+ && ! bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)))
+ value -= S_GET_VALUE (fixP->fx_addsy);
/* FIXME: Why '+'? Better yet, what exactly is '*valuep'
supposed to be? I think this is related to various similar
FIXMEs in tc-i386.c and tc-sparc.c. */
- if (fixp->fx_pcrel)
- value += fixp->fx_frag->fr_address + fixp->fx_where;
+ if (fixP->fx_pcrel)
+ value += fixP->fx_frag->fr_address + fixP->fx_where;
}
else
- {
- fixp->fx_done = 1;
- }
+ fixP->fx_done = 1;
#else
/* FIXME FIXME FIXME: The value we are passed in *valuep includes
the symbol values. Since we are using BFD_ASSEMBLER, if we are
*valuep, and must use fx_offset instead. However, if the reloc
is PC relative, we do want to use *valuep since it includes the
result of md_pcrel_from. This is confusing. */
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- value = *valuep;
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
+
else
{
- value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ value = fixP->fx_offset;
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixp->fx_subsy);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
{
/* We can't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
}
}
#endif
- if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex;
const struct powerpc_operand *operand;
char *where;
unsigned long insn;
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &powerpc_operands[opindex];
&& operand->bits == 16
&& operand->shift == 0
&& operand->insert == NULL
- && fixp->fx_addsy != NULL
- && symbol_get_tc (fixp->fx_addsy)->subseg != 0
- && symbol_get_tc (fixp->fx_addsy)->class != XMC_TC
- && symbol_get_tc (fixp->fx_addsy)->class != XMC_TC0
- && S_GET_SEGMENT (fixp->fx_addsy) != bss_section)
+ && fixP->fx_addsy != NULL
+ && symbol_get_tc (fixP->fx_addsy)->subseg != 0
+ && symbol_get_tc (fixP->fx_addsy)->class != XMC_TC
+ && symbol_get_tc (fixP->fx_addsy)->class != XMC_TC0
+ && S_GET_SEGMENT (fixP->fx_addsy) != bss_section)
{
- value = fixp->fx_offset;
- fixp->fx_done = 1;
+ value = fixP->fx_offset;
+ fixP->fx_done = 1;
}
#endif
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (target_big_endian)
insn = bfd_getb32 ((unsigned char *) where);
else
insn = bfd_getl32 ((unsigned char *) where);
insn = ppc_insert_operand (insn, operand, (offsetT) value,
- fixp->fx_file, fixp->fx_line);
+ fixP->fx_file, fixP->fx_line);
if (target_big_endian)
bfd_putb32 ((bfd_vma) insn, (unsigned char *) where);
else
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
- if (fixp->fx_done)
- {
- /* Nothing else to do here. */
- return 1;
- }
+ if (fixP->fx_done)
+ /* Nothing else to do here. */
+ return;
- assert (fixp->fx_addsy != NULL);
+ assert (fixP->fx_addsy != NULL);
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into
if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
&& operand->bits == 26
&& operand->shift == 0)
- fixp->fx_r_type = BFD_RELOC_PPC_B26;
+ fixP->fx_r_type = BFD_RELOC_PPC_B26;
else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
&& operand->bits == 16
&& operand->shift == 0)
- fixp->fx_r_type = BFD_RELOC_PPC_B16;
+ fixP->fx_r_type = BFD_RELOC_PPC_B16;
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
&& operand->bits == 26
&& operand->shift == 0)
- fixp->fx_r_type = BFD_RELOC_PPC_BA26;
+ fixP->fx_r_type = BFD_RELOC_PPC_BA26;
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
&& operand->bits == 16
&& operand->shift == 0)
- fixp->fx_r_type = BFD_RELOC_PPC_BA16;
+ fixP->fx_r_type = BFD_RELOC_PPC_BA16;
#if defined (OBJ_XCOFF) || defined (OBJ_ELF)
else if ((operand->flags & PPC_OPERAND_PARENS) != 0
&& operand->bits == 16
&& operand->shift == 0
- && ppc_is_toc_sym (fixp->fx_addsy))
+ && ppc_is_toc_sym (fixP->fx_addsy))
{
- fixp->fx_r_type = BFD_RELOC_PPC_TOC16;
+ fixP->fx_r_type = BFD_RELOC_PPC_TOC16;
#ifdef OBJ_ELF
if (BFD_DEFAULT_TARGET_SIZE == 64
&& ppc_size == PPC_OPCODE_64
&& (operand->flags & PPC_OPERAND_DS) != 0)
- fixp->fx_r_type = BFD_RELOC_PPC64_TOC16_DS;
+ fixP->fx_r_type = BFD_RELOC_PPC64_TOC16_DS;
#endif
- fixp->fx_size = 2;
+ fixP->fx_size = 2;
if (target_big_endian)
- fixp->fx_where += 2;
+ fixP->fx_where += 2;
}
#endif /* defined (OBJ_XCOFF) || defined (OBJ_ELF) */
else
/* Use expr_symbol_where to see if this is an expression
symbol. */
- if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (expr_symbol_where (fixP->fx_addsy, &sfile, &sline))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
else
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unsupported relocation against %s"),
- S_GET_NAME (fixp->fx_addsy));
- fixp->fx_done = 1;
- return 1;
+ S_GET_NAME (fixP->fx_addsy));
+ fixP->fx_done = 1;
+ return;
}
}
else
{
#ifdef OBJ_ELF
- ppc_elf_validate_fix (fixp, seg);
+ ppc_elf_validate_fix (fixP, seg);
#endif
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_CTOR:
if (BFD_DEFAULT_TARGET_SIZE == 64 && ppc_size == PPC_OPCODE_64)
/* fall through */
case BFD_RELOC_32:
- if (fixp->fx_pcrel)
- fixp->fx_r_type = BFD_RELOC_32_PCREL;
+ if (fixP->fx_pcrel)
+ fixP->fx_r_type = BFD_RELOC_32_PCREL;
/* fall through */
case BFD_RELOC_RVA:
case BFD_RELOC_32_PCREL:
case BFD_RELOC_32_BASEREL:
case BFD_RELOC_PPC_EMB_NADDR32:
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 4);
break;
case BFD_RELOC_64:
ctor64:
- if (fixp->fx_pcrel)
- fixp->fx_r_type = BFD_RELOC_64_PCREL;
+ if (fixP->fx_pcrel)
+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
/* fall through */
case BFD_RELOC_64_PCREL:
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 8);
break;
case BFD_RELOC_PPC64_TOC16_HA:
#endif
#endif
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
{
- if (fixp->fx_addsy != NULL)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (fixP->fx_addsy != NULL)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("cannot emit PC relative %s relocation against %s"),
- bfd_get_reloc_code_name (fixp->fx_r_type),
- S_GET_NAME (fixp->fx_addsy));
+ bfd_get_reloc_code_name (fixP->fx_r_type),
+ S_GET_NAME (fixP->fx_addsy));
else
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("cannot emit PC relative %s relocation"),
- bfd_get_reloc_code_name (fixp->fx_r_type));
+ bfd_get_reloc_code_name (fixP->fx_r_type));
}
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 2);
break;
lis %r3,(L1-L2)@ha
where L1 and L2 are defined later. */
case BFD_RELOC_HI16:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HI (value), 2);
break;
case BFD_RELOC_HI16_S:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HA (value), 2);
break;
#ifdef OBJ_ELF
#if BFD_DEFAULT_TARGET_SIZE == 64
case BFD_RELOC_PPC64_HIGHER:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHER (value), 2);
break;
case BFD_RELOC_PPC64_HIGHER_S:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHERA (value), 2);
break;
case BFD_RELOC_PPC64_HIGHEST:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHEST (value), 2);
break;
case BFD_RELOC_PPC64_HIGHEST_S:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
PPC_HIGHESTA (value), 2);
break;
case BFD_RELOC_PPC64_TOC16_LO_DS:
case BFD_RELOC_PPC64_PLTGOT16_DS:
case BFD_RELOC_PPC64_PLTGOT16_LO_DS:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
{
- unsigned char *where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ unsigned char *where = fixP->fx_frag->fr_literal + fixP->fx_where;
unsigned long val;
if (target_big_endian)
/* Because SDA21 modifies the register field, the size is set to 4
bytes, rather than 2, so offset it here appropriately. */
case BFD_RELOC_PPC_EMB_SDA21:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where
+ ((target_big_endian) ? 2 : 0),
value, 2);
break;
case BFD_RELOC_8:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
+ md_number_to_chars (fixP->fx_frag->fr_literal + fixP->fx_where,
value, 1);
break;
case BFD_RELOC_24_PLT_PCREL:
case BFD_RELOC_PPC_LOCAL24PC:
- if (!fixp->fx_pcrel && !fixp->fx_done)
+ if (!fixP->fx_pcrel && !fixP->fx_done)
abort ();
- if (fixp->fx_done)
+ if (fixP->fx_done)
{
char *where;
unsigned long insn;
/* Fetch the instruction, insert the fully resolved operand
value, and stuff the instruction back again. */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
if (target_big_endian)
insn = bfd_getb32 ((unsigned char *) where);
else
insn = bfd_getl32 ((unsigned char *) where);
if ((value & 3) != 0)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("must branch to an address a multiple of 4"));
if ((offsetT) value < -0x40000000
|| (offsetT) value >= 0x40000000)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("@local or @plt branch destination is too far away, %ld bytes"),
(long) value);
insn = insn | (value & 0x03fffffc);
break;
case BFD_RELOC_VTABLE_INHERIT:
- fixp->fx_done = 0;
- if (fixp->fx_addsy
- && !S_IS_DEFINED (fixp->fx_addsy)
- && !S_IS_WEAK (fixp->fx_addsy))
- S_SET_WEAK (fixp->fx_addsy);
+ fixP->fx_done = 0;
+ if (fixP->fx_addsy
+ && !S_IS_DEFINED (fixP->fx_addsy)
+ && !S_IS_WEAK (fixP->fx_addsy))
+ S_SET_WEAK (fixP->fx_addsy);
break;
case BFD_RELOC_VTABLE_ENTRY:
- fixp->fx_done = 0;
+ fixP->fx_done = 0;
break;
#ifdef OBJ_ELF
/* Generated by reference to `sym@tocbase'. The sym is
ignored by the linker. */
case BFD_RELOC_PPC64_TOC:
- fixp->fx_done = 0;
+ fixP->fx_done = 0;
break;
#endif
#endif
default:
fprintf (stderr,
- _("Gas failure, reloc value %d\n"), fixp->fx_r_type);
+ _("Gas failure, reloc value %d\n"), fixP->fx_r_type);
fflush (stderr);
abort ();
}
}
#ifdef OBJ_ELF
- fixp->fx_addnumber = value;
+ fixP->fx_addnumber = value;
#else
- if (fixp->fx_r_type != BFD_RELOC_PPC_TOC16)
- fixp->fx_addnumber = 0;
+ if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16)
+ fixP->fx_addnumber = 0;
else
{
#ifdef TE_PE
- fixp->fx_addnumber = 0;
+ fixP->fx_addnumber = 0;
#else
/* We want to use the offset within the data segment of the
symbol, not the actual VMA of the symbol. */
- fixp->fx_addnumber =
- - bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixp->fx_addsy));
+ fixP->fx_addnumber =
+ - bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixP->fx_addsy));
#endif
}
#endif
-
- return 1;
}
/* Generate a reloc for a fixup. */
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-/* We set the fx_done field appropriately in md_apply_fix. */
-#define TC_HANDLES_FX_DONE
-
#define MAX_MEM_FOR_RS_ALIGN_CODE 4
#define HANDLE_ALIGN(FRAGP) \
if ((FRAGP)->fr_type == rs_align_code) \
#define DWARF2_LINE_MIN_INSN_LENGTH 4
#endif /* OBJ_ELF */
-/* call md_apply_fix3 with segment instead of md_apply_fix */
-#define MD_APPLY_FIX3
-
/* call md_pcrel_from_section, not md_pcrel_from */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
that, we determine the correct reloc code and put it back in the
fixup. */
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP;
+ valueT *valP;
segT seg;
{
char *where;
- valueT value;
+ valueT value = * valP;
- value = *valuep;
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
- if (fixp->fx_subsy != NULL)
+ if (fixP->fx_subsy != NULL)
{
- if ((fixp->fx_addsy != NULL
- && S_GET_SEGMENT (fixp->fx_addsy) == S_GET_SEGMENT (fixp->fx_subsy)
- && SEG_NORMAL (S_GET_SEGMENT (fixp->fx_addsy)))
- || (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section))
- value += S_GET_VALUE (fixp->fx_subsy);
- if (!S_IS_DEFINED (fixp->fx_subsy))
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if ((fixP->fx_addsy != NULL
+ && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy)
+ && SEG_NORMAL (S_GET_SEGMENT (fixP->fx_addsy)))
+ || (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section))
+ value += S_GET_VALUE (fixP->fx_subsy);
+ if (!S_IS_DEFINED (fixP->fx_subsy))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved fx_subsy symbol that must be resolved"));
- value -= S_GET_VALUE(fixp->fx_subsy);
+ value -= S_GET_VALUE(fixP->fx_subsy);
- if (S_GET_SEGMENT (fixp->fx_subsy) == seg && ! fixp->fx_pcrel)
- value += MD_PCREL_FROM_SECTION (fixp, seg);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == seg && ! fixP->fx_pcrel)
+ value += MD_PCREL_FROM_SECTION (fixP, seg);
}
- if (fixp->fx_addsy != NULL)
+ if (fixP->fx_addsy != NULL)
{
- if ((fixp->fx_subsy != NULL
- && S_GET_SEGMENT (fixp->fx_addsy) == S_GET_SEGMENT (fixp->fx_subsy)
- && SEG_NORMAL (S_GET_SEGMENT(fixp->fx_addsy)))
- || (S_GET_SEGMENT (fixp->fx_addsy) == seg
- && fixp->fx_pcrel && TC_RELOC_RTSYM_LOC_FIXUP (fixp))
- || (!fixp->fx_pcrel
- && S_GET_SEGMENT (fixp->fx_addsy) == absolute_section)
- || (S_GET_SEGMENT (fixp->fx_addsy) != undefined_section
- && !bfd_is_com_section (S_GET_SEGMENT (fixp->fx_addsy))
- && TC_FIX_ADJUSTABLE(fixp)))
- value -= S_GET_VALUE (fixp->fx_addsy);
-
- if (fixp->fx_pcrel)
- value += fixp->fx_frag->fr_address + fixp->fx_where;
+ if ((fixP->fx_subsy != NULL
+ && S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy)
+ && SEG_NORMAL (S_GET_SEGMENT(fixP->fx_addsy)))
+ || (S_GET_SEGMENT (fixP->fx_addsy) == seg
+ && fixP->fx_pcrel && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
+ || (!fixP->fx_pcrel
+ && S_GET_SEGMENT (fixP->fx_addsy) == absolute_section)
+ || (S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
+ && !bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy))
+ && TC_FIX_ADJUSTABLE(fixP)))
+ value -= S_GET_VALUE (fixP->fx_addsy);
+
+ if (fixP->fx_pcrel)
+ value += fixP->fx_frag->fr_address + fixP->fx_where;
}
else
- fixp->fx_done = 1;
+ fixP->fx_done = 1;
- if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
const struct s390_operand *operand;
int opindex;
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &s390_operands[opindex];
- if (fixp->fx_done)
+ if (fixP->fx_done)
{
/* Insert the fully resolved operand value. */
s390_insert_operand (where, operand, (offsetT) value,
- fixp->fx_file, fixp->fx_line);
-
- return 1;
+ fixP->fx_file, fixP->fx_line);
+ return;
}
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into
relocs. */
- fixp->fx_offset = value;
+ fixP->fx_offset = value;
if (operand->bits == 12 && operand->shift == 20)
{
- fixp->fx_size = 2;
- fixp->fx_where += 2;
- fixp->fx_r_type = BFD_RELOC_390_12;
+ fixP->fx_size = 2;
+ fixP->fx_where += 2;
+ fixP->fx_r_type = BFD_RELOC_390_12;
}
else if (operand->bits == 12 && operand->shift == 36)
{
- fixp->fx_size = 2;
- fixp->fx_where += 4;
- fixp->fx_r_type = BFD_RELOC_390_12;
+ fixP->fx_size = 2;
+ fixP->fx_where += 4;
+ fixP->fx_r_type = BFD_RELOC_390_12;
}
else if (operand->bits == 8 && operand->shift == 8)
{
- fixp->fx_size = 1;
- fixp->fx_where += 1;
- fixp->fx_r_type = BFD_RELOC_8;
+ fixP->fx_size = 1;
+ fixP->fx_where += 1;
+ fixP->fx_r_type = BFD_RELOC_8;
}
else if (operand->bits == 16 && operand->shift == 16)
{
- fixp->fx_size = 2;
- fixp->fx_where += 2;
+ fixP->fx_size = 2;
+ fixP->fx_where += 2;
if (operand->flags & S390_OPERAND_PCREL)
{
- fixp->fx_r_type = BFD_RELOC_390_PC16DBL;
- fixp->fx_offset += 2;
+ fixP->fx_r_type = BFD_RELOC_390_PC16DBL;
+ fixP->fx_offset += 2;
}
else
- fixp->fx_r_type = BFD_RELOC_16;
+ fixP->fx_r_type = BFD_RELOC_16;
}
else if (operand->bits == 32 && operand->shift == 16
&& (operand->flags & S390_OPERAND_PCREL))
{
- fixp->fx_size = 4;
- fixp->fx_where += 2;
- fixp->fx_offset += 2;
- fixp->fx_r_type = BFD_RELOC_390_PC32DBL;
+ fixP->fx_size = 4;
+ fixP->fx_where += 2;
+ fixP->fx_offset += 2;
+ fixP->fx_r_type = BFD_RELOC_390_PC32DBL;
}
else
{
/* Use expr_symbol_where to see if this is an expression
symbol. */
- if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (expr_symbol_where (fixP->fx_addsy, &sfile, &sline))
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
else
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unsupported relocation type"));
- fixp->fx_done = 1;
- return 1;
+ fixP->fx_done = 1;
+ return;
}
}
else
{
- switch (fixp->fx_r_type)
+ switch (fixP->fx_r_type)
{
case BFD_RELOC_8:
- if (fixp->fx_pcrel)
+ if (fixP->fx_pcrel)
abort ();
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, 1);
break;
case BFD_RELOC_390_12:
case BFD_RELOC_390_GOT12:
- if (fixp->fx_done)
+ if (fixP->fx_done)
{
unsigned short mop;
case BFD_RELOC_GPREL16:
case BFD_RELOC_16_GOT_PCREL:
case BFD_RELOC_16_GOTOFF:
- if (fixp->fx_pcrel)
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ if (fixP->fx_pcrel)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
"cannot emit PC relative %s relocation%s%s",
- bfd_get_reloc_code_name (fixp->fx_r_type),
- fixp->fx_addsy != NULL ? " against " : "",
- (fixp->fx_addsy != NULL
- ? S_GET_NAME (fixp->fx_addsy)
+ bfd_get_reloc_code_name (fixP->fx_r_type),
+ fixP->fx_addsy != NULL ? " against " : "",
+ (fixP->fx_addsy != NULL
+ ? S_GET_NAME (fixP->fx_addsy)
: ""));
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, 2);
break;
case BFD_RELOC_390_GOT16:
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, 2);
break;
case BFD_RELOC_390_PC16DBL:
case BFD_RELOC_390_PLT16DBL:
value += 2;
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, (offsetT) value >> 1, 2);
break;
case BFD_RELOC_32:
- if (fixp->fx_pcrel)
- fixp->fx_r_type = BFD_RELOC_32_PCREL;
+ if (fixP->fx_pcrel)
+ fixP->fx_r_type = BFD_RELOC_32_PCREL;
else
- fixp->fx_r_type = BFD_RELOC_32;
- if (fixp->fx_done)
+ fixP->fx_r_type = BFD_RELOC_32;
+ if (fixP->fx_done)
md_number_to_chars (where, value, 4);
break;
case BFD_RELOC_32_PCREL:
case BFD_RELOC_32_BASEREL:
- fixp->fx_r_type = BFD_RELOC_32_PCREL;
- if (fixp->fx_done)
+ fixP->fx_r_type = BFD_RELOC_32_PCREL;
+ if (fixP->fx_done)
md_number_to_chars (where, value, 4);
break;
case BFD_RELOC_32_GOT_PCREL:
case BFD_RELOC_390_PLT32:
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, 4);
break;
case BFD_RELOC_390_PC32DBL:
case BFD_RELOC_390_GOTPCDBL:
case BFD_RELOC_390_GOTENT:
value += 2;
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, (offsetT) value >> 1, 4);
break;
case BFD_RELOC_32_GOTOFF:
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, sizeof (int));
break;
case BFD_RELOC_390_GOT64:
case BFD_RELOC_390_PLT64:
- if (fixp->fx_done)
+ if (fixP->fx_done)
md_number_to_chars (where, value, 8);
break;
case BFD_RELOC_64:
- if (fixp->fx_pcrel)
- fixp->fx_r_type = BFD_RELOC_64_PCREL;
+ if (fixP->fx_pcrel)
+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
else
- fixp->fx_r_type = BFD_RELOC_64;
- if (fixp->fx_done)
+ fixP->fx_r_type = BFD_RELOC_64;
+ if (fixP->fx_done)
md_number_to_chars (where, value, 8);
break;
case BFD_RELOC_64_PCREL:
- fixp->fx_r_type = BFD_RELOC_64_PCREL;
- if (fixp->fx_done)
+ fixP->fx_r_type = BFD_RELOC_64_PCREL;
+ if (fixP->fx_done)
md_number_to_chars (where, value, 8);
break;
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
- fixp->fx_done = 0;
- return 1;
+ fixP->fx_done = 0;
+ return;
default:
{
- const char *reloc_name = bfd_get_reloc_code_name (fixp->fx_r_type);
+ const char *reloc_name = bfd_get_reloc_code_name (fixP->fx_r_type);
if (reloc_name != NULL)
fprintf (stderr, "Gas failure, reloc type %s\n", reloc_name);
else
- fprintf (stderr, "Gas failure, reloc type #%i\n", fixp->fx_r_type);
+ fprintf (stderr, "Gas failure, reloc type #%i\n", fixP->fx_r_type);
fflush (stderr);
abort ();
}
}
- fixp->fx_offset = value;
+ fixP->fx_offset = value;
}
-
- return 1;
}
/* Generate a reloc for a fixup. */
/* We don't need to handle .word strangely. */
#define WORKING_DOT_WORD
-/* We set the fx_done field appropriately in md_apply_fix. */
-#define TC_HANDLES_FX_DONE
-
#define md_number_to_chars number_to_chars_bigendian
#define md_do_align(n, fill, len, max, around) \
- fragP->fr_address \
- fragP->fr_fix));
-/* call md_apply_fix3 with segment instead of md_apply_fix */
-#define MD_APPLY_FIX3
-
/* call md_pcrel_from_section, not md_pcrel_from */
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section(FIXP, SEC)
extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
}
/* Called after relaxing. Set the correct sizes of the fragments, and
- create relocs so that md_apply_fix will fill in the correct values. */
+ create relocs so that md_apply_fix3 will fill in the correct values. */
void
md_convert_frag (headers, seg, fragP)
/* Apply a fixup to the object file. */
-#ifdef BFD_ASSEMBLER
-int
-md_apply_fix (fixP, valp)
- fixS *fixP;
- valueT *valp;
-#else
void
-md_apply_fix (fixP, val)
- fixS *fixP;
- long val;
-#endif
+md_apply_fix3 (fixP, valP, seg)
+ fixS * fixP;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
int lowbyte = target_big_endian ? 1 : 0;
int highbyte = target_big_endian ? 0 : 1;
-#ifdef BFD_ASSEMBLER
- long val = *valp;
-#endif
+ long val = * (long *) valP;
long max, min;
int shift;
we need. FIXME. */
case BFD_RELOC_16:
bfd_set_error (bfd_error_bad_value);
- return false;
+ return;
case BFD_RELOC_8:
bfd_set_error (bfd_error_bad_value);
- return false;
+ return;
}
}
case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY:
fixP->fx_done = 0;
-#ifdef BFD_ASSEMBLER
- return 0;
-#else
return;
-#endif
#ifdef OBJ_ELF
case BFD_RELOC_32_PLT_PCREL:
/* Make the jump instruction point to the address of the operand. At
runtime we merely add the offset to the actual PLT entry. */
- *valp = 0xfffffffc;
+ * valP = 0xfffffffc;
break;
case BFD_RELOC_SH_GOTPC:
earlier versions of the PIC patches, the pcrel_adjust field
was used to store the correction, but since the expression is
not pcrel, I felt it would be confusing to do it this way. */
- *valp -= 1;
+ * valP -= 1;
md_number_to_chars (buf, val, 4);
break;
case BFD_RELOC_32_GOT_PCREL:
- *valp = 0; /* Fully resolved at runtime. No addend. */
+ * valP = 0; /* Fully resolved at runtime. No addend. */
md_number_to_chars (buf, 0, 4);
break;
if (max != 0 && (val < min || val > max))
as_bad_where (fixP->fx_file, fixP->fx_line, _("offset out of range"));
-#ifdef BFD_ASSEMBLER
- return 0;
-#endif
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
/* Called just before address relaxation. Return the length
{
/* We can't store the offset in the object file, since this
reloc does not take up any space, so we store it in r_offset.
- The fx_addnumber field was set in md_apply_fix. */
+ The fx_addnumber field was set in md_apply_fix3. */
intr->r_offset = fix->fx_addnumber;
}
else if (fix->fx_r_type == BFD_RELOC_SH_COUNT)
/* Whether or not the target is big endian */
extern int target_big_endian;
-
#ifdef TE_LINUX
#define TARGET_FORMAT (!target_big_endian ? "elf32-sh-linux" : "elf32-shbig-linux")
#else
/* Apply a fixS to the frags, now that we know the value it ought to
hold. */
-int
-md_apply_fix3 (fixP, value, segment)
+void
+md_apply_fix3 (fixP, valP, segment)
fixS *fixP;
- valueT *value;
+ valueT *valP;
segT segment;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- offsetT val;
+ offsetT val = * (offsetT *) valP;
long insn;
- val = *value;
-
assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
fixP->fx_addnumber = val; /* Remember value for emit_reloc. */
&& ! bfd_is_com_section (seg))
fixP->fx_addnumber -= S_GET_VALUE (sym);
- return 1;
+ return;
}
#endif
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{
fixP->fx_done = 0;
- return 1;
+ return;
}
else
{
case BFD_RELOC_SPARC_LM22:
case BFD_RELOC_HI22:
if (!fixP->fx_addsy)
- {
- insn |= (val >> 10) & 0x3fffff;
- }
+ insn |= (val >> 10) & 0x3fffff;
else
- {
- /* FIXME: Need comment explaining why we do this. */
- insn &= ~0xffff;
- }
+ /* FIXME: Need comment explaining why we do this. */
+ insn &= ~0xffff;
break;
case BFD_RELOC_SPARC22:
case BFD_RELOC_LO10:
if (!fixP->fx_addsy)
- {
- insn |= val & 0x3ff;
- }
+ insn |= val & 0x3ff;
else
- {
- /* FIXME: Need comment explaining why we do this. */
- insn &= ~0xff;
- }
+ /* FIXME: Need comment explaining why we do this. */
+ insn &= ~0xff;
break;
case BFD_RELOC_SPARC_OLO10:
/* Are we finished with this relocation now? */
if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
fixP->fx_done = 1;
-
- return 1;
}
/* Translate internal representation of relocation info to BFD target
/* tc-sparc.h - Macros and type defines for the sparc.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
extern int elf32_sparc_force_relocation PARAMS ((struct fix *));
#endif
-#define MD_APPLY_FIX3
-#define TC_HANDLES_FX_DONE
-
#ifdef OBJ_ELF
/* Keep relocations against global symbols. Don't turn them into
relocations against sections. This is required for the dynamic
#endif /* comment */
void
-tc_apply_fix (fixP, val)
- fixS *fixP;
- long val;
+md_apply_fix3 (fixP, valP, seg)
+ fixS *fixP ATTRIBUTE_UNUSED;
+ valueT * valP ATTRIBUTE_UNUSED;
+ segT seg ATTRIBUTE_UNUSED:
{
- /* should never be called */
+ /* Should never be called. */
know (0);
}
debug ("In md_convert_frag()\n");
}
-int
-md_apply_fix (fixP, valP)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
valueT *valP;
+ segT seg ATTRIBUTE_UNUSED;
{
valueT value = *valP;
debug ("fx_offset = %d\n", (int) fixP->fx_offset);
{
char *buf = fixP->fx_frag->fr_literal + fixP->fx_where;
+
value /= INSN_SIZE;
if (fixP->fx_size == 1)
- { /* Special fix for LDP instruction. */
- value = (value & 0x00FF0000) >> 16;
- }
+ /* Special fix for LDP instruction. */
+ value = (value & 0x00FF0000) >> 16;
+
debug ("new value = %ld\n", (long) value);
md_number_to_chars (buf, value, fixP->fx_size);
}
- return 1;
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
If fixp->fx_addsy is non-NULL, we'll have to generate a reloc entry. */
-int
-md_apply_fix (fixP, valP)
+void
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- valueT *valP;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
- valueT val = *valP;
+ valueT val = * valP;
switch (fixP->fx_r_type)
{
default:
as_fatal ("Bad relocation type: 0x%02x", fixP->fx_r_type);
- return 0;
+ return;
case BFD_RELOC_TIC54X_MS7_OF_23:
val = (val >> 16) & 0x7F;
/* Fall through. */
break;
}
- return 0; /* Return value is ignored. */
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
/* This is our chance to record section alignment
To indicate that a fixup has been eliminated, set fixP->fx_done. */
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *dest = fixP->fx_frag->fr_literal + fixP->fx_where;
int overflow;
fixP->fx_r_type);
break;
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
\f
/* Functions concerning relocs. */
BFD_RELOC_UNUSED plus the operand index. This lets us easily
handle fixups for any operand type, although that is admittedly
not a very exciting feature. We pick a BFD reloc type in
- md_apply_fix. */
+ md_apply_fix3. */
for (i = 0; i < fc; i++)
{
const struct v850_operand *operand;
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-int
-md_apply_fix3 (fixp, valuep, seg)
- fixS *fixp;
- valueT *valuep;
+void
+md_apply_fix3 (fixP, valueP, seg)
+ fixS *fixP;
+ valueT *valueP;
segT seg ATTRIBUTE_UNUSED;
{
- valueT value;
+ valueT value = * valueP;
char *where;
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+ if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+ || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{
- fixp->fx_done = 0;
- return 1;
+ fixP->fx_done = 0;
+ return;
}
- if (fixp->fx_addsy == (symbolS *) NULL)
- {
- value = *valuep;
- fixp->fx_done = 1;
- }
- else if (fixp->fx_pcrel)
- value = *valuep;
+ if (fixP->fx_addsy == (symbolS *) NULL)
+ fixP->fx_done = 1;
+
+ else if (fixP->fx_pcrel)
+ ;
+
else
{
- value = fixp->fx_offset;
- if (fixp->fx_subsy != (symbolS *) NULL)
+ value = fixP->fx_offset;
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- if (S_GET_SEGMENT (fixp->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixp->fx_subsy);
+ if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
+ value -= S_GET_VALUE (fixP->fx_subsy);
else
{
/* We don't actually support subtracting a symbol. */
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("expression too complex"));
}
}
}
- if ((int) fixp->fx_r_type >= (int) BFD_RELOC_UNUSED)
+ if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex;
const struct v850_operand *operand;
unsigned long insn;
- opindex = (int) fixp->fx_r_type - (int) BFD_RELOC_UNUSED;
+ opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
operand = &v850_operands[opindex];
/* Fetch the instruction, insert the fully resolved operand
Note the instruction has been stored in little endian
format! */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
insn = bfd_getl32 ((unsigned char *) where);
insn = v850_insert_operand (insn, operand, (offsetT) value,
- fixp->fx_file, fixp->fx_line, NULL);
+ fixP->fx_file, fixP->fx_line, NULL);
bfd_putl32 ((bfd_vma) insn, (unsigned char *) where);
- if (fixp->fx_done)
- {
- /* Nothing else to do here. */
- return 1;
- }
+ if (fixP->fx_done)
+ /* Nothing else to do here. */
+ return;
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into relocs. */
if (operand->bits == 22)
- fixp->fx_r_type = BFD_RELOC_V850_22_PCREL;
+ fixP->fx_r_type = BFD_RELOC_V850_22_PCREL;
else if (operand->bits == 9)
- fixp->fx_r_type = BFD_RELOC_V850_9_PCREL;
+ fixP->fx_r_type = BFD_RELOC_V850_9_PCREL;
else
{
#if 0
fprintf (stderr, "bits: %d, insn: %x\n", operand->bits, insn);
#endif
- as_bad_where (fixp->fx_file, fixp->fx_line,
+ as_bad_where (fixP->fx_file, fixP->fx_line,
_("unresolved expression that must be resolved"));
- fixp->fx_done = 1;
- return 1;
+ fixP->fx_done = 1;
+ return;
}
}
- else if (fixp->fx_done)
+ else if (fixP->fx_done)
{
/* We still have to insert the value into memory! */
- where = fixp->fx_frag->fr_literal + fixp->fx_where;
+ where = fixP->fx_frag->fr_literal + fixP->fx_where;
- if (fixp->fx_size == 1)
+ if (fixP->fx_size == 1)
*where = value & 0xff;
- else if (fixp->fx_size == 2)
+ else if (fixP->fx_size == 2)
bfd_putl16 (value & 0xffff, (unsigned char *) where);
- else if (fixp->fx_size == 4)
+ else if (fixP->fx_size == 4)
bfd_putl32 (value, (unsigned char *) where);
}
- fixp->fx_addnumber = value;
- return 1;
+ fixP->fx_addnumber = value;
}
\f
/* Parse a cons expression. We have to handle hi(), lo(), etc
/* The target BFD format. */
#define TARGET_FORMAT "elf32-v850"
-#define MD_APPLY_FIX3
#define md_operand(x)
#define obj_fix_adjustable(fixP) v850_fix_adjustable(fixP)
that they reference. */
void /* Knows about order of bytes in address. */
-md_apply_fix (fixP, value)
- fixS *fixP;
- long value;
+md_apply_fix3 (fixP, valueP, seg)
+ fixS * fixP;
+ valueT * valueP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ valueT value = * valueP;
+
number_to_chars_littleendian (fixP->fx_where + fixP->fx_frag->fr_literal,
- (valueT) value, fixP->fx_size);
+ value, fixP->fx_size);
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
long
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, seg)
fixS *fixP;
- long val;
+ vauleT * valP;
+ segT seg ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
int addr = fixP->fx_frag->fr_address + fixP->fx_where;
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
-/* Put number into target byte order */
+/* Put number into target byte order. */
void
md_number_to_chars (ptr, use, nbytes)
}
void
-md_apply_fix (fixP, val)
+md_apply_fix3 (fixP, valP, segment)
fixS *fixP;
- long val;
+ valueT * valP;
+ segT segment ATTRIBUTE_UNUSED;
{
+ long val = * (long *) valP;
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
switch (fixP->fx_r_type)
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
@item fx_addnumber
Some CPU backends use this field to convey information between
-@code{md_apply_fix} and @code{tc_gen_reloc}. The machine independent code does
+@code{md_apply_fix3} and @code{tc_gen_reloc}. The machine independent code does
not use it.
@item fx_next
@code{md_convert_frag} the frag information may or may not be necessary, as may
the resolved values of the symbols. The default value is 1.
-@item md_apply_fix
-@cindex md_apply_fix
+@item md_apply_fix3
+@cindex md_apply_fix3
GAS will call this for each fixup. It should store the correct value in the
object file. @code{fixup_segment} performs a generic overflow check on the
-@code{valueT *val} argument after @code{md_apply_fix} returns. If the overflow
-check is relevant for the target machine, then @code{md_apply_fix} should
+@code{valueT *val} argument after @code{md_apply_fix3} returns. If the overflow
+check is relevant for the target machine, then @code{md_apply_fix3} should
modify @code{valueT *val}, typically to the value stored in the object file.
@item TC_HANDLES_FX_DONE
@cindex TC_HANDLES_FX_DONE
-If this macro is defined, it means that @code{md_apply_fix} correctly sets the
+If this macro is defined, it means that @code{md_apply_fix3} correctly sets the
@code{fx_done} field in the fixup.
@item tc_gen_reloc
void md_operand PARAMS ((expressionS * expressionP));
#endif
-#ifdef MD_APPLY_FIX3
-int md_apply_fix3 PARAMS ((fixS * fixP, valueT *val, segT seg));
-#endif
+void md_apply_fix3 PARAMS ((fixS *, valueT *, segT));
+
#ifdef BFD_ASSEMBLER
-int md_apply_fix PARAMS ((fixS * fixP, valueT *val));
#ifndef md_convert_frag
void md_convert_frag PARAMS ((bfd * headers, segT sec, fragS * fragP));
#endif
extern arelent **tc_gen_reloc PARAMS ((asection *, fixS *));
#endif
#else /* not BFD_ASSEMBLER */
-void md_apply_fix PARAMS ((fixS * fixP, long val));
#ifndef md_convert_frag
void md_convert_frag PARAMS ((object_headers * headers, segT, fragS * fragP));
#endif
Go through all the fixS's in a segment and see which ones can be
handled now. (These consist of fixS where we have since discovered
the value of a symbol, or the address of the frag involved.)
- For each one, call md_apply_fix to put the fix into the frag data.
+ For each one, call md_apply_fix3 to put the fix into the frag data.
Result is a count of how many relocation structs will be needed to
handle the remaining fixS's that we couldn't completely handle here.
}
if (!fixP->fx_done)
- {
-#ifdef MD_APPLY_FIX3
- md_apply_fix3 (fixP, &add_number, this_segment_type);
-#else
-#ifdef BFD_ASSEMBLER
- md_apply_fix (fixP, &add_number);
-#else
- md_apply_fix (fixP, add_number);
-#endif
-#endif
-
-#ifndef TC_HANDLES_FX_DONE
- /* If the tc-* files haven't been converted, assume it's handling
- it the old way, where a null fx_addsy means that the fix has
- been applied completely, and no further work is needed. */
- if (fixP->fx_addsy == 0 && fixP->fx_pcrel == 0)
- fixP->fx_done = 1;
-#endif
- }
+ md_apply_fix3 (fixP, & add_number, this_segment_type);
if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
{