[4/4] : Add generic prototype for md_pcrel_from_section

Message ID 20200407120224.0000473d@justmail.de
State Superseded
Headers show
Series
  • Untitled series #24315
Related show

Commit Message

Gunther Nikl April 7, 2020, 10:02 a.m.
This patch removes the need for target headers to provide a custom prototype
for md_pcrel_from_section.

The following ports use the same interface version but with the port name as
a function prefix:

  - ia64:   ia64_pcrel_from_section
  - nds32:  nds32_pcrel_from_section
  - tic6x:  tic6x_pcrel_from_section
  - v850:   v850_pcrel_from_section
  - visium: visium_pcrel_from_section

The ports could be switched to the generic function name if desired.


2020-XX-XX  Gunther Nikl  <gnikl@justmail.de>

	* tc.h (md_pcrel_from_section): Add prototype.
	* config/tc-aarch64.h (md_pcrel_from_section): Remove prototype.
	* config/tc-arc.h (md_pcrel_from_section): Likewise.
	* config/tc-arm.h (md_pcrel_from_section): Likewise.
	* config/tc-avr.h (md_pcrel_from_section): Likewise.
	* config/tc-bfin.h (md_pcrel_from_section): Likewise.
	* config/tc-bpf.h (md_pcrel_from_section): Likewise.
	* config/tc-csky.h (md_pcrel_from_section): Likewise.
	* config/tc-d10v.h (md_pcrel_from_section): Likewise.
	* config/tc-d30v.h (md_pcrel_from_section): Likewise.
	* config/tc-epiphany.h (md_pcrel_from_section): Likewise.
	* config/tc-fr30.h (md_pcrel_from_section): Likewise.
	* config/tc-frv.h (md_pcrel_from_section): Likewise.
	* config/tc-iq2000.h (md_pcrel_from_section): Likewise.
	* config/tc-lm32.h (md_pcrel_from_section): Likewise.
	* config/tc-m32c.h (md_pcrel_from_section): Likewise.
	* config/tc-m32r.h (md_pcrel_from_section): Likewise.
	* config/tc-mcore.h (md_pcrel_from_section): Likewise.
	* config/tc-mep.h (md_pcrel_from_section): Likewise.
	* config/tc-metag.h (md_pcrel_from_section): Likewise.
	* config/tc-microblaze.h (md_pcrel_from_section): Likewise.
	* config/tc-mmix.h (md_pcrel_from_section): Likewise.
	* config/tc-moxie.h (md_pcrel_from_section): Likewise.
	* config/tc-msp430.h (md_pcrel_from_section): Likewise.
	* config/tc-mt.h (md_pcrel_from_section): Likewise.
	* config/tc-or1k.h (md_pcrel_from_section): Likewise.
	* config/tc-ppc.h (md_pcrel_from_section): Likewise.
	* config/tc-rl78.h (md_pcrel_from_section): Likewise.
	* config/tc-rx.h (md_pcrel_from_section): Likewise.
	* config/tc-s390.h (md_pcrel_from_section): Likewise.
	* config/tc-sh.h (md_pcrel_from_section): Likewise.
	* config/tc-xc16x.h (md_pcrel_from_section): Likewise.
	* config/tc-xstormy16.h (md_pcrel_from_section): Likewise.

Comments

H.J. Lu via Binutils April 8, 2020, 11:29 a.m. | #1
Hi Gunther,

> This patch removes the need for target headers to provide a custom prototype

> for md_pcrel_from_section.


Approved and applied.

> The following ports use the same interface version but with the port name as

> a function prefix:

> 

>   - ia64:   ia64_pcrel_from_section

>   - nds32:  nds32_pcrel_from_section

>   - tic6x:  tic6x_pcrel_from_section

>   - v850:   v850_pcrel_from_section

>   - visium: visium_pcrel_from_section


I do not think that there is any need for this.  Using target specific
names helps to emphasise that the functions have target specific actions.

Cheers
  Nick


> 2020-XX-XX  Gunther Nikl  <gnikl@justmail.de>

> 

> 	* tc.h (md_pcrel_from_section): Add prototype.

> 	* config/tc-aarch64.h (md_pcrel_from_section): Remove prototype.

> 	* config/tc-arc.h (md_pcrel_from_section): Likewise.

> 	* config/tc-arm.h (md_pcrel_from_section): Likewise.

> 	* config/tc-avr.h (md_pcrel_from_section): Likewise.

> 	* config/tc-bfin.h (md_pcrel_from_section): Likewise.

> 	* config/tc-bpf.h (md_pcrel_from_section): Likewise.

> 	* config/tc-csky.h (md_pcrel_from_section): Likewise.

> 	* config/tc-d10v.h (md_pcrel_from_section): Likewise.

> 	* config/tc-d30v.h (md_pcrel_from_section): Likewise.

> 	* config/tc-epiphany.h (md_pcrel_from_section): Likewise.

> 	* config/tc-fr30.h (md_pcrel_from_section): Likewise.

> 	* config/tc-frv.h (md_pcrel_from_section): Likewise.

> 	* config/tc-iq2000.h (md_pcrel_from_section): Likewise.

> 	* config/tc-lm32.h (md_pcrel_from_section): Likewise.

> 	* config/tc-m32c.h (md_pcrel_from_section): Likewise.

> 	* config/tc-m32r.h (md_pcrel_from_section): Likewise.

> 	* config/tc-mcore.h (md_pcrel_from_section): Likewise.

> 	* config/tc-mep.h (md_pcrel_from_section): Likewise.

> 	* config/tc-metag.h (md_pcrel_from_section): Likewise.

> 	* config/tc-microblaze.h (md_pcrel_from_section): Likewise.

> 	* config/tc-mmix.h (md_pcrel_from_section): Likewise.

> 	* config/tc-moxie.h (md_pcrel_from_section): Likewise.

> 	* config/tc-msp430.h (md_pcrel_from_section): Likewise.

> 	* config/tc-mt.h (md_pcrel_from_section): Likewise.

> 	* config/tc-or1k.h (md_pcrel_from_section): Likewise.

> 	* config/tc-ppc.h (md_pcrel_from_section): Likewise.

> 	* config/tc-rl78.h (md_pcrel_from_section): Likewise.

> 	* config/tc-rx.h (md_pcrel_from_section): Likewise.

> 	* config/tc-s390.h (md_pcrel_from_section): Likewise.

> 	* config/tc-sh.h (md_pcrel_from_section): Likewise.

> 	* config/tc-xc16x.h (md_pcrel_from_section): Likewise.

> 	* config/tc-xstormy16.h (md_pcrel_from_section): Likewise.

> 

> diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h

> index e3fd68818f..fad4da1ded 100644

> --- a/gas/config/tc-aarch64.h

> +++ b/gas/config/tc-aarch64.h

> @@ -255,7 +255,6 @@ extern void aarch64_after_parse_args (void);

>  

>  #define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S)

>  

> -extern long md_pcrel_from_section (struct fix *, segT);

>  extern void aarch64_frag_align_code (int, int);

>  extern const char * elf64_aarch64_target_format (void);

>  extern int aarch64_force_relocation (struct fix *);

> diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h

> index b8eee4fb05..2aa61e0ef8 100644

> --- a/gas/config/tc-arc.h

> +++ b/gas/config/tc-arc.h

> @@ -101,7 +101,6 @@ extern const char *arc_target_format;

>     instruction, plus the address of the PC relative fixup.  The latter

>     can be calculated as fixp->fx_where +

>     fixp->fx_frag->fr_address.  */

> -extern long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

>  

>  /* [ ] is index operator.  */

> diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h

> index c01223fa6d..5e32eac637 100644

> --- a/gas/config/tc-arm.h

> +++ b/gas/config/tc-arm.h

> @@ -340,7 +340,6 @@ struct arm_segment_info_type

>  

>  #define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S)

>  

> -extern long md_pcrel_from_section (struct fix *, segT);

>  extern void arm_frag_align_code (int, int);

>  extern void arm_validate_fix (struct fix *);

>  extern const char * elf32_arm_target_format (void);

> diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h

> index 1920873ec5..154bf8ad7d 100644

> --- a/gas/config/tc-avr.h

> +++ b/gas/config/tc-avr.h

> @@ -136,7 +136,6 @@ extern int avr_force_relocation (struct fix *);

>     of a PC relative instruction is the next instruction, so this

>     macro would return the length of an instruction.  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* The number of bytes to put into a word in a listing.  This affects

>     the way the bytes are clumped together in the listing.  For

> diff --git a/gas/config/tc-bfin.h b/gas/config/tc-bfin.h

> index c4b15075ac..b9bc06bd73 100644

> --- a/gas/config/tc-bfin.h

> +++ b/gas/config/tc-bfin.h

> @@ -68,7 +68,6 @@ extern int bfin_force_relocation (struct fix *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* Values passed to md_apply_fix3 don't include symbol values.  */

>  #define MD_APPLY_SYM_VALUE(FIX) 0

> diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h

> index 5f50a6594f..5765833997 100644

> --- a/gas/config/tc-bpf.h

> +++ b/gas/config/tc-bpf.h

> @@ -41,7 +41,6 @@

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* We don't need to handle .word strangely.  */

>  #define WORKING_DOT_WORD

> diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h

> index f982475c85..e39e106de6 100644

> --- a/gas/config/tc-csky.h

> +++ b/gas/config/tc-csky.h

> @@ -91,7 +91,6 @@ struct tls_addend

>  extern const relax_typeS csky_relax_table [];

>  

>  extern void md_csky_end (void);

> -extern long md_pcrel_from_section (fixS *, segT);

>  extern void csky_cons_fix_new (fragS *,

>  			       unsigned int off,

>  			       unsigned int len,

> diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h

> index da6dcc74ba..fcd16744e0 100644

> --- a/gas/config/tc-d10v.h

> +++ b/gas/config/tc-d10v.h

> @@ -21,6 +21,8 @@

>  

>  #define TC_D10V

>  

> +struct fix;

> +

>  #define TARGET_BYTES_BIG_ENDIAN 1

>  

>  /* The target BFD architecture.  */

> @@ -30,8 +32,6 @@

>  

>  /* Call md_pcrel_from_section, not md_pcrel_from.  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -struct fix;

> -long md_pcrel_from_section (struct fix *, segT);

>  

>  /* Permit temporary numeric labels.  */

>  #define LOCAL_LABELS_FB 1

> diff --git a/gas/config/tc-d30v.h b/gas/config/tc-d30v.h

> index 65a7ec6c44..0454d44ddf 100644

> --- a/gas/config/tc-d30v.h

> +++ b/gas/config/tc-d30v.h

> @@ -29,8 +29,6 @@

>  #define md_operand(x)

>  

>  /* Call md_pcrel_from_section, not md_pcrel_from.  */

> -struct fix;

> -extern long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

>  

>  /* Permit temporary numeric labels.  */

> diff --git a/gas/config/tc-epiphany.h b/gas/config/tc-epiphany.h

> index 19f5b13520..2f6c2cccf7 100644

> --- a/gas/config/tc-epiphany.h

> +++ b/gas/config/tc-epiphany.h

> @@ -48,7 +48,6 @@

>  #define tc_fix_adjustable(FIX) epiphany_fix_adjustable (FIX)

>  extern bfd_boolean epiphany_fix_adjustable (struct fix *);

>  

> -extern long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP,SEC)

>  

>  #define TC_HANDLES_FX_DONE

> diff --git a/gas/config/tc-fr30.h b/gas/config/tc-fr30.h

> index a633f1eedc..8169d6887f 100644

> --- a/gas/config/tc-fr30.h

> +++ b/gas/config/tc-fr30.h

> @@ -50,7 +50,6 @@ extern bfd_boolean fr30_fix_adjustable (struct fix *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* For 8 vs 16 vs 32 bit branch selection.  */

>  #define TC_GENERIC_RELAX_TABLE md_relax_table

> diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h

> index f43376cc2a..444b26b6e4 100644

> --- a/gas/config/tc-frv.h

> +++ b/gas/config/tc-frv.h

> @@ -76,7 +76,6 @@ void frv_frob_label (symbolS *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* After all of the symbols have been adjusted, go over the file looking

>     for any relocations that pic won't support.  */

> diff --git a/gas/config/tc-iq2000.h b/gas/config/tc-iq2000.h

> index ad098e311f..31ed49f3c6 100644

> --- a/gas/config/tc-iq2000.h

> +++ b/gas/config/tc-iq2000.h

> @@ -62,4 +62,3 @@

>  extern void         iq2000_frob_file         (void);

>  extern bfd_boolean  iq2000_fix_adjustable    (struct fix *);

>  extern int          iq2000_force_relocation  (struct fix *);

> -extern long         md_pcrel_from_section    (struct fix *, segT);

> diff --git a/gas/config/tc-lm32.h b/gas/config/tc-lm32.h

> index a0231c0561..930106ff44 100644

> --- a/gas/config/tc-lm32.h

> +++ b/gas/config/tc-lm32.h

> @@ -40,7 +40,6 @@

>  #define tc_gen_reloc gas_cgen_tc_gen_reloc

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

> -extern long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

>  

>  extern bfd_boolean lm32_fix_adjustable (struct fix *);

> diff --git a/gas/config/tc-m32c.h b/gas/config/tc-m32c.h

> index aa38116246..5be71977d6 100644

> --- a/gas/config/tc-m32c.h

> +++ b/gas/config/tc-m32c.h

> @@ -71,7 +67,6 @@ extern void m32c_prepare_relax_scan (fragS *, offsetT *, relax_substateT);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* We need a special version of the TC_START_LABEL macro so that we

>     allow the :Z, :S, :Q and :G suffixes to be

> diff --git a/gas/config/tc-m32r.h b/gas/config/tc-m32r.h

> index d56916b181..c123bdcb19 100644

> --- a/gas/config/tc-m32r.h

> +++ b/gas/config/tc-m32r.h

> @@ -37,7 +37,6 @@ extern const char *m32r_target_format (void);

>  #endif

>  

>  /* Call md_pcrel_from_section, not md_pcrel_from.  */

> -long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)

>  

>  /* Permit temporary numeric labels.  */

> diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h

> index 370a319496..e4fba15285 100644

> --- a/gas/config/tc-mcore.h

> +++ b/gas/config/tc-mcore.h

> @@ -87,7 +87,6 @@ struct mcore_tc_sy

>  #include "write.h"        /* For definition of fixS */

>  

>  extern void        md_mcore_end           (void);

> -extern long        md_pcrel_from_section  (fixS *, segT);

>  extern arelent *   tc_gen_reloc           (asection *, fixS *);

>  extern int         mcore_force_relocation (fixS *);

>  extern bfd_boolean mcore_fix_adjustable   (fixS *);

> diff --git a/gas/config/tc-mep.h b/gas/config/tc-mep.h

> index 69535bc93f..d3eb3d7702 100644

> --- a/gas/config/tc-mep.h

> +++ b/gas/config/tc-mep.h

> @@ -53,7 +53,6 @@ extern void mep_apply_fix (struct fix *, valueT *, segT);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define tc_frob_file() mep_frob_file ()

>  extern void mep_frob_file (void);

> diff --git a/gas/config/tc-metag.h b/gas/config/tc-metag.h

> index 69016fe3ad..27ed167830 100644

> --- a/gas/config/tc-metag.h

> +++ b/gas/config/tc-metag.h

> @@ -51,7 +51,6 @@ extern int metag_force_relocation (struct fix *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define HANDLE_ALIGN(fragp) metag_handle_align (fragp)

>  extern void metag_handle_align (struct frag *);

> diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h

> index a84e7e4035..35f53a0547 100644

> --- a/gas/config/tc-microblaze.h

> +++ b/gas/config/tc-microblaze.h

> @@ -94,9 +94,6 @@ extern const struct relax_type md_relax_table[];

>  # error No target format specified.

>  #endif

>  

> -#include "write.h"        /* For definition of fixS */

> -

> -extern long      md_pcrel_from_section         (fixS *, segT);

>  extern void 	 cons_fix_new_microblaze       (fragS *, int, int,

>  						expressionS *,

>  						bfd_reloc_code_real_type);

> diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h

> index 2f5cf3113e..d9e8599c88 100644

> --- a/gas/config/tc-mmix.h

> +++ b/gas/config/tc-mmix.h

> @@ -168,7 +168,6 @@ extern int mmix_force_relocation (struct fix *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define md_section_align(seg, size) (size)

>  

> diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h

> index 50feca4888..4fb40eda4b 100644

> --- a/gas/config/tc-msp430.h

> +++ b/gas/config/tc-msp430.h

> @@ -91,8 +91,6 @@

>       of a PC relative instruction is the next instruction, so this

>       macro would return the length of an instruction.  */

>  

> -extern long md_pcrel_from_section (struct fix *, segT);

> -

>  #define LISTING_WORD_SIZE 2

>  /*   The number of bytes to put into a word in a listing.  This affects

>       the way the bytes are clumped together in the listing.  For

> diff --git a/gas/config/tc-mt.h b/gas/config/tc-mt.h

> index 54c753a8eb..aacb2873f4 100644

> --- a/gas/config/tc-mt.h

> +++ b/gas/config/tc-mt.h

> @@ -48,7 +48,6 @@ extern void mt_apply_fix (struct fix *, valueT *, segT);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define obj_fix_adjustable(fixP) iq2000_fix_adjustable (fixP)

>  extern bfd_boolean mt_fix_adjustable (struct fix *);

> diff --git a/gas/config/tc-or1k.h b/gas/config/tc-or1k.h

> index 6dce33a1f1..0242dd480f 100644

> --- a/gas/config/tc-or1k.h

> +++ b/gas/config/tc-or1k.h

> @@ -50,7 +50,6 @@ extern bfd_boolean or1k_fix_adjustable (struct fix *);

>  #define tc_fix_adjustable(FIX) or1k_fix_adjustable (FIX)

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

> -extern long md_pcrel_from_section (struct fix *, segT);

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

>  

>  /* For 8 vs 16 vs 32 bit branch selection.  */

> diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h

> index 4df7982fcf..bfe61294da 100644

> --- a/gas/config/tc-ppc.h

> +++ b/gas/config/tc-ppc.h

> @@ -297,7 +297,6 @@ extern void ppc_frob_label (symbolS *);

>  

>  /* call md_pcrel_from_section, not md_pcrel_from */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp)

>  extern int ppc_parse_name (const char *, struct expressionS *);

> diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h

> index f69458db8d..d0680ba682 100644

> --- a/gas/config/tc-rl78.h

> +++ b/gas/config/tc-rl78.h

> @@ -58,7 +58,6 @@ extern void rl78_frag_init (fragS *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* RL78 doesn't have a 32 bit PCREL relocations.  */

>  #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1

> diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h

> index 1448c64fdb..0bb25e8bd3 100644

> --- a/gas/config/tc-rx.h

> +++ b/gas/config/tc-rx.h

> @@ -70,7 +70,6 @@ extern void rx_frag_init (fragS *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* RX doesn't have a 32 bit PCREL relocations.  */

>  #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1

> diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h

> index 0f54f5a8c8..d9bc231a84 100644

> --- a/gas/config/tc-s390.h

> +++ b/gas/config/tc-s390.h

> @@ -75,7 +75,6 @@ extern int target_big_endian;

>  

>  /* call md_pcrel_from_section, not md_pcrel_from */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define md_operand(x)

>  

> diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h

> index d7dd764d24..2526332233 100644

> --- a/gas/config/tc-sh.h

> +++ b/gas/config/tc-sh.h

> @@ -87,7 +87,6 @@ extern int sh_force_relocation (struct fix *);

>     && sh_relax && SWITCH_TABLE (FIX))

>  

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  /* SH_COUNT relocs are allowed outside of frag.

>     The target is also buggy and sets fix size too large for other relocs.  */

> diff --git a/gas/config/tc-xc16x.h b/gas/config/tc-xc16x.h

> index 032f47a2f7..c210b6e10b 100644

> --- a/gas/config/tc-xc16x.h

> +++ b/gas/config/tc-xc16x.h

> @@ -55,6 +55,5 @@ extern void tc_reloc_mangle (struct fix *, struct internal_reloc *, bfd_vma);

>  #define LISTING_HEADER "Infineon XC16X GAS "

>  #define NEED_FX_R_TYPE 1

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define md_operand(x)

> diff --git a/gas/config/tc-xstormy16.h b/gas/config/tc-xstormy16.h

> index d08fa90a04..8d7231bce9 100644

> --- a/gas/config/tc-xstormy16.h

> +++ b/gas/config/tc-xstormy16.h

> @@ -54,7 +54,6 @@ extern int xstormy16_force_relocation (struct fix *);

>  

>  /* Call md_pcrel_from_section(), not md_pcrel_from().  */

>  #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)

> -extern long md_pcrel_from_section (struct fix *, segT);

>  

>  #define TC_CONS_FIX_NEW xstormy16_cons_fix_new

>  extern void xstormy16_cons_fix_new (fragS *f, int, int, expressionS *,

> diff --git a/gas/tc.h b/gas/tc.h

> index 8be65fdc18..da1738d67a 100644

> --- a/gas/tc.h

> +++ b/gas/tc.h

> @@ -54,6 +54,9 @@ void    md_create_short_jump (char *, addressT, addressT, fragS *, symbolS *);

>  #ifndef md_pcrel_from

>  long    md_pcrel_from (fixS *);

>  #endif

> +#ifndef md_pcrel_from_section

> +long    md_pcrel_from_section (fixS *, segT);

> +#endif

>  #ifndef md_operand

>  void    md_operand (expressionS *);

>  #endif

>
Gunther Nikl April 9, 2020, 7:29 p.m. | #2
Nick Clifton <nickc@redhat.com> wrote:

> Hi Gunther,

> 

> > This patch removes the need for target headers to provide a custom

> > prototype for md_pcrel_from_section.

> 

> Approved and applied.


Thank you for taking care of the patch series. Sorry I botched the
submission. I only realized after sending the mails that I should have
sent the patches as a reply of the introduction mail :-/

> > The following ports use the same interface version but with the

> > port name as a function prefix:

> > 

> >   - ia64:   ia64_pcrel_from_section

> >   - nds32:  nds32_pcrel_from_section

> >   - tic6x:  tic6x_pcrel_from_section

> >   - v850:   v850_pcrel_from_section

> >   - visium: visium_pcrel_from_section

> 

> I do not think that there is any need for this.  Using target specific

> names helps to emphasise that the functions have target specific

> actions.


FWIW, I agree. I just mentioned it to make it visible.

Regards,
Gunther

Patch

diff --git a/gas/config/tc-aarch64.h b/gas/config/tc-aarch64.h
index e3fd68818f..fad4da1ded 100644
--- a/gas/config/tc-aarch64.h
+++ b/gas/config/tc-aarch64.h
@@ -255,7 +255,6 @@  extern void aarch64_after_parse_args (void);
 
 #define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S)
 
-extern long md_pcrel_from_section (struct fix *, segT);
 extern void aarch64_frag_align_code (int, int);
 extern const char * elf64_aarch64_target_format (void);
 extern int aarch64_force_relocation (struct fix *);
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index b8eee4fb05..2aa61e0ef8 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -101,7 +101,6 @@  extern const char *arc_target_format;
    instruction, plus the address of the PC relative fixup.  The latter
    can be calculated as fixp->fx_where +
    fixp->fx_frag->fr_address.  */
-extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
 
 /* [ ] is index operator.  */
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index c01223fa6d..5e32eac637 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -340,7 +340,6 @@  struct arm_segment_info_type
 
 #define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section(F,S)
 
-extern long md_pcrel_from_section (struct fix *, segT);
 extern void arm_frag_align_code (int, int);
 extern void arm_validate_fix (struct fix *);
 extern const char * elf32_arm_target_format (void);
diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h
index 1920873ec5..154bf8ad7d 100644
--- a/gas/config/tc-avr.h
+++ b/gas/config/tc-avr.h
@@ -136,7 +136,6 @@  extern int avr_force_relocation (struct fix *);
    of a PC relative instruction is the next instruction, so this
    macro would return the length of an instruction.  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* The number of bytes to put into a word in a listing.  This affects
    the way the bytes are clumped together in the listing.  For
diff --git a/gas/config/tc-bfin.h b/gas/config/tc-bfin.h
index c4b15075ac..b9bc06bd73 100644
--- a/gas/config/tc-bfin.h
+++ b/gas/config/tc-bfin.h
@@ -68,7 +68,6 @@  extern int bfin_force_relocation (struct fix *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* Values passed to md_apply_fix3 don't include symbol values.  */
 #define MD_APPLY_SYM_VALUE(FIX) 0
diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h
index 5f50a6594f..5765833997 100644
--- a/gas/config/tc-bpf.h
+++ b/gas/config/tc-bpf.h
@@ -41,7 +41,6 @@ 
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* We don't need to handle .word strangely.  */
 #define WORKING_DOT_WORD
diff --git a/gas/config/tc-csky.h b/gas/config/tc-csky.h
index f982475c85..e39e106de6 100644
--- a/gas/config/tc-csky.h
+++ b/gas/config/tc-csky.h
@@ -91,7 +91,6 @@  struct tls_addend
 extern const relax_typeS csky_relax_table [];
 
 extern void md_csky_end (void);
-extern long md_pcrel_from_section (fixS *, segT);
 extern void csky_cons_fix_new (fragS *,
 			       unsigned int off,
 			       unsigned int len,
diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h
index da6dcc74ba..fcd16744e0 100644
--- a/gas/config/tc-d10v.h
+++ b/gas/config/tc-d10v.h
@@ -21,6 +21,8 @@ 
 
 #define TC_D10V
 
+struct fix;
+
 #define TARGET_BYTES_BIG_ENDIAN 1
 
 /* The target BFD architecture.  */
@@ -30,8 +32,6 @@ 
 
 /* Call md_pcrel_from_section, not md_pcrel_from.  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-struct fix;
-long md_pcrel_from_section (struct fix *, segT);
 
 /* Permit temporary numeric labels.  */
 #define LOCAL_LABELS_FB 1
diff --git a/gas/config/tc-d30v.h b/gas/config/tc-d30v.h
index 65a7ec6c44..0454d44ddf 100644
--- a/gas/config/tc-d30v.h
+++ b/gas/config/tc-d30v.h
@@ -29,8 +29,6 @@ 
 #define md_operand(x)
 
 /* Call md_pcrel_from_section, not md_pcrel_from.  */
-struct fix;
-extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
 
 /* Permit temporary numeric labels.  */
diff --git a/gas/config/tc-epiphany.h b/gas/config/tc-epiphany.h
index 19f5b13520..2f6c2cccf7 100644
--- a/gas/config/tc-epiphany.h
+++ b/gas/config/tc-epiphany.h
@@ -48,7 +48,6 @@ 
 #define tc_fix_adjustable(FIX) epiphany_fix_adjustable (FIX)
 extern bfd_boolean epiphany_fix_adjustable (struct fix *);
 
-extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP,SEC)
 
 #define TC_HANDLES_FX_DONE
diff --git a/gas/config/tc-fr30.h b/gas/config/tc-fr30.h
index a633f1eedc..8169d6887f 100644
--- a/gas/config/tc-fr30.h
+++ b/gas/config/tc-fr30.h
@@ -50,7 +50,6 @@  extern bfd_boolean fr30_fix_adjustable (struct fix *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* For 8 vs 16 vs 32 bit branch selection.  */
 #define TC_GENERIC_RELAX_TABLE md_relax_table
diff --git a/gas/config/tc-frv.h b/gas/config/tc-frv.h
index f43376cc2a..444b26b6e4 100644
--- a/gas/config/tc-frv.h
+++ b/gas/config/tc-frv.h
@@ -76,7 +76,6 @@  void frv_frob_label (symbolS *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* After all of the symbols have been adjusted, go over the file looking
    for any relocations that pic won't support.  */
diff --git a/gas/config/tc-iq2000.h b/gas/config/tc-iq2000.h
index ad098e311f..31ed49f3c6 100644
--- a/gas/config/tc-iq2000.h
+++ b/gas/config/tc-iq2000.h
@@ -62,4 +62,3 @@ 
 extern void         iq2000_frob_file         (void);
 extern bfd_boolean  iq2000_fix_adjustable    (struct fix *);
 extern int          iq2000_force_relocation  (struct fix *);
-extern long         md_pcrel_from_section    (struct fix *, segT);
diff --git a/gas/config/tc-lm32.h b/gas/config/tc-lm32.h
index a0231c0561..930106ff44 100644
--- a/gas/config/tc-lm32.h
+++ b/gas/config/tc-lm32.h
@@ -40,7 +40,6 @@ 
 #define tc_gen_reloc gas_cgen_tc_gen_reloc
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
-extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
 
 extern bfd_boolean lm32_fix_adjustable (struct fix *);
diff --git a/gas/config/tc-m32c.h b/gas/config/tc-m32c.h
index aa38116246..5be71977d6 100644
--- a/gas/config/tc-m32c.h
+++ b/gas/config/tc-m32c.h
@@ -71,7 +67,6 @@  extern void m32c_prepare_relax_scan (fragS *, offsetT *, relax_substateT);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* We need a special version of the TC_START_LABEL macro so that we
    allow the :Z, :S, :Q and :G suffixes to be
diff --git a/gas/config/tc-m32r.h b/gas/config/tc-m32r.h
index d56916b181..c123bdcb19 100644
--- a/gas/config/tc-m32r.h
+++ b/gas/config/tc-m32r.h
@@ -37,7 +37,6 @@  extern const char *m32r_target_format (void);
 #endif
 
 /* Call md_pcrel_from_section, not md_pcrel_from.  */
-long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
 
 /* Permit temporary numeric labels.  */
diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h
index 370a319496..e4fba15285 100644
--- a/gas/config/tc-mcore.h
+++ b/gas/config/tc-mcore.h
@@ -87,7 +87,6 @@  struct mcore_tc_sy
 #include "write.h"        /* For definition of fixS */
 
 extern void        md_mcore_end           (void);
-extern long        md_pcrel_from_section  (fixS *, segT);
 extern arelent *   tc_gen_reloc           (asection *, fixS *);
 extern int         mcore_force_relocation (fixS *);
 extern bfd_boolean mcore_fix_adjustable   (fixS *);
diff --git a/gas/config/tc-mep.h b/gas/config/tc-mep.h
index 69535bc93f..d3eb3d7702 100644
--- a/gas/config/tc-mep.h
+++ b/gas/config/tc-mep.h
@@ -53,7 +53,6 @@  extern void mep_apply_fix (struct fix *, valueT *, segT);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define tc_frob_file() mep_frob_file ()
 extern void mep_frob_file (void);
diff --git a/gas/config/tc-metag.h b/gas/config/tc-metag.h
index 69016fe3ad..27ed167830 100644
--- a/gas/config/tc-metag.h
+++ b/gas/config/tc-metag.h
@@ -51,7 +51,6 @@  extern int metag_force_relocation (struct fix *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define HANDLE_ALIGN(fragp) metag_handle_align (fragp)
 extern void metag_handle_align (struct frag *);
diff --git a/gas/config/tc-microblaze.h b/gas/config/tc-microblaze.h
index a84e7e4035..35f53a0547 100644
--- a/gas/config/tc-microblaze.h
+++ b/gas/config/tc-microblaze.h
@@ -94,9 +94,6 @@  extern const struct relax_type md_relax_table[];
 # error No target format specified.
 #endif
 
-#include "write.h"        /* For definition of fixS */
-
-extern long      md_pcrel_from_section         (fixS *, segT);
 extern void 	 cons_fix_new_microblaze       (fragS *, int, int,
 						expressionS *,
 						bfd_reloc_code_real_type);
diff --git a/gas/config/tc-mmix.h b/gas/config/tc-mmix.h
index 2f5cf3113e..d9e8599c88 100644
--- a/gas/config/tc-mmix.h
+++ b/gas/config/tc-mmix.h
@@ -168,7 +168,6 @@  extern int mmix_force_relocation (struct fix *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define md_section_align(seg, size) (size)
 
diff --git a/gas/config/tc-msp430.h b/gas/config/tc-msp430.h
index 50feca4888..4fb40eda4b 100644
--- a/gas/config/tc-msp430.h
+++ b/gas/config/tc-msp430.h
@@ -91,8 +91,6 @@ 
      of a PC relative instruction is the next instruction, so this
      macro would return the length of an instruction.  */
 
-extern long md_pcrel_from_section (struct fix *, segT);
-
 #define LISTING_WORD_SIZE 2
 /*   The number of bytes to put into a word in a listing.  This affects
      the way the bytes are clumped together in the listing.  For
diff --git a/gas/config/tc-mt.h b/gas/config/tc-mt.h
index 54c753a8eb..aacb2873f4 100644
--- a/gas/config/tc-mt.h
+++ b/gas/config/tc-mt.h
@@ -48,7 +48,6 @@  extern void mt_apply_fix (struct fix *, valueT *, segT);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define obj_fix_adjustable(fixP) iq2000_fix_adjustable (fixP)
 extern bfd_boolean mt_fix_adjustable (struct fix *);
diff --git a/gas/config/tc-or1k.h b/gas/config/tc-or1k.h
index 6dce33a1f1..0242dd480f 100644
--- a/gas/config/tc-or1k.h
+++ b/gas/config/tc-or1k.h
@@ -50,7 +50,6 @@  extern bfd_boolean or1k_fix_adjustable (struct fix *);
 #define tc_fix_adjustable(FIX) or1k_fix_adjustable (FIX)
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
-extern long md_pcrel_from_section (struct fix *, segT);
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
 
 /* For 8 vs 16 vs 32 bit branch selection.  */
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index 4df7982fcf..bfe61294da 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -297,7 +297,6 @@  extern void ppc_frob_label (symbolS *);
 
 /* call md_pcrel_from_section, not md_pcrel_from */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define md_parse_name(name, exp, mode, c) ppc_parse_name (name, exp)
 extern int ppc_parse_name (const char *, struct expressionS *);
diff --git a/gas/config/tc-rl78.h b/gas/config/tc-rl78.h
index f69458db8d..d0680ba682 100644
--- a/gas/config/tc-rl78.h
+++ b/gas/config/tc-rl78.h
@@ -58,7 +58,6 @@  extern void rl78_frag_init (fragS *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* RL78 doesn't have a 32 bit PCREL relocations.  */
 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
diff --git a/gas/config/tc-rx.h b/gas/config/tc-rx.h
index 1448c64fdb..0bb25e8bd3 100644
--- a/gas/config/tc-rx.h
+++ b/gas/config/tc-rx.h
@@ -70,7 +70,6 @@  extern void rx_frag_init (fragS *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* RX doesn't have a 32 bit PCREL relocations.  */
 #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) 1
diff --git a/gas/config/tc-s390.h b/gas/config/tc-s390.h
index 0f54f5a8c8..d9bc231a84 100644
--- a/gas/config/tc-s390.h
+++ b/gas/config/tc-s390.h
@@ -75,7 +75,6 @@  extern int target_big_endian;
 
 /* call md_pcrel_from_section, not md_pcrel_from */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define md_operand(x)
 
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index d7dd764d24..2526332233 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -87,7 +87,6 @@  extern int sh_force_relocation (struct fix *);
    && sh_relax && SWITCH_TABLE (FIX))
 
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 /* SH_COUNT relocs are allowed outside of frag.
    The target is also buggy and sets fix size too large for other relocs.  */
diff --git a/gas/config/tc-xc16x.h b/gas/config/tc-xc16x.h
index 032f47a2f7..c210b6e10b 100644
--- a/gas/config/tc-xc16x.h
+++ b/gas/config/tc-xc16x.h
@@ -55,6 +55,5 @@  extern void tc_reloc_mangle (struct fix *, struct internal_reloc *, bfd_vma);
 #define LISTING_HEADER "Infineon XC16X GAS "
 #define NEED_FX_R_TYPE 1
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define md_operand(x)
diff --git a/gas/config/tc-xstormy16.h b/gas/config/tc-xstormy16.h
index d08fa90a04..8d7231bce9 100644
--- a/gas/config/tc-xstormy16.h
+++ b/gas/config/tc-xstormy16.h
@@ -54,7 +54,6 @@  extern int xstormy16_force_relocation (struct fix *);
 
 /* Call md_pcrel_from_section(), not md_pcrel_from().  */
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section (FIX, SEC)
-extern long md_pcrel_from_section (struct fix *, segT);
 
 #define TC_CONS_FIX_NEW xstormy16_cons_fix_new
 extern void xstormy16_cons_fix_new (fragS *f, int, int, expressionS *,
diff --git a/gas/tc.h b/gas/tc.h
index 8be65fdc18..da1738d67a 100644
--- a/gas/tc.h
+++ b/gas/tc.h
@@ -54,6 +54,9 @@  void    md_create_short_jump (char *, addressT, addressT, fragS *, symbolS *);
 #ifndef md_pcrel_from
 long    md_pcrel_from (fixS *);
 #endif
+#ifndef md_pcrel_from_section
+long    md_pcrel_from_section (fixS *, segT);
+#endif
 #ifndef md_operand
 void    md_operand (expressionS *);
 #endif