Browse Source

* write.c (TC_FORCE_RELOCATION_SUB_LOCAL): Heed md_register_arithmetic.

(TC_VALIDATE_FIX_SUB): Likewise.
	* config/tc-frv.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
	* config/tc-hppa.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
	* config/tc-mn10300.h (TC_VALIDATE_FIX_SUB): Likewise.
	* config/tc-sh.h (TC_VALIDATE_FIX_SUB): Likewise.
	(TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
	* config/tc-sh64.h (TC_VALIDATE_FIX_SUB): Likewise.
	* config/tc-xtensa.h (TC_VALIDATE_FIX_SUB): Likewise.
	* doc/internals.texi (TC_FORCE_RELOCATION_SUB_ABS,
	TC_FORCE_RELOCATION_SUB_LOCAL, TC_VALIDATE_FIX_SUB): Show new param.
newlib-1_17_0-arc
Alan Modra 18 years ago
parent
commit
5db484ff3d
  1. 12
      gas/ChangeLog
  2. 2
      gas/config/tc-frv.h
  3. 2
      gas/config/tc-hppa.h
  4. 2
      gas/config/tc-mn10300.h
  5. 16
      gas/config/tc-sh.h
  6. 9
      gas/config/tc-sh64.h
  7. 2
      gas/config/tc-xtensa.h
  8. 6
      gas/doc/internals.texi
  9. 19
      gas/write.c

12
gas/ChangeLog

@ -1,5 +1,17 @@
2008-09-19 Alan Modra <amodra@bigpond.net.au> 2008-09-19 Alan Modra <amodra@bigpond.net.au>
* write.c (TC_FORCE_RELOCATION_SUB_LOCAL): Heed md_register_arithmetic.
(TC_VALIDATE_FIX_SUB): Likewise.
* config/tc-frv.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
* config/tc-hppa.h (TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
* config/tc-mn10300.h (TC_VALIDATE_FIX_SUB): Likewise.
* config/tc-sh.h (TC_VALIDATE_FIX_SUB): Likewise.
(TC_FORCE_RELOCATION_SUB_LOCAL): Likewise.
* config/tc-sh64.h (TC_VALIDATE_FIX_SUB): Likewise.
* config/tc-xtensa.h (TC_VALIDATE_FIX_SUB): Likewise.
* doc/internals.texi (TC_FORCE_RELOCATION_SUB_ABS,
TC_FORCE_RELOCATION_SUB_LOCAL, TC_VALIDATE_FIX_SUB): Show new param.
* write.c (md_register_arithmetic): Define. * write.c (md_register_arithmetic): Define.
(fixup_segment): Adjust TC_FORCE_RELOCATION_SUB_ABS invocation. (fixup_segment): Adjust TC_FORCE_RELOCATION_SUB_ABS invocation.
Modify error message when registers involved. Modify error message when registers involved.

2
gas/config/tc-frv.h

@ -61,7 +61,7 @@ extern int frv_force_relocation (struct fix *);
/* If we simplify subtractions that aren't SUB_SAME or SUB_ABS, we end /* If we simplify subtractions that aren't SUB_SAME or SUB_ABS, we end
up with PCrel fixups, but since we don't have any PCrel relocs, we up with PCrel fixups, but since we don't have any PCrel relocs, we
crash. Preventing simplification gets us a good, early error. */ crash. Preventing simplification gets us a good, early error. */
#define TC_FORCE_RELOCATION_SUB_LOCAL(fixP) 1 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#undef GAS_CGEN_MAX_FIXUPS #undef GAS_CGEN_MAX_FIXUPS
#define GAS_CGEN_MAX_FIXUPS 1 #define GAS_CGEN_MAX_FIXUPS 1

2
gas/config/tc-hppa.h

@ -155,7 +155,7 @@ int hppa_fix_adjustable (struct fix *);
difference expression can't be used between text and data symbols, difference expression can't be used between text and data symbols,
or between symbols in different executable modules. */ or between symbols in different executable modules. */
#define DIFF_EXPR_OK 1 #define DIFF_EXPR_OK 1
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) 1 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#define UNDEFINED_DIFFERENCE_OK #define UNDEFINED_DIFFERENCE_OK
#endif #endif

2
gas/config/tc-mn10300.h

@ -70,7 +70,7 @@ void mn10300_cons_fix_new (fragS *, int, int, expressionS *);
/* We validate subtract arguments within tc_gen_reloc(), so don't /* We validate subtract arguments within tc_gen_reloc(), so don't
report errors at this point. */ report errors at this point. */
#define TC_VALIDATE_FIX_SUB(FIX) 1 #define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
/* Fixup debug sections since we will never relax them. Ideally, we /* Fixup debug sections since we will never relax them. Ideally, we
could do away with this and instead check every single fixup with could do away with this and instead check every single fixup with

16
gas/config/tc-sh.h

@ -83,8 +83,9 @@ extern int sh_force_relocation (struct fix *);
|| (sh_relax && SWITCH_TABLE (FIX))) || (sh_relax && SWITCH_TABLE (FIX)))
/* Don't complain when we leave fx_subsy around. */ /* Don't complain when we leave fx_subsy around. */
#define TC_VALIDATE_FIX_SUB(FIX) \ #define TC_VALIDATE_FIX_SUB(FIX, SEG) \
(sh_relax && SWITCH_TABLE (FIX)) ((md_register_arithmetic || (SEG) != reg_section) \
&& sh_relax && SWITCH_TABLE (FIX))
#define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC) #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
extern long md_pcrel_from_section (struct fix *, segT); extern long md_pcrel_from_section (struct fix *, segT);
@ -207,7 +208,9 @@ extern bfd_boolean sh_fix_adjustable (struct fix *);
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC \ || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC \
|| TC_FORCE_RELOCATION (FIX)) || TC_FORCE_RELOCATION (FIX))
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) (sh_relax && SWITCH_TABLE (FIX)) #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
((!md_register_arithmetic && (SEG) == reg_section) \
|| (sh_relax && SWITCH_TABLE (FIX)))
/* This keeps the subtracted symbol around, for use by PLT_PCREL /* This keeps the subtracted symbol around, for use by PLT_PCREL
relocs. */ relocs. */
@ -217,9 +220,10 @@ extern bfd_boolean sh_fix_adjustable (struct fix *);
/* Don't complain when we leave fx_subsy around. */ /* Don't complain when we leave fx_subsy around. */
#undef TC_VALIDATE_FIX_SUB #undef TC_VALIDATE_FIX_SUB
#define TC_VALIDATE_FIX_SUB(FIX) \ #define TC_VALIDATE_FIX_SUB(FIX, SEG) \
((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ ((md_register_arithmetic || (SEG) != reg_section) \
|| (sh_relax && SWITCH_TABLE (FIX))) && ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| (sh_relax && SWITCH_TABLE (FIX))))
#define md_parse_name(name, exprP, mode, nextcharP) \ #define md_parse_name(name, exprP, mode, nextcharP) \
sh_parse_name ((name), (exprP), (mode), (nextcharP)) sh_parse_name ((name), (exprP), (mode), (nextcharP))

