amigaos-cross-toolchain/patches/binutils-2.14/gas/write.c.diff

134 lines
4.2 KiB
Diff

--- binutils-2.14/gas/write.c 2003-04-07 05:54:00.000000000 +0200
+++ binutils-2.14-patched/gas/write.c 2013-04-24 18:38:14.000000000 +0200
@@ -160,7 +160,7 @@
static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
symbolS *add, symbolS *sub,
offsetT offset, int pcrel,
- RELOC_ENUM r_type));
+ RELOC_ENUM r_type, int baserel));
#if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
static long fixup_segment PARAMS ((fixS *, segT));
#endif
@@ -190,7 +190,7 @@
static fixS *
fix_new_internal (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
- r_type)
+ r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
@@ -199,6 +199,7 @@
offsetT offset; /* X_add_number. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type ATTRIBUTE_UNUSED; /* Relocation type. */
+ int baserel ATTRIBUTE_UNUSED; /* TRUE if base-relative data */
{
fixS *fixP;
@@ -239,6 +240,7 @@
#endif
#ifdef TC_FIX_TYPE
+ fixP->tc_fix_data = baserel;
TC_INIT_FIX_DATA (fixP);
#endif
@@ -283,7 +285,7 @@
/* Create a fixup relative to a symbol (plus a constant). */
fixS *
-fix_new (frag, where, size, add_symbol, offset, pcrel, r_type)
+fix_new (frag, where, size, add_symbol, offset, pcrel, r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
@@ -291,9 +293,10 @@
offsetT offset; /* X_add_number. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type; /* Relocation type. */
+ int baserel; /* TRUE if base-relative data */
{
return fix_new_internal (frag, where, size, add_symbol,
- (symbolS *) NULL, offset, pcrel, r_type);
+ (symbolS *) NULL, offset, pcrel, r_type, baserel);
}
/* Create a fixup for an expression. Currently we only support fixups
@@ -301,13 +304,14 @@
file formats support anyhow. */
fixS *
-fix_new_exp (frag, where, size, exp, pcrel, r_type)
+fix_new_exp (frag, where, size, exp, pcrel, r_type, baserel)
fragS *frag; /* Which frag? */
int where; /* Where in that frag? */
int size; /* 1, 2, or 4 usually. */
expressionS *exp; /* Expression. */
int pcrel; /* TRUE if PC-relative relocation. */
RELOC_ENUM r_type; /* Relocation type. */
+ int baserel; /* TRUE if base-relative data */
{
symbolS *add = NULL;
symbolS *sub = NULL;
@@ -333,7 +337,7 @@
exp->X_add_symbol = stmp;
exp->X_add_number = 0;
- return fix_new_exp (frag, where, size, exp, pcrel, r_type);
+ return fix_new_exp (frag, where, size, exp, pcrel, r_type, baserel);
}
case O_symbol_rva:
@@ -371,7 +375,7 @@
break;
}
- return fix_new_internal (frag, where, size, add, sub, off, pcrel, r_type);
+ return fix_new_internal (frag, where, size, add, sub, off, pcrel, r_type, baserel);
}
/* Generic function to determine whether a fixup requires a relocation. */
@@ -1666,17 +1670,17 @@
#ifdef TC_CONS_FIX_NEW
TC_CONS_FIX_NEW (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp);
+ 2, &exp, 0);
#else
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, BFD_RELOC_16);
+ 2, &exp, 0, BFD_RELOC_16, 0);
#endif
#else
#if defined(TC_SPARC) || defined(TC_A29K) || defined(NEED_FX_R_TYPE)
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, NO_RELOC);
+ 2, &exp, 0, NO_RELOC, 0);
#else
#ifdef TC_NS32K
fix_new_ns32k_exp (lie->frag,
@@ -1685,7 +1689,7 @@
#else
fix_new_exp (lie->frag,
lie->word_goes_here - lie->frag->fr_literal,
- 2, &exp, 0, 0);
+ 2, &exp, 0, 0, 0);
#endif /* TC_NS32K */
#endif /* TC_SPARC|TC_A29K|NEED_FX_R_TYPE */
#endif /* BFD_ASSEMBLER */
@@ -2740,6 +2744,11 @@
}
}
+#if !defined(BFD_ASSEMBLER) && !defined(MANY_SEGMENTS)
+ if (fixP->tc_fix_data && add_number != fixP->fx_offset)
+ add_number -= text_last_frag->fr_address;
+#endif
+
if (!fixP->fx_done)
md_apply_fix3 (fixP, &add_number, this_segment);