1
0
mirror of https://github.com/cahirwpz/amigaos-cross-toolchain synced 2025-11-23 20:21:21 +00:00
Files
amigaos-cross-toolchain/patches/binutils-2.10.1/gas/write.c.diff
Krystian Bacławski aceee0ded0 Patched binutils 2.10.1.
2012-08-08 13:26:23 +02:00

159 lines
4.5 KiB
Diff

--- binutils-2.10.1/gas/write.c 1999-09-12 05:44:41.000000000 +0200
+++ binutils-2.10.1/gas/write.c 2012-08-08 12:35:51.000000000 +0200
@@ -101,12 +101,12 @@
static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
symbolS *add, symbolS *sub,
offsetT offset, int pcrel,
- bfd_reloc_code_real_type r_type));
+ bfd_reloc_code_real_type r_type, int baserel));
#else
static fixS *fix_new_internal PARAMS ((fragS *, int where, int size,
symbolS *add, symbolS *sub,
offsetT offset, int pcrel,
- int r_type));
+ int r_type, int baserel));
#endif
#if defined (BFD_ASSEMBLER) || (!defined (BFD) && !defined (OBJ_VMS))
static long fixup_segment PARAMS ((fixS * fixP, segT this_segment_type));
@@ -140,7 +140,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. */
@@ -153,6 +153,7 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel; /* TRUE if base-relative data */
{
fixS *fixP;
@@ -192,6 +193,7 @@
#endif
#ifdef TC_FIX_TYPE
+ fixP->tc_fix_data = baserel;
TC_INIT_FIX_DATA(fixP);
#endif
@@ -238,7 +240,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. */
@@ -250,9 +252,10 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel;
{
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
@@ -260,7 +263,7 @@
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. */
@@ -271,6 +274,7 @@
#else
int r_type; /* Relocation type */
#endif
+ int baserel;
{
symbolS *add = NULL;
symbolS *sub = NULL;
@@ -290,7 +294,7 @@
exp->X_op_symbol = 0;
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:
@@ -329,7 +333,7 @@
}
return fix_new_internal (frag, where, size, add, sub, off,
- pcrel, r_type);
+ pcrel, r_type, baserel);
}
/* Append a string onto another string, bumping the pointer along. */
@@ -1564,17 +1568,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,
@@ -1583,7 +1587,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 */
@@ -2423,6 +2427,7 @@
char *place;
long where;
int pcrel, plt;
+ char baserel = 0;
fragS *fragP;
segT add_symbol_segment = absolute_section;
@@ -2463,6 +2468,9 @@
add_number = fixP->fx_offset;
pcrel = fixP->fx_pcrel;
plt = fixP->fx_plt;
+#ifdef TC_FIX_TYPE
+ baserel = fixP->tc_fix_data;
+#endif
if (add_symbolP != NULL
&& symbol_mri_common_p (add_symbolP))
@@ -2731,6 +2739,11 @@
#endif
}
+#if !defined(BFD_ASSEMBLER) && !defined(MANY_SEGMENTS)
+ if (baserel && add_number)
+ add_number -= text_last_frag->fr_address;
+#endif
+
if (!fixP->fx_bit_fixP && !fixP->fx_no_overflow && size > 0)
{
if ((size_t) size < sizeof (valueT))