9
gas/config/tc-sh64.h

@ -115,10 +115,11 @@ extern int sh64_target_mach (void);
/* Don't complain when we leave fx_subsy around. */ /* Don't complain when we leave fx_subsy around. */
#undef TC_VALIDATE_FIX_SUB #undef TC_VALIDATE_FIX_SUB
#define TC_VALIDATE_FIX_SUB(FIX) \ #define TC_VALIDATE_FIX_SUB(FIX, SEG) \
((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ ((md_register_arithmetic || (SEG) != reg_section) \
|| (sh_relax && SWITCH_TABLE (FIX)) \ && ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL) || (sh_relax && SWITCH_TABLE (FIX)) \
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL))
/* Note the kludge: we want to put back C, and we also want to consume the /* Note the kludge: we want to put back C, and we also want to consume the
expression, since we have handled it ourselves. FIXME: What we really expression, since we have handled it ourselves. FIXME: What we really

2
gas/config/tc-xtensa.h

@ -335,7 +335,7 @@ extern char *xtensa_section_rename (char *);
#define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix) #define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix)
#define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \ #define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \
(! SEG_NORMAL (seg) || xtensa_force_relocation (fix)) (! SEG_NORMAL (seg) || xtensa_force_relocation (fix))
#define TC_VALIDATE_FIX_SUB(fix) xtensa_validate_fix_sub (fix) #define TC_VALIDATE_FIX_SUB(fix, seg) xtensa_validate_fix_sub (fix)
#define NO_PSEUDO_DOT xtensa_check_inside_bundle () #define NO_PSEUDO_DOT xtensa_check_inside_bundle ()
#define tc_canonicalize_symbol_name(s) xtensa_section_rename (s) #define tc_canonicalize_symbol_name(s) xtensa_section_rename (s)
#define tc_canonicalize_section_name(s) xtensa_section_rename (s) #define tc_canonicalize_section_name(s) xtensa_section_rename (s)

6
gas/doc/internals.texi

@ -1309,17 +1309,17 @@ the subtrahend will be resolved and @code{fx_subsy} set to @code{NULL} for
@w{@code{! SEG_NORMAL (@var{seg}) || TC_FORCE_RELOCATION (@var{fix})}} will @w{@code{! SEG_NORMAL (@var{seg}) || TC_FORCE_RELOCATION (@var{fix})}} will
be used. be used.
@item TC_FORCE_RELOCATION_SUB_ABS (@var{fix}) @item TC_FORCE_RELOCATION_SUB_ABS (@var{fix}, @var{seg)
@cindex TC_FORCE_RELOCATION_SUB_ABS @cindex TC_FORCE_RELOCATION_SUB_ABS
Like @code{TC_FORCE_RELOCATION_SUB_SAME}, but used when the subtrahend is an Like @code{TC_FORCE_RELOCATION_SUB_SAME}, but used when the subtrahend is an
absolute symbol. If the macro is undefined a default of @code{0} is used. absolute symbol. If the macro is undefined a default of @code{0} is used.
@item TC_FORCE_RELOCATION_SUB_LOCAL (@var{fix}) @item TC_FORCE_RELOCATION_SUB_LOCAL (@var{fix}, @var{seg)
@cindex TC_FORCE_RELOCATION_SUB_LOCAL @cindex TC_FORCE_RELOCATION_SUB_LOCAL
Like @code{TC_FORCE_RELOCATION_SUB_ABS}, but the subtrahend is a symbol in the Like @code{TC_FORCE_RELOCATION_SUB_ABS}, but the subtrahend is a symbol in the
same section as the fixup. same section as the fixup.
@item TC_VALIDATE_FIX_SUB (@var{fix}) @item TC_VALIDATE_FIX_SUB (@var{fix}, @var{seg})
@cindex TC_VALIDATE_FIX_SUB @cindex TC_VALIDATE_FIX_SUB
This macro is evaluated for any fixup with a @code{fx_subsy} that This macro is evaluated for any fixup with a @code{fx_subsy} that
@code{fixup_segment} cannot reduce to a number. If the macro returns @code{fixup_segment} cannot reduce to a number. If the macro returns

19
gas/write.c

@ -65,20 +65,23 @@
#ifndef TC_FORCE_RELOCATION_SUB_LOCAL #ifndef TC_FORCE_RELOCATION_SUB_LOCAL
#ifdef DIFF_EXPR_OK #ifdef DIFF_EXPR_OK
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) 0 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
(!md_register_arithmetic && (SEG) == reg_section)
#else #else
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX) 1 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#endif #endif
#endif #endif
#ifndef TC_VALIDATE_FIX_SUB #ifndef TC_VALIDATE_FIX_SUB
#ifdef UNDEFINED_DIFFERENCE_OK #ifdef UNDEFINED_DIFFERENCE_OK
/* The PA needs this for PIC code generation. */ /* The PA needs this for PIC code generation. */
#define TC_VALIDATE_FIX_SUB(FIX) 1 #define TC_VALIDATE_FIX_SUB(FIX, SEG) \
(md_register_arithmetic || (SEG) != reg_section)
#else #else
#define TC_VALIDATE_FIX_SUB(FIX) \ #define TC_VALIDATE_FIX_SUB(FIX, SEG) \
((FIX)->fx_r_type == BFD_RELOC_GPREL32 \ ((md_register_arithmetic || (SEG) != reg_section) \
|| (FIX)->fx_r_type == BFD_RELOC_GPREL16) && ((FIX)->fx_r_type == BFD_RELOC_GPREL32 \
|| (FIX)->fx_r_type == BFD_RELOC_GPREL16))
#endif #endif
#endif #endif
@ -936,7 +939,7 @@ fixup_segment (fixS *fixP, segT this_segment)
fixP->fx_subsy = NULL; fixP->fx_subsy = NULL;
} }
else if (sub_symbol_segment == this_segment else if (sub_symbol_segment == this_segment
&& !TC_FORCE_RELOCATION_SUB_LOCAL (fixP)) && !TC_FORCE_RELOCATION_SUB_LOCAL (fixP, add_symbol_segment))
{ {
add_number -= S_GET_VALUE (fixP->fx_subsy); add_number -= S_GET_VALUE (fixP->fx_subsy);
fixP->fx_offset = (add_number + fixP->fx_dot_value fixP->fx_offset = (add_number + fixP->fx_dot_value
@ -958,7 +961,7 @@ fixup_segment (fixS *fixP, segT this_segment)
fixP->fx_subsy = NULL; fixP->fx_subsy = NULL;
fixP->fx_pcrel = 1; fixP->fx_pcrel = 1;
} }
else if (!TC_VALIDATE_FIX_SUB (fixP)) else if (!TC_VALIDATE_FIX_SUB (fixP, add_symbol_segment))
{ {
if (!md_register_arithmetic if (!md_register_arithmetic
&& (add_symbol_segment == reg_section && (add_symbol_segment == reg_section

Loading…
Cancel
Save