aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-coff.c6
-rw-r--r--gas/config/obj-coff.h7
-rw-r--r--gas/config/tc-a29k.c19
-rw-r--r--gas/config/tc-alpha.c27
-rw-r--r--gas/config/tc-alpha.h4
-rw-r--r--gas/config/tc-arc.c23
-rw-r--r--gas/config/tc-arc.h4
-rw-r--r--gas/config/tc-arm.c14
-rw-r--r--gas/config/tc-arm.h4
-rw-r--r--gas/config/tc-avr.c73
-rw-r--r--gas/config/tc-avr.h6
-rw-r--r--gas/config/tc-cris.c15
-rw-r--r--gas/config/tc-cris.h4
-rw-r--r--gas/config/tc-d10v.c59
-rw-r--r--gas/config/tc-d10v.h6
-rw-r--r--gas/config/tc-d30v.c93
-rw-r--r--gas/config/tc-d30v.h7
-rw-r--r--gas/config/tc-fr30.h5
-rw-r--r--gas/config/tc-h8300.c19
-rw-r--r--gas/config/tc-h8500.c22
-rw-r--r--gas/config/tc-hppa.c43
-rw-r--r--gas/config/tc-i370.c147
-rw-r--r--gas/config/tc-i370.h42
-rw-r--r--gas/config/tc-i386.c26
-rw-r--r--gas/config/tc-i386.h3
-rw-r--r--gas/config/tc-i860.c20
-rw-r--r--gas/config/tc-i860.h4
-rw-r--r--gas/config/tc-i960.c21
-rw-r--r--gas/config/tc-ia64.c16
-rw-r--r--gas/config/tc-ia64.h4
-rw-r--r--gas/config/tc-m32r.c2
-rw-r--r--gas/config/tc-m32r.h3
-rw-r--r--gas/config/tc-m68hc11.c61
-rw-r--r--gas/config/tc-m68k.c43
-rw-r--r--gas/config/tc-m88k.c23
-rw-r--r--gas/config/tc-mcore.c13
-rw-r--r--gas/config/tc-mcore.h5
-rw-r--r--gas/config/tc-mips.c16
-rw-r--r--gas/config/tc-mips.h2
-rw-r--r--gas/config/tc-mmix.c16
-rw-r--r--gas/config/tc-mmix.h4
-rw-r--r--gas/config/tc-mn10200.c15
-rw-r--r--gas/config/tc-mn10200.h3
-rw-r--r--gas/config/tc-mn10300.c48
-rw-r--r--gas/config/tc-mn10300.h6
-rw-r--r--gas/config/tc-ns32k.c65
-rw-r--r--gas/config/tc-openrisc.h3
-rw-r--r--gas/config/tc-pdp11.c20
-rw-r--r--gas/config/tc-pj.c14
-rw-r--r--gas/config/tc-ppc.c226
-rw-r--r--gas/config/tc-ppc.h6
-rw-r--r--gas/config/tc-s390.c196
-rw-r--r--gas/config/tc-s390.h6
-rw-r--r--gas/config/tc-sh.c41
-rw-r--r--gas/config/tc-sh.h1
-rw-r--r--gas/config/tc-sparc.c36
-rw-r--r--gas/config/tc-sparc.h5
-rw-r--r--gas/config/tc-tahoe.c9
-rw-r--r--gas/config/tc-tic30.c16
-rw-r--r--gas/config/tc-tic54x.c14
-rw-r--r--gas/config/tc-tic80.c9
-rw-r--r--gas/config/tc-v850.c82
-rw-r--r--gas/config/tc-v850.h1
-rw-r--r--gas/config/tc-vax.c14
-rw-r--r--gas/config/tc-w65.c11
-rw-r--r--gas/config/tc-z8k.c9
66 files changed, 795 insertions, 992 deletions
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index 90c77fb..4421e4f 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -4496,11 +4496,7 @@ fixup_segment (segP, this_segment_type)
#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)
{
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index f862f77..98948be 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -121,10 +121,17 @@
#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
diff --git a/gas/config/tc-a29k.c b/gas/config/tc-a29k.c
index 14c0d82..3100d2b 100644
--- a/gas/config/tc-a29k.c
+++ b/gas/config/tc-a29k.c
@@ -782,26 +782,25 @@ md_number_to_chars (buf, val, n)
}
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;
@@ -863,12 +862,13 @@ md_apply_fix (fixP, val)
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;
@@ -889,6 +889,9 @@ md_apply_fix (fixP, val)
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
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 67f0a82..bdcddc9 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -1118,14 +1118,14 @@ md_pcrel_from (fixP)
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)
@@ -1184,7 +1184,7 @@ md_apply_fix3 (fixP, valueP, seg)
md_number_to_chars (fixpos, value, size);
goto done;
}
- return 1;
+ return;
#ifdef OBJ_ECOFF
case BFD_RELOC_GPREL32:
@@ -1199,7 +1199,7 @@ md_apply_fix3 (fixP, valueP, seg)
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)
@@ -1208,7 +1208,7 @@ md_apply_fix3 (fixP, valueP, seg)
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)
@@ -1217,22 +1217,22 @@ md_apply_fix3 (fixP, valueP, seg)
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:
{
@@ -1262,7 +1262,7 @@ md_apply_fix3 (fixP, valueP, seg)
}
if (fixP->fx_addsy != 0 || fixP->fx_pcrel != 0)
- return 1;
+ return;
else
{
as_warn_where (fixP->fx_file, fixP->fx_line,
@@ -1275,12 +1275,9 @@ write_done:
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)
diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h
index b5121d2..fb428f9 100644
--- a/gas/config/tc-alpha.h
+++ b/gas/config/tc-alpha.h
@@ -1,5 +1,5 @@
/* 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>.
@@ -37,7 +37,6 @@
: "unknown-format")
#define NEED_LITERAL_POOL
-#define TC_HANDLES_FX_DONE
#define REPEAT_CONS_EXPRESSIONS
extern int alpha_force_relocation PARAMS ((struct fix *));
@@ -49,7 +48,6 @@ extern valueT alpha_gp_value;
#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.
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 112c30a..3e829fa 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -834,7 +834,7 @@ md_assemble (str)
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
@@ -1880,16 +1880,16 @@ get_arc_exp_reloc_type (data_p, default_type, exp, expnew)
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
@@ -1903,13 +1903,10 @@ md_apply_fix3 (fixP, valueP, seg)
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,
@@ -1962,7 +1959,7 @@ md_apply_fix3 (fixP, valueP, seg)
if (fixP->fx_done)
{
/* Nothing else to do here. */
- return 1;
+ return;
}
/* Determine a BFD reloc value based on the operand information.
@@ -1997,7 +1994,7 @@ md_apply_fix3 (fixP, valueP, seg)
as_bad_where (fixP->fx_file, fixP->fx_line,
"unresolved expression that must be resolved");
fixP->fx_done = 1;
- return 1;
+ return;
}
}
else
@@ -2037,8 +2034,6 @@ md_apply_fix3 (fixP, valueP, seg)
}
fixP->fx_addnumber = value;
-
- return 1;
}
/* Translate internal representation of relocation info to BFD target
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index 86b9253..f144271 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -53,10 +53,6 @@ extern const char *arc_target_format;
#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));
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 9f6b598..429cfa5 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -7581,13 +7581,13 @@ arm_reg_parse (ccp)
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;
@@ -7847,7 +7847,7 @@ md_apply_fix3 (fixP, val, seg)
&& 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
@@ -8183,15 +8183,13 @@ md_apply_fix3 (fixP, val, seg)
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
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index 8de5704..381e546 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -171,10 +171,6 @@ void armelf_frob_symbol PARAMS ((symbolS *, int *));
#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
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index d9443ad..4fb15e3 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -819,57 +819,53 @@ md_pcrel_from_section (fixp, sec)
/* 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:
@@ -879,18 +875,18 @@ md_apply_fix3 (fixp, valuep, seg)
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. */
@@ -898,7 +894,7 @@ md_apply_fix3 (fixp, valuep, seg)
--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);
@@ -906,7 +902,7 @@ md_apply_fix3 (fixp, valuep, seg)
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. */
@@ -917,7 +913,7 @@ md_apply_fix3 (fixp, valuep, seg)
{
/* 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);
}
@@ -1007,7 +1003,7 @@ md_apply_fix3 (fixp, valuep, seg)
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;
@@ -1018,28 +1014,27 @@ md_apply_fix3 (fixp, valuep, seg)
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
diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h
index 3489465..7aff4e2 100644
--- a/gas/config/tc-avr.h
+++ b/gas/config/tc-avr.h
@@ -1,5 +1,5 @@
/* 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>
@@ -90,10 +90,6 @@ void avr_cons_fix_new(fragS *frag,int where, int nbytes, expressionS *exp);
`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
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 9b2203c..04e8d2f 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -2972,14 +2972,13 @@ md_show_usage (stream)
/* 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)
@@ -2999,17 +2998,13 @@ md_apply_fix3 (fixP, valP, seg)
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;
diff --git a/gas/config/tc-cris.h b/gas/config/tc-cris.h
index 3c3bb5a..d1d4b29 100644
--- a/gas/config/tc-cris.h
+++ b/gas/config/tc-cris.h
@@ -75,13 +75,9 @@ extern const int md_long_jump_size;
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 \
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index 248e62a..43fd89c 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -1528,67 +1528,67 @@ md_pcrel_from_section (fixp, sec)
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:
@@ -1596,7 +1596,7 @@ md_apply_fix3 (fixp, valuep, seg)
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
{
@@ -1610,9 +1610,9 @@ md_apply_fix3 (fixp, valuep, seg)
&& 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;
@@ -1625,14 +1625,13 @@ md_apply_fix3 (fixp, valuep, seg)
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
diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h
index 019ab43..2bcd2ce 100644
--- a/gas/config/tc-d10v.h
+++ b/gas/config/tc-d10v.h
@@ -1,5 +1,5 @@
/* 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.
@@ -34,9 +34,7 @@
#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));
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index 5316b09..c92bcdd 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -1833,73 +1833,70 @@ md_pcrel_from_section (fixp, sec)
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);
@@ -1908,58 +1905,58 @@ md_apply_fix3 (fixp, valuep, seg)
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;
@@ -1988,10 +1985,8 @@ md_apply_fix3 (fixp, valuep, seg)
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
diff --git a/gas/config/tc-d30v.h b/gas/config/tc-d30v.h
index 29912c5..0b2b25c 100644
--- a/gas/config/tc-d30v.h
+++ b/gas/config/tc-d30v.h
@@ -1,5 +1,5 @@
/* 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.
@@ -34,10 +34,7 @@
#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)
diff --git a/gas/config/tc-fr30.h b/gas/config/tc-fr30.h
index 705fe08..a9edc60 100644
--- a/gas/config/tc-fr30.h
+++ b/gas/config/tc-fr30.h
@@ -1,5 +1,5 @@
/* 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.
@@ -46,7 +46,6 @@ long md_pcrel_from_section PARAMS ((struct fix *, segT));
/* 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)
@@ -56,8 +55,6 @@ extern boolean fr30_fix_adjustable PARAMS ((struct fix *));
#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(). */
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 13be3462..b1f6ecb 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -1488,22 +1488,14 @@ md_section_align (seg, size)
#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)
{
@@ -1523,6 +1515,9 @@ md_apply_fix (fixP, val)
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int
diff --git a/gas/config/tc-h8500.c b/gas/config/tc-h8500.c
index 7cffd83..3157e0b 100644
--- a/gas/config/tc-h8500.c
+++ b/gas/config/tc-h8500.c
@@ -1372,20 +1372,19 @@ md_section_align (seg, size)
}
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;
@@ -1416,14 +1415,15 @@ md_apply_fix (fixP, 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;
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 5bdd25e..c5df9ca 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1158,7 +1158,7 @@ static struct default_space_dict pa_def_spaces[] =
} \
}
-/* 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) \
@@ -4403,16 +4403,20 @@ md_undefined_symbol (name)
/* 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. */
@@ -4422,21 +4426,21 @@ md_apply_fix (fixP, valp)
|| 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
@@ -4447,7 +4451,7 @@ md_apply_fix (fixP, valp)
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;
@@ -4479,11 +4483,11 @@ md_apply_fix (fixP, valp)
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)
@@ -4492,13 +4496,13 @@ md_apply_fix (fixP, valp)
&& !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)
@@ -4506,7 +4510,7 @@ md_apply_fix (fixP, valp)
&& !(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)
@@ -4566,7 +4570,7 @@ md_apply_fix (fixP, valp)
/* 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. */
@@ -4585,7 +4589,7 @@ md_apply_fix (fixP, valp)
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. */
@@ -4624,12 +4628,11 @@ md_apply_fix (fixP, valp)
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?
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
index de092b2..87d8af8 100644
--- a/gas/config/tc-i370.c
+++ b/gas/config/tc-i370.c
@@ -2321,7 +2321,7 @@ md_assemble (str)
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;
@@ -2713,24 +2713,23 @@ md_pcrel_from_section (fixp, sec)
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,
@@ -2748,70 +2747,69 @@ md_apply_fix3 (fixp, valuep, seg)
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
@@ -2823,7 +2821,7 @@ md_apply_fix3 (fixp, valuep, seg)
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
{
@@ -2832,61 +2830,60 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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;
@@ -2894,37 +2891,35 @@ md_apply_fix3 (fixp, valuep, seg)
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. */
diff --git a/gas/config/tc-i370.h b/gas/config/tc-i370.h
index 5a28660..a1da508 100644
--- a/gas/config/tc-i370.h
+++ b/gas/config/tc-i370.h
@@ -1,5 +1,5 @@
/* 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.
@@ -60,45 +60,7 @@ extern int target_big_endian;
/* 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
-
-
-#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));
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index b8585d5..c81f870 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4211,19 +4211,17 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
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)
@@ -4357,30 +4355,26 @@ md_apply_fix3 (fixP, valp, seg)
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);
}
#define MAX_LITTLENUMS 6
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index aff5980..d5ba043 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -531,9 +531,6 @@ if (fragP->fr_type == rs_align_code) \
- 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
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index 5f29b20..9aa4457 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1228,15 +1228,15 @@ obtain_reloc_for_imm16 (fix, val)
/* 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;
@@ -1280,9 +1280,8 @@ md_apply_fix3 (fix, valuep, seg)
}
}
else if (fup & OP_IMM_U16)
- {
- abort ();
- }
+ abort ();
+
else if (fup & OP_IMM_SPLIT16)
{
fix->fx_r_type = obtain_reloc_for_imm16 (fix, &val);
@@ -1367,9 +1366,6 @@ md_apply_fix3 (fix, valuep, seg)
fix->fx_done = 1;
}
}
-
- /* Return value ignored. */
- return 0;
}
/* Generate a machine dependent reloc from a fixup. */
diff --git a/gas/config/tc-i860.h b/gas/config/tc-i860.h
index c9b6771..c524729 100644
--- a/gas/config/tc-i860.h
+++ b/gas/config/tc-i860.h
@@ -1,5 +1,5 @@
/* 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
@@ -71,8 +71,6 @@ extern int target_big_endian;
#endif
#define WORKING_DOT_WORD
-#define MD_APPLY_FIX3
-#define TC_HANDLES_FX_DONE
#define DIFF_EXPR_OK
/* Permit temporary numeric labels. */
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 279c214..568b8ab 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -2806,21 +2806,13 @@ md_pcrel_from (fixP)
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)
@@ -2839,9 +2831,8 @@ md_apply_fix (fixP, val)
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)
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 6930d6f..d2523cf 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -9879,7 +9879,7 @@ ia64_cons_fix_new (f, where, nbytes, exp)
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;
}
@@ -10102,14 +10102,15 @@ fix_insn (fix, odesc, value)
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;
@@ -10152,7 +10153,7 @@ md_apply_fix3 (fix, valuep, seg)
"%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
@@ -10167,15 +10168,12 @@ md_apply_fix3 (fix, valuep, seg)
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
diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h
index d87b205..7921abf 100644
--- a/gas/config/tc-ia64.h
+++ b/gas/config/tc-ia64.h
@@ -46,7 +46,6 @@ extern const char *ia64_target_format PARAMS ((void));
#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
@@ -118,9 +117,6 @@ extern void ia64_handle_align PARAMS ((fragS *f));
#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 \
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index 6ee3a2e..7a810d4 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -1710,7 +1710,7 @@ m32r_cgen_record_fixup_exp (frag, where, insn, length, operand, opinfo, exp)
#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
diff --git a/gas/config/tc-m32r.h b/gas/config/tc-m32r.h
index 2eaee0e..34fda57 100644
--- a/gas/config/tc-m32r.h
+++ b/gas/config/tc-m32r.h
@@ -68,7 +68,6 @@ extern void m32r_handle_align PARAMS ((fragS *));
#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)
@@ -77,8 +76,6 @@ extern void m32r_handle_align PARAMS ((fragS *));
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 ()
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 0c7ccab..d4358af 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -2729,43 +2729,38 @@ md_estimate_size_before_relax (fragP, segment)
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.
@@ -2776,9 +2771,9 @@ md_apply_fix (fixp, valuep)
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);
@@ -2788,7 +2783,7 @@ md_apply_fix (fixp, valuep)
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;
@@ -2811,14 +2806,14 @@ md_apply_fix (fixp, valuep)
((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)
@@ -2831,8 +2826,6 @@ md_apply_fix (fixp, valuep)
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;
}
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 6a7f47d..ad8c3d7 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -348,7 +348,6 @@ static void s_mri_repeat PARAMS ((int));
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;
@@ -3779,11 +3778,10 @@ md_begin ()
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)
{
@@ -4223,11 +4221,13 @@ md_number_to_chars (buf, val, n)
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;
@@ -4239,6 +4239,9 @@ md_apply_fix_2 (fixP, val)
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)
{
@@ -4261,8 +4264,8 @@ md_apply_fix_2 (fixP, val)
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;
@@ -4322,24 +4325,6 @@ md_apply_fix_2 (fixP, val)
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. ..
diff --git a/gas/config/tc-m88k.c b/gas/config/tc-m88k.c
index bd3ddba..2fde71d 100644
--- a/gas/config/tc-m88k.c
+++ b/gas/config/tc-m88k.c
@@ -1117,31 +1117,33 @@ tc_coff_fix2rtype (fixp)
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;
@@ -1168,6 +1170,9 @@ md_apply_fix (fixp, val)
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
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 7a8a5f4..786ae8b 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -2088,17 +2088,18 @@ md_convert_frag (abfd, sec, fragP)
/* 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. */
@@ -2115,7 +2116,7 @@ md_apply_fix3 (fixP, valp, segment)
/* 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
@@ -2214,8 +2215,6 @@ md_apply_fix3 (fixP, valp, segment)
}
break;
}
-
- return 0; /* Return value is ignored. */
}
void
diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h
index 6a582ce..c8787dd 100644
--- a/gas/config/tc-mcore.h
+++ b/gas/config/tc-mcore.h
@@ -1,6 +1,6 @@
/* 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.
@@ -59,8 +59,6 @@ extern const struct relax_type md_relax_table[];
/* 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")
@@ -115,7 +113,6 @@ extern void md_create_short_jump
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));
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 2e4a890..5c3da07 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -10094,7 +10094,7 @@ mips_frob_file_before_adjust ()
}
/* 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. */
@@ -10220,10 +10220,11 @@ mips_force_relocation (fixp)
/* 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;
@@ -10249,7 +10250,7 @@ md_apply_fix (fixP, valueP)
|| 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. */
@@ -10270,6 +10271,7 @@ md_apply_fix (fixP, valueP)
{
valueT symval = S_GET_VALUE (fixP->fx_addsy);
+
value -= symval;
if (value != 0
&& ! fixP->fx_pcrel
@@ -10337,7 +10339,7 @@ md_apply_fix (fixP, valueP)
}
#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;
@@ -10577,8 +10579,6 @@ md_apply_fix (fixP, valueP)
default:
internalError ();
}
-
- return 1;
}
#if 0
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index 1358cc8..1395b25 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -111,7 +111,7 @@ extern int mips_fix_adjustable PARAMS ((struct fix *));
#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
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index b769807..46d5dec 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -2369,15 +2369,15 @@ md_convert_frag (abfd, sec, fragP)
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));
@@ -2397,7 +2397,7 @@ md_apply_fix3 (fixP, valp, segment)
&& 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
@@ -2405,7 +2405,7 @@ md_apply_fix3 (fixP, valp, segment)
{
/* These are never "fixed". */
fixP->fx_done = 0;
- return 0;
+ return;
}
else
/* We assume every other relocation is "fixed". */
@@ -2517,7 +2517,7 @@ md_apply_fix3 (fixP, valp, segment)
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:
@@ -2541,8 +2541,6 @@ md_apply_fix3 (fixP, valp, segment)
/* 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
diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h
index 3c7c71a..e0b6f49 100644
--- a/gas/config/tc-mmix.h
+++ b/gas/config/tc-mmix.h
@@ -171,10 +171,6 @@ extern int mmix_force_relocation PARAMS ((struct fix *));
#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"
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index b2135d3..ff30fec 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -760,7 +760,7 @@ md_begin ()
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;
@@ -1300,16 +1300,15 @@ md_pcrel_from (fixp)
#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. */
diff --git a/gas/config/tc-mn10200.h b/gas/config/tc-mn10200.h
index f8e9d83..ca18116 100644
--- a/gas/config/tc-mn10200.h
+++ b/gas/config/tc-mn10200.h
@@ -1,5 +1,5 @@
/* 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.
@@ -31,7 +31,6 @@
#define TARGET_FORMAT "elf32-mn10200"
-#define MD_APPLY_FIX3
#define md_operand(x)
/* Permit temporary numeric labels. */
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index ed17e9c..b73073e 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -1908,21 +1908,21 @@ md_pcrel_from (fixp)
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
@@ -1935,22 +1935,20 @@ md_apply_fix3 (fixp, valuep, seg)
*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:
@@ -1969,22 +1967,20 @@ md_apply_fix3 (fixp, valuep, seg)
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,
diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h
index f14cd24..c09ddad 100644
--- a/gas/config/tc-mn10300.h
+++ b/gas/config/tc-mn10300.h
@@ -1,5 +1,5 @@
/* 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.
@@ -35,13 +35,9 @@
#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)
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index 3aa890d..1ef1ef1 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -1954,52 +1954,43 @@ md_fix_pcrel_adjust (fixP)
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;
}
/* Convert a relaxed displacement to ditto in final output */
diff --git a/gas/config/tc-openrisc.h b/gas/config/tc-openrisc.h
index d863c9f..365aa7f 100644
--- a/gas/config/tc-openrisc.h
+++ b/gas/config/tc-openrisc.h
@@ -51,7 +51,6 @@ extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
/* 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 *));
@@ -61,8 +60,6 @@ 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(). */
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index a38a0ea..4577d79 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -163,15 +163,17 @@ md_number_to_chars (con, value, nbytes)
}
/* 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;
@@ -200,13 +202,15 @@ md_apply_fix (fixP, value)
}
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
@@ -1553,7 +1557,7 @@ tc_gen_reloc (section, fixp)
*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)
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index 7d5b835..034b437 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -427,13 +427,14 @@ PJ options:\n\
/* 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;
@@ -452,7 +453,7 @@ md_apply_fix (fixP, valp)
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)
@@ -526,7 +527,8 @@ md_apply_fix (fixP, valp)
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
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 2e2e684..a394408 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -2312,7 +2312,7 @@ md_assemble (str)
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;
@@ -5080,36 +5080,33 @@ ppc_fix_adjustable (fix)
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
@@ -5121,38 +5118,37 @@ md_apply_fix3 (fixp, valuep, seg)
*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];
@@ -5165,38 +5161,36 @@ md_apply_fix3 (fixp, valuep, seg)
&& 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
@@ -5204,35 +5198,35 @@ md_apply_fix3 (fixp, valuep, seg)
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
@@ -5242,23 +5236,23 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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)
@@ -5266,26 +5260,26 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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;
@@ -5320,20 +5314,20 @@ md_apply_fix3 (fixp, valuep, seg)
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;
@@ -5341,46 +5335,46 @@ md_apply_fix3 (fixp, valuep, seg)
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;
@@ -5395,10 +5389,10 @@ md_apply_fix3 (fixp, valuep, seg)
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)
@@ -5417,45 +5411,45 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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);
@@ -5467,15 +5461,15 @@ md_apply_fix3 (fixp, valuep, seg)
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
@@ -5483,37 +5477,35 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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. */
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index a62147c..f4d2f86 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -82,9 +82,6 @@ extern char *ppc_target_format PARAMS ((void));
/* 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) \
@@ -292,9 +289,6 @@ extern int ppc_elf_frob_symbol PARAMS ((symbolS *));
#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));
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 1f6f02c..2fb2c6c 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1680,112 +1680,110 @@ tc_s390_force_relocation (fixp)
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
{
@@ -1794,29 +1792,29 @@ md_apply_fix3 (fixp, valuep, seg)
/* 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;
@@ -1830,45 +1828,45 @@ md_apply_fix3 (fixp, valuep, seg)
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:
@@ -1876,58 +1874,56 @@ md_apply_fix3 (fixp, valuep, seg)
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. */
diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h
index 67d9117..1837b1a 100644
--- a/gas/config/tc-s390.h
+++ b/gas/config/tc-s390.h
@@ -85,9 +85,6 @@ extern int target_big_endian;
/* 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) \
@@ -108,9 +105,6 @@ if (fragP->fr_type == rs_align_code) \
- 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));
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 1bf2589..654fc0f 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -2377,7 +2377,7 @@ sh_frob_file ()
}
/* 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)
@@ -2769,24 +2769,16 @@ sh_elf_final_processing ()
/* 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;
@@ -2812,11 +2804,11 @@ md_apply_fix (fixP, val)
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;
}
}
@@ -2966,17 +2958,13 @@ md_apply_fix (fixP, val)
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:
@@ -2996,12 +2984,12 @@ md_apply_fix (fixP, val)
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;
@@ -3026,9 +3014,8 @@ md_apply_fix (fixP, val)
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
@@ -3259,7 +3246,7 @@ sh_coff_reloc_mangle (seg, fix, intr, paddr)
{
/* 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)
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index 138fc33..920fce4 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -163,7 +163,6 @@ extern int tc_coff_sizemachdep PARAMS ((fragS *));
/* 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
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 0809383..f1639a3 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -2881,18 +2881,16 @@ md_number_to_chars (buf, val, n)
/* 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. */
@@ -2928,7 +2926,7 @@ md_apply_fix3 (fixP, value, segment)
&& ! bfd_is_com_section (seg))
fixP->fx_addnumber -= S_GET_VALUE (sym);
- return 1;
+ return;
}
#endif
@@ -2999,7 +2997,7 @@ md_apply_fix3 (fixP, value, segment)
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{
fixP->fx_done = 0;
- return 1;
+ return;
}
else
{
@@ -3171,14 +3169,10 @@ md_apply_fix3 (fixP, value, segment)
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:
@@ -3194,14 +3188,10 @@ md_apply_fix3 (fixP, value, segment)
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:
@@ -3272,8 +3262,6 @@ md_apply_fix3 (fixP, value, segment)
/* 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
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index f231f1d..78653d7 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -1,6 +1,6 @@
/* 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.
@@ -110,9 +110,6 @@ extern void sparc_handle_align PARAMS ((struct frag *));
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
diff --git a/gas/config/tc-tahoe.c b/gas/config/tc-tahoe.c
index 9f450e5..4848e52 100644
--- a/gas/config/tc-tahoe.c
+++ b/gas/config/tc-tahoe.c
@@ -470,11 +470,12 @@ md_number_to_imm (con, value, nbytes)
#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);
}
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index 21f2ad9..1258b13 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1559,10 +1559,11 @@ md_convert_frag (abfd, sec, fragP)
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;
@@ -1574,15 +1575,18 @@ md_apply_fix (fixP, 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
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index a61e0a6..094203a 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -5335,19 +5335,20 @@ tic54x_cons_fix_new (fragS *frag, int where, int octets, expressionS *exp)
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. */
@@ -5381,7 +5382,8 @@ md_apply_fix (fixP, valP)
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
diff --git a/gas/config/tc-tic80.c b/gas/config/tc-tic80.c
index 585865f..ce1251c 100644
--- a/gas/config/tc-tic80.c
+++ b/gas/config/tc-tic80.c
@@ -960,10 +960,12 @@ TIc80 options:\n\
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;
@@ -1001,6 +1003,9 @@ md_apply_fix (fixP, val)
fixP->fx_r_type);
break;
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
/* Functions concerning relocs. */
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 5e104f8..8f12245 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -2210,7 +2210,7 @@ md_assemble (str)
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;
@@ -2340,52 +2340,51 @@ v850_pcrel_from_section (fixp, section)
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
@@ -2393,53 +2392,50 @@ md_apply_fix3 (fixp, valuep, seg)
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;
}
/* Parse a cons expression. We have to handle hi(), lo(), etc
diff --git a/gas/config/tc-v850.h b/gas/config/tc-v850.h
index ff94ebf3..84c6270 100644
--- a/gas/config/tc-v850.h
+++ b/gas/config/tc-v850.h
@@ -34,7 +34,6 @@
/* 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)
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index 8400b5d..b6dc876 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -289,12 +289,18 @@ md_number_to_chars (con, value, nbytes)
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
diff --git a/gas/config/tc-w65.c b/gas/config/tc-w65.c
index dda8859..b3ddc68 100644
--- a/gas/config/tc-w65.c
+++ b/gas/config/tc-w65.c
@@ -978,10 +978,12 @@ md_section_align (seg, size)
}
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;
@@ -1030,9 +1032,12 @@ md_apply_fix (fixP, val)
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)
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index bf83b27..f5b05a6 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1405,10 +1405,12 @@ md_section_align (seg, size)
}
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)
@@ -1464,6 +1466,9 @@ md_apply_fix (fixP, val)
default:
abort ();
}
+
+ if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ fixP->fx_done = 1;
}
int