From: Alan Modra Date: Mon, 15 May 2017 23:13:24 +0000 (+0930) Subject: Allow target files access to default TC_FORCE_RELOCATION defines X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91cb9803fcf6d1c7001395d80f79120ae8e6338a;p=binutils-gdb.git Allow target files access to default TC_FORCE_RELOCATION defines * 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 9d0fa57082e..9b0ea23f475 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,35 @@ +2017-05-16 Alan Modra + + * 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 PR gas/21458 diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h index d5bcce2fda1..5bf1399bfd6 100644 --- a/gas/config/tc-aarch64.h +++ b/gas/config/tc-aarch64.h @@ -109,10 +109,9 @@ void aarch64_copy_symbol_attributes (symbolS *, symbolS *); 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)) diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h index ebcf27bef83..53c49863b7a 100644 --- a/gas/config/tc-arm.h +++ b/gas/config/tc-arm.h @@ -200,17 +200,17 @@ void arm_copy_symbol_attributes (symbolS *, symbolS *); 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 \ diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h index 88b7f99d251..399656fa2ba 100644 --- a/gas/config/tc-avr.h +++ b/gas/config/tc-avr.h @@ -123,7 +123,8 @@ extern void avr_cons_fix_new (fragS *,int, int, expressionS *, 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. */ diff --git a/gas/config/tc-cris.h b/gas/config/tc-cris.h index 8737232491e..5e17c48f4df 100644 --- a/gas/config/tc-cris.h +++ b/gas/config/tc-cris.h @@ -93,9 +93,8 @@ extern int md_cris_force_relocation (struct fix *); /* 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. */ diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h index 06228df1337..f54924c4382 100644 --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -171,12 +171,11 @@ extern int tc_i386_fix_adjustable (struct fix *); 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) diff --git a/gas/config/tc-i960.h b/gas/config/tc-i960.h index 561d8687d49..96cdd319f2f 100644 --- a/gas/config/tc-i960.h +++ b/gas/config/tc-i960.h @@ -122,8 +122,8 @@ struct relocation_info /* 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 @@ -136,8 +136,7 @@ extern int reloc_callj (struct fix *); || 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 diff --git a/gas/config/tc-ia64.h b/gas/config/tc-ia64.h index 5f906dd8ef0..7e044413e03 100644 --- a/gas/config/tc-ia64.h +++ b/gas/config/tc-ia64.h @@ -320,9 +320,8 @@ typedef struct unwind_record #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 diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h index c0e2d972e0c..0e43dfa2163 100644 --- a/gas/config/tc-microblaze.h +++ b/gas/config/tc-microblaze.h @@ -44,13 +44,12 @@ extern bfd_reloc_code_real_type parse_cons_expression_microblaze #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 *); diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h index 7b780c24f1f..54e17e5513b 100644 --- a/gas/config/tc-mips.h +++ b/gas/config/tc-mips.h @@ -140,7 +140,8 @@ extern int mips_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 *); diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h index e1d3faa0c05..ff39646fc47 100644 --- a/gas/config/tc-mn10300.h +++ b/gas/config/tc-mn10300.h @@ -28,12 +28,20 @@ #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)) @@ -63,8 +71,8 @@ void mn10300_cons_fix_new (fragS *, int, int, expressionS *, 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)) diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 10e5972d870..0430f2ec6e7 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -3950,7 +3950,7 @@ md_pcrel_from_section (fixS * fixp, segT sec) 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 @@ -3964,8 +3964,7 @@ msp430_force_relocation_local (fixS *fixp) && !msp430_enable_relax) return 1; - return (!fixp->fx_pcrel - || generic_force_reloc (fixp)); + return 0; } diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h index 6789a1ec7d4..c996544b786 100644 --- a/gas/config/tc-msp430.h +++ b/gas/config/tc-msp430.h @@ -116,8 +116,9 @@ extern long md_pcrel_from_section (struct fix *, segT); 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. */ @@ -159,9 +160,9 @@ extern bfd_boolean msp430_allow_local_subtract (expressionS *, expressionS *, se 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(), diff --git a/gas/config/tc-nds32.h b/gas/config/tc-nds32.h index 08f097c48e8..d3d0c6a3892 100644 --- a/gas/config/tc-nds32.h +++ b/gas/config/tc-nds32.h @@ -91,7 +91,8 @@ extern void tc_nds32_frame_initial_instructions (void); /* 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) diff --git a/gas/config/tc-pru.h b/gas/config/tc-pru.h index e3f4300a486..2b3d9ce1e2b 100644 --- a/gas/config/tc-pru.h +++ b/gas/config/tc-pru.h @@ -97,7 +97,7 @@ extern void pru_cons_fix_new (struct frag *frag, int where, 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 diff --git a/gas/config/tc-riscv.h b/gas/config/tc-riscv.h index e92b3879a96..d79d30564ca 100644 --- a/gas/config/tc-riscv.h +++ b/gas/config/tc-riscv.h @@ -87,7 +87,9 @@ extern void riscv_pre_output_hook (void); /* 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 diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h index cb2c708db06..cf1c5603458 100644 --- a/gas/config/tc-rl78.h +++ b/gas/config/tc-rl78.h @@ -93,9 +93,9 @@ extern void rl78_elf_final_processing (void); 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 diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h index c6d85b6e97d..c29e23088ca 100644 --- a/gas/config/tc-s390.h +++ b/gas/config/tc-s390.h @@ -28,7 +28,8 @@ extern int tc_s390_force_relocation (struct fix *); /* 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 *); diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h index 4640dc5ecf2..f9a2f074be2 100644 --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -77,7 +77,7 @@ extern int sh_force_relocation (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))) @@ -204,11 +204,10 @@ extern bfd_boolean sh_fix_adjustable (struct 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) \ diff --git a/gas/config/tc-sh64.h b/gas/config/tc-sh64.h index 05b14440fee..67e1c217f3a 100644 --- a/gas/config/tc-sh64.h +++ b/gas/config/tc-sh64.h @@ -78,7 +78,7 @@ extern int sh64_target_mach (void); #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 \ @@ -102,12 +102,11 @@ extern int sh64_target_mach (void); || (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) diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h index 2b617d42ad6..3dd2483cd71 100644 --- a/gas/config/tc-sparc.h +++ b/gas/config/tc-sparc.h @@ -94,10 +94,9 @@ extern void sparc_handle_align (struct frag *); 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 diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h index 50e464073eb..257ca057bed 100644 --- a/gas/config/tc-xtensa.h +++ b/gas/config/tc-xtensa.h @@ -345,7 +345,8 @@ extern char *xtensa_section_rename (const char *); #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) diff --git a/gas/write.c b/gas/write.c index d570b6f5baf..1242cbf9985 100644 --- a/gas/write.c +++ b/gas/write.c @@ -37,15 +37,17 @@ (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