* write.c (GENERIC_FORCE_RELOCATION_LOCAL): Define.
(TC_FORCE_RELOCATION_LOCAL): Use it.
(GENERIC_FORCE_RELOCATION_SUB_SAME): Define.
(TC_FORCE_RELOCATION_SUB_SAME): Use it.
* config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL,
TC_FORCE_RELOCATION_SUB_SAME): Use GENERIC defines.
* config/tc-aarch64.h: Similarly.
* config/tc-avr.h: Similarly.
* config/tc-cris.h: Similarly.
* config/tc-i386.h: Similarly.
* config/tc-i960.h: Similarly.
* config/tc-ia64.h: Similarly.
* config/tc-microblaze.h: Similarly.
* config/tc-mips.h: Similarly.
* config/tc-msp430.h: Similarly.
* config/tc-nds32.h: Similarly.
* config/tc-pru.h: Similarly.
* config/tc-riscv.h: Similarly.
* config/tc-rl78.h: Similarly.
* config/tc-s390.h: Similarly.
* config/tc-sh.h: Similarly.
* config/tc-sh64.h: Similarly.
* config/tc-sparc.h: Similarly.
* config/tc-xtensa.h: Similarly.
* config/tc-mn10300.h: Similarly.
(GENERIC_FORCE_RELOCATION_LOCAL): Define.
* config/tc-msp430.c (msp430_force_relocation_local): Modify to
be addition to rather than replacement of standard
TC_FORCE_RELOCATION_LOCAL.
+2017-05-16 Alan Modra <amodra@gmail.com>
+
+ * write.c (GENERIC_FORCE_RELOCATION_LOCAL): Define.
+ (TC_FORCE_RELOCATION_LOCAL): Use it.
+ (GENERIC_FORCE_RELOCATION_SUB_SAME): Define.
+ (TC_FORCE_RELOCATION_SUB_SAME): Use it.
+ * config/tc-arm.h (TC_FORCE_RELOCATION_LOCAL,
+ TC_FORCE_RELOCATION_SUB_SAME): Use GENERIC defines.
+ * config/tc-aarch64.h: Similarly.
+ * config/tc-avr.h: Similarly.
+ * config/tc-cris.h: Similarly.
+ * config/tc-i386.h: Similarly.
+ * config/tc-i960.h: Similarly.
+ * config/tc-ia64.h: Similarly.
+ * config/tc-microblaze.h: Similarly.
+ * config/tc-mips.h: Similarly.
+ * config/tc-msp430.h: Similarly.
+ * config/tc-nds32.h: Similarly.
+ * config/tc-pru.h: Similarly.
+ * config/tc-riscv.h: Similarly.
+ * config/tc-rl78.h: Similarly.
+ * config/tc-s390.h: Similarly.
+ * config/tc-sh.h: Similarly.
+ * config/tc-sh64.h: Similarly.
+ * config/tc-sparc.h: Similarly.
+ * config/tc-xtensa.h: Similarly.
+ * config/tc-mn10300.h: Similarly.
+ (GENERIC_FORCE_RELOCATION_LOCAL): Define.
+ * config/tc-msp430.c (msp430_force_relocation_local): Modify to
+ be addition to rather than replacement of standard
+ TC_FORCE_RELOCATION_LOCAL.
+
2017-05-15 Nick Clifton <nickc@redhat.com>
PR gas/21458
pcrel, but it is easier to be safe than sorry. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_64 \
- || (FIX)->fx_r_type == BFD_RELOC_32 \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_32)
#define TC_CONS_FIX_NEW(f,w,s,e,r) cons_fix_new_aarch64 ((f), (w), (s), (e))
pcrel, but it is easier to be safe than sorry. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_ARM_GOT32 \
|| (FIX)->fx_r_type == BFD_RELOC_32 \
- || ((FIX)->fx_addsy != NULL && S_IS_WEAK ((FIX)->fx_addsy)) \
- || TC_FORCE_RELOCATION (FIX))
+ || ((FIX)->fx_addsy != NULL \
+ && S_IS_WEAK ((FIX)->fx_addsy)))
/* Force output of R_ARM_REL32 relocations against thumb function symbols.
This is needed to ensure the low bit is handled correctly. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (THUMB_IS_FUNC ((FIX)->fx_addsy) \
- || !SEG_NORMAL (SEG))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || THUMB_IS_FUNC ((FIX)->fx_addsy))
#define TC_FORCE_RELOCATION_ABS(FIX) \
(((FIX)->fx_pcrel \
even when the value can be resolved locally. Do that if linkrelax is turned on */
#define TC_FORCE_RELOCATION(fix) avr_force_relocation (fix)
#define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \
- (! SEG_NORMAL (seg) || avr_force_relocation (fix))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (fix, seg) \
+ || avr_force_relocation (fix))
extern int avr_force_relocation (struct fix *);
/* Values passed to md_apply_fix don't include the symbol value. */
/* Make sure we don't resolve fixups for which we want to emit dynamic
relocations. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
- || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type) \
- || TC_FORCE_RELOCATION (FIX))
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
+ || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type))
/* For some reloc types, don't adjust fixups by reducing to a section
symbol. */
they are not pcrel. .*/
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
|| (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
|| (FIX)->fx_r_type == BFD_RELOC_X86_64_GOTPCRELX \
- || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_X86_64_REX_GOTPCRELX)
extern int i386_parse_name (char *, expressionS *, char *);
#define md_parse_name(s, e, m, c) i386_parse_name (s, e, c)
/* Makes no sense to use the difference of 2 arbitrary symbols
as the target of a call instruction. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- ((FIX)->fx_tcbit \
- || ! SEG_NORMAL (SEG) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || (FIX)->fx_tcbit \
|| TC_FORCE_RELOCATION (FIX))
/* reloc_callj() may replace a 'call' with a 'calls' or a
|| reloc_callj (FIX))
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
- || TC_FORCE_RELOCATION (FIX) \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| reloc_callj (FIX))
#ifdef OBJ_COFF
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
((FIX)->fx_r_type != BFD_RELOC_UNUSED \
- && (!(FIX)->fx_pcrel \
- || (FIX)->fx_r_type == BFD_RELOC_IA64_PLTOFF22 \
- || TC_FORCE_RELOCATION (FIX)))
+ && (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
+ || (FIX)->fx_r_type == BFD_RELOC_IA64_PLTOFF22))
/* VMS backtraces expect dwarf version 3. */
#ifdef TE_VMS
#define TC_FORCE_RELOCATION_SECTION(FIXP,SEG) 1
#define UNDEFINED_DIFFERENCE_OK 1
-#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
- || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_GOT \
- || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_PLT \
+#define TC_FORCE_RELOCATION_LOCAL(FIX) \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
+ || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_GOT \
+ || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_PLT \
|| (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_GOTOFF \
- || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_32_GOTOFF \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_32_GOTOFF)
#define tc_fix_adjustable(X) tc_microblaze_fix_adjustable(X)
extern int tc_microblaze_fix_adjustable (struct fix *);
extern int mips_force_relocation (struct fix *);
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG) || mips_force_relocation (FIX))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || mips_force_relocation (FIX))
#define TC_FORCE_RELOCATION_ABS(FIX) mips_force_relocation_abs (FIX)
extern bfd_boolean mips_force_relocation_abs (struct fix *);
#define TC_FORCE_RELOCATION(FIX) mn10300_force_relocation (FIX)
extern bfd_boolean mn10300_force_relocation (struct fix *);
+/* tc-mn10300.c uses TC_FORCE_RELOCATION_LOCAL, a macro that should
+ only appear in write.c. The use is likely incorrect. Duplicating
+ the definition here rather than expanding it in
+ TC_FORCE_RELOCATION_LOCAL at least ensures write.c changes will be
+ flagged immediately with a compile error. */
+#define GENERIC_FORCE_RELOCATION_LOCAL(FIX) \
+ (!(FIX)->fx_pcrel \
+ || TC_FORCE_RELOCATION (FIX))
+
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| (FIX)->fx_r_type == BFD_RELOC_MN10300_GOT32 \
- || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL)
#define md_parse_name(NAME, EXPRP, MODE, NEXTCHARP) \
mn10300_parse_name ((NAME), (EXPRP), (MODE), (NEXTCHARP))
linker, but this fix is simpler, and it pretty much only affects
object size a little bit. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (((SEC)->flags & SEC_CODE) != 0 \
- || ! SEG_NORMAL (SEC) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
+ || ((SEC)->flags & SEC_CODE) != 0 \
|| (FIX)->fx_r_type == BFD_RELOC_MN10300_ALIGN \
|| TC_FORCE_RELOCATION (FIX))
return fixp->fx_frag->fr_address + fixp->fx_where;
}
-/* Replaces standard TC_FORCE_RELOCATION_LOCAL.
+/* Addition to the standard TC_FORCE_RELOCATION_LOCAL.
Now it handles the situation when relocations
have to be passed to linker. */
int
&& !msp430_enable_relax)
return 1;
- return (!fixp->fx_pcrel
- || generic_force_reloc (fixp));
+ return 0;
}
msp430_relax_frag (SEG, FRAGP, STRETCH)
extern long msp430_relax_frag (segT, fragS *, long);
-#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- msp430_force_relocation_local (FIX)
+#define TC_FORCE_RELOCATION_LOCAL(FIX) \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
+ || msp430_force_relocation_local (FIX))
extern int msp430_force_relocation_local (struct fix *);
/* We need to add reference symbols for .data/.bss. */
linker, but this fix is simpler, and it pretty much only affects
object size a little bit. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- ( ((SEC)->flags & SEC_CODE) != 0 \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
+ || ((SEC)->flags & SEC_CODE) != 0 \
|| ((SEC)->flags & SEC_DEBUGGING) != 0 \
- || ! SEG_NORMAL (SEC) \
|| TC_FORCE_RELOCATION (FIX))
/* We validate subtract arguments within tc_gen_reloc(),
/* For DIFF relocations. The default behavior is inconsistent with the
asm internal document. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (! SEG_NORMAL (SEC) || TC_FORCE_RELOCATION (FIX))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
+ || TC_FORCE_RELOCATION (FIX))
#define TC_FORCE_RELOCATION(fix) nds32_force_relocation (fix)
#define TC_VALIDATE_FIX_SUB(FIX,SEG) nds32_validate_fix_sub (FIX,SEG)
#define SET_SECTION_RELOCS(sec, relocs, n) nds32_set_section_relocs (sec, relocs, n)
linkrelax is turned on. */
#define TC_FORCE_RELOCATION(fix) pru_force_relocation (fix)
#define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \
- (! SEG_NORMAL (seg) || pru_force_relocation (fix))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (fix, seg) || pru_force_relocation (fix))
extern int pru_force_relocation (struct fix *);
/* Do not use PC relative fixups and relocations for
/* Postpone text-section label subtraction calculation until linking, since
linker relaxations might change the deltas. */
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) ((SEG)->flags & SEC_CODE)
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || ((SEG)->flags & SEC_CODE) != 0)
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
#define TC_VALIDATE_FIX_SUB(FIX, SEG) 1
#define TC_FORCE_RELOCATION_LOCAL(FIX) 1
linker, but this fix is simpler, and it pretty much only affects
object size a little bit. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- ( ((SEC)->flags & SEC_CODE) != 0 \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
+ || ((SEC)->flags & SEC_CODE) != 0 \
|| ((SEC)->flags & SEC_DEBUGGING) != 0 \
- || ! SEG_NORMAL (SEC) \
|| TC_FORCE_RELOCATION (FIX))
#define DWARF2_USE_FIXED_ADVANCE_PC 1
/* Don't resolve foo@PLT-bar to offset@PLT. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEG) \
+ || TC_FORCE_RELOCATION (FIX))
#define tc_fix_adjustable(X) tc_s390_fix_adjustable(X)
extern int tc_s390_fix_adjustable (struct fix *);
|| (FIX)->fx_r_type == BFD_RELOC_8))
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (! SEG_NORMAL (SEC) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
|| TC_FORCE_RELOCATION (FIX) \
|| (sh_relax && SWITCH_TABLE (FIX)))
can only be determined at link time. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \
- || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC)
#define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \
((!md_register_arithmetic && (SEG) == reg_section) \
#undef TC_FORCE_RELOCATION_LOCAL
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_LOW16 \
|| (FIX)->fx_r_type == BFD_RELOC_SH_PLT_MEDLOW16 \
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_LOW16 \
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDLOW16 \
|| (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDHI16 \
- || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_HI16 \
- || TC_FORCE_RELOCATION (FIX))
+ || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC_HI16)
#undef TC_FORCE_RELOCATION_SUB_SAME
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
- (! SEG_NORMAL (SEC) \
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (FIX, SEC) \
|| TC_FORCE_RELOCATION (FIX) \
|| (sh_relax && SWITCH_TABLE (FIX)) \
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL)
the .o file. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
- (!(FIX)->fx_pcrel \
+ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \
|| (sparc_pic_code \
- && S_IS_EXTERNAL ((FIX)->fx_addsy)) \
- || TC_FORCE_RELOCATION (FIX))
+ && S_IS_EXTERNAL ((FIX)->fx_addsy)))
#endif
#ifdef OBJ_ELF
#define TC_FRAG_INIT(frag) xtensa_frag_init (frag)
#define TC_FORCE_RELOCATION(fix) xtensa_force_relocation (fix)
#define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \
- (! SEG_NORMAL (seg) || xtensa_force_relocation (fix))
+ (GENERIC_FORCE_RELOCATION_SUB_SAME (fix, seg) \
+ || xtensa_force_relocation (fix))
#define TC_VALIDATE_FIX_SUB(fix, seg) xtensa_validate_fix_sub (fix)
#define NO_PSEUDO_DOT xtensa_check_inside_bundle ()
#define tc_canonicalize_symbol_name(s) xtensa_section_rename (s)
(TC_FORCE_RELOCATION (FIX))
#endif
-#ifndef TC_FORCE_RELOCATION_LOCAL
-#define TC_FORCE_RELOCATION_LOCAL(FIX) \
+#define GENERIC_FORCE_RELOCATION_LOCAL(FIX) \
(!(FIX)->fx_pcrel \
|| TC_FORCE_RELOCATION (FIX))
+#ifndef TC_FORCE_RELOCATION_LOCAL
+#define TC_FORCE_RELOCATION_LOCAL GENERIC_FORCE_RELOCATION_LOCAL
#endif
+#define GENERIC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
+ (!SEG_NORMAL (SEG))
#ifndef TC_FORCE_RELOCATION_SUB_SAME
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG))
+#define TC_FORCE_RELOCATION_SUB_SAME GENERIC_FORCE_RELOCATION_SUB_SAME
#endif
#ifndef md_register_arithmetic