aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-01-23 12:51:05 +0000
committerAlan Modra <amodra@gmail.com>2003-01-23 12:51:05 +0000
commitae6063d440ba5ec28af81e9fc899cc099561339e (patch)
tree739cce858065e76a0b0a86f4623429db35efb071
parentf0abc2a11f47c3ecdfe0b54421092d17c70fc5f2 (diff)
downloadgdb-ae6063d440ba5ec28af81e9fc899cc099561339e.zip
gdb-ae6063d440ba5ec28af81e9fc899cc099561339e.tar.gz
gdb-ae6063d440ba5ec28af81e9fc899cc099561339e.tar.bz2
* symbols.c (S_FORCE_RELOC): Add "strict" param.
* symbols.h (S_FORCE_RELOC): Likewise. * config/obj-aout.h (S_FORCE_RELOC): Likewise. * config/obj-bout.h (S_FORCE_RELOC): Likewise. * config/obj-coff.h (S_FORCE_RELOC): Likewise. * config/obj-ieee.h (S_FORCE_RELOC): Likewise. * config/obj-vms.h (S_FORCE_RELOC): Likewise. * write.c (generic_force_reloc): New function. (TC_FORCE_RELOCATION): Use it here instead of S_FORCE_RELOC. (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too. (adjust_reloc_syms): Adjust S_FORCE_RELOC call. * as.h (generic_force_reloc): Declare. * doc/internals.texi (S_FORCE_RELOC): Update. (TC_FORCE_RELOCATION_SUB_SAME): Update. * config/tc-alpha.c (alpha_force_relocation): Adjust to use generic_force_reloc. (alpha_fix_adjustable): Likewise. * config/tc-arm.c (arm_force_relocation): Likewise. * config/tc-cris.c (md_cris_force_relocation): Likewise. * config/tc-frv.c (frv_force_relocation): Likewise. * config/tc-i386.c (md_apply_fix3): Likewise. * config/tc-ia64.c (ia64_force_relocation): Likewise. * config/tc-ip2k.c (ip2k_force_relocation): Likewise. * config/tc-m32r.c (m32r_force_relocation): Likewise. * config/tc-m68hc11.c (tc_m68hc11_force_relocation): Likewise. * config/tc-mcore.c (mcore_force_relocation): Likewise. * config/tc-mips.c (mips_force_relocation): Likewise. * config/tc-mmix.c (mmix_force_relocation): Likewise. * config/tc-ppc.c (ppc_force_relocation): Likewise. * config/tc-s390.c (tc_s390_force_relocation): Likewise. * config/tc-sh.c (sh_force_relocation): Likewise. (md_pcrel_from_section): Likewise. * config/tc-sparc.c (tc_gen_reloc): Likewise. * config/tc-v850.c (v850_force_relocation): Likewise. * config/tc-xstormy16.c (xstormy16_force_relocation): Likewise. * config/tc-i386.h (TC_FORCE_RELOCATION): Likewise. * config/tc-mcore.h (TC_FORCE_RELOCATION): Likewise. * config/tc-sparc.h (tc_fix_adjustable): Likewise. * config/tc-d10v.c (d10v_force_relocation): Delete. * config/tc-d10v.h (TC_FORCE_RELOCATION): Don't define. * config/tc-dlx.c (md_dlx_force_relocation): Delete. * config/tc-dlx.h (TC_FORCE_RELOCATION): Don't define. * config/tc-fr30.c (fr30_force_relocation): Delete. * config/tc-fr30.h (TC_FORCE_RELOCATION): Don't define. * config/tc-mn10300.c (mn10300_force_relocation): Delete. * config/tc-mn10300.h (TC_FORCE_RELOCATION): Don't define. (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too. * config/tc-i960.h (TC_FORCE_RELOCATION_SUB_SAME): Likewise. * config/tc-hppa.c (hppa_force_relocation): Adjust S_FORCE_RELOC call. * config/tc-mips.c (RELAX_BRANCH_TOOFAR): Warning fix. * config/tc-mips.h (TC_FORCE_RELOCATION_SUB_SAME): Don't define. * config/tc-openrisc.c (openrisc_force_relocation): Delete. * config/tc-openrisc.h (TC_FORCE_RELOCATION): Don't define. * config/tc-sparc.c (elf32_sparc_force_relocation): Delete. * config/tc-sparc.h (TC_FORCE_RELOCATION): Don't define for ELF. * config/tc-i386.c (i386_force_relocation): Delete. * config/tc-i386.h (TC_FORCE_RELOCATION): Don't define for BFD_ASSEMBLER. (EXTERN_FORCE_RELOC): Fix TE_PE and STRICT_PE_FORMAT nesting. * config/tc-m68k.h (TC_FORCE_RELOCATION): Don't define. * config/tc-pj.h (TC_FORCE_RELOCATION): Don't define. * config/tc-sh.h (TC_FORCE_RELOCATION_SUB_ABS): Don't call S_FORCE_RELOC. (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too. * config/tc-sh64.h (TC_FORCE_RELOCATION_SUB_SAME): Likewise.
-rw-r--r--gas/ChangeLog70
-rw-r--r--gas/as.h2
-rw-r--r--gas/config/obj-aout.h4
-rw-r--r--gas/config/obj-bout.h4
-rw-r--r--gas/config/obj-coff.h6
-rw-r--r--gas/config/obj-ieee.h4
-rw-r--r--gas/config/obj-vms.h4
-rw-r--r--gas/config/tc-alpha.c8
-rw-r--r--gas/config/tc-arm.c8
-rw-r--r--gas/config/tc-cris.c6
-rw-r--r--gas/config/tc-d10v.c13
-rw-r--r--gas/config/tc-d10v.h3
-rw-r--r--gas/config/tc-dlx.c14
-rw-r--r--gas/config/tc-dlx.h7
-rw-r--r--gas/config/tc-fr30.c18
-rw-r--r--gas/config/tc-fr30.h4
-rw-r--r--gas/config/tc-frv.c8
-rw-r--r--gas/config/tc-hppa.c4
-rw-r--r--gas/config/tc-i386.c15
-rw-r--r--gas/config/tc-i386.h13
-rw-r--r--gas/config/tc-i960.h3
-rw-r--r--gas/config/tc-ia64.c2
-rw-r--r--gas/config/tc-ip2k.c8
-rw-r--r--gas/config/tc-m32r.c6
-rw-r--r--gas/config/tc-m68hc11.c14
-rw-r--r--gas/config/tc-m68k.h7
-rw-r--r--gas/config/tc-mcore.c8
-rw-r--r--gas/config/tc-mcore.h5
-rw-r--r--gas/config/tc-mips.c6
-rw-r--r--gas/config/tc-mips.h4
-rw-r--r--gas/config/tc-mmix.c6
-rw-r--r--gas/config/tc-mn10300.c17
-rw-r--r--gas/config/tc-mn10300.h14
-rw-r--r--gas/config/tc-openrisc.c19
-rw-r--r--gas/config/tc-openrisc.h6
-rw-r--r--gas/config/tc-pj.h8
-rw-r--r--gas/config/tc-ppc.c8
-rw-r--r--gas/config/tc-s390.c6
-rw-r--r--gas/config/tc-sh.c10
-rw-r--r--gas/config/tc-sh.h12
-rw-r--r--gas/config/tc-sh64.h5
-rw-r--r--gas/config/tc-sparc.c17
-rw-r--r--gas/config/tc-sparc.h9
-rw-r--r--gas/config/tc-v850.c8
-rw-r--r--gas/config/tc-xstormy16.c16
-rw-r--r--gas/doc/internals.texi13
-rw-r--r--gas/symbols.c10
-rw-r--r--gas/symbols.h4
-rw-r--r--gas/write.c21
49 files changed, 198 insertions, 289 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 42973b8..049282a 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,75 @@
2003-01-23 Alan Modra <amodra@bigpond.net.au>
+ * symbols.c (S_FORCE_RELOC): Add "strict" param.
+ * symbols.h (S_FORCE_RELOC): Likewise.
+ * config/obj-aout.h (S_FORCE_RELOC): Likewise.
+ * config/obj-bout.h (S_FORCE_RELOC): Likewise.
+ * config/obj-coff.h (S_FORCE_RELOC): Likewise.
+ * config/obj-ieee.h (S_FORCE_RELOC): Likewise.
+ * config/obj-vms.h (S_FORCE_RELOC): Likewise.
+ * write.c (generic_force_reloc): New function.
+ (TC_FORCE_RELOCATION): Use it here instead of S_FORCE_RELOC.
+ (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too.
+ (adjust_reloc_syms): Adjust S_FORCE_RELOC call.
+ * as.h (generic_force_reloc): Declare.
+ * doc/internals.texi (S_FORCE_RELOC): Update.
+ (TC_FORCE_RELOCATION_SUB_SAME): Update.
+
+ * config/tc-alpha.c (alpha_force_relocation): Adjust to use
+ generic_force_reloc.
+ (alpha_fix_adjustable): Likewise.
+ * config/tc-arm.c (arm_force_relocation): Likewise.
+ * config/tc-cris.c (md_cris_force_relocation): Likewise.
+ * config/tc-frv.c (frv_force_relocation): Likewise.
+ * config/tc-i386.c (md_apply_fix3): Likewise.
+ * config/tc-ia64.c (ia64_force_relocation): Likewise.
+ * config/tc-ip2k.c (ip2k_force_relocation): Likewise.
+ * config/tc-m32r.c (m32r_force_relocation): Likewise.
+ * config/tc-m68hc11.c (tc_m68hc11_force_relocation): Likewise.
+ * config/tc-mcore.c (mcore_force_relocation): Likewise.
+ * config/tc-mips.c (mips_force_relocation): Likewise.
+ * config/tc-mmix.c (mmix_force_relocation): Likewise.
+ * config/tc-ppc.c (ppc_force_relocation): Likewise.
+ * config/tc-s390.c (tc_s390_force_relocation): Likewise.
+ * config/tc-sh.c (sh_force_relocation): Likewise.
+ (md_pcrel_from_section): Likewise.
+ * config/tc-sparc.c (tc_gen_reloc): Likewise.
+ * config/tc-v850.c (v850_force_relocation): Likewise.
+ * config/tc-xstormy16.c (xstormy16_force_relocation): Likewise.
+ * config/tc-i386.h (TC_FORCE_RELOCATION): Likewise.
+ * config/tc-mcore.h (TC_FORCE_RELOCATION): Likewise.
+ * config/tc-sparc.h (tc_fix_adjustable): Likewise.
+
+ * config/tc-d10v.c (d10v_force_relocation): Delete.
+ * config/tc-d10v.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-dlx.c (md_dlx_force_relocation): Delete.
+ * config/tc-dlx.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-fr30.c (fr30_force_relocation): Delete.
+ * config/tc-fr30.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-mn10300.c (mn10300_force_relocation): Delete.
+ * config/tc-mn10300.h (TC_FORCE_RELOCATION): Don't define.
+ (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too.
+ * config/tc-i960.h (TC_FORCE_RELOCATION_SUB_SAME): Likewise.
+ * config/tc-hppa.c (hppa_force_relocation): Adjust S_FORCE_RELOC call.
+ * config/tc-mips.c (RELAX_BRANCH_TOOFAR): Warning fix.
+ * config/tc-mips.h (TC_FORCE_RELOCATION_SUB_SAME): Don't define.
+ * config/tc-openrisc.c (openrisc_force_relocation): Delete.
+ * config/tc-openrisc.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-sparc.c (elf32_sparc_force_relocation): Delete.
+ * config/tc-sparc.h (TC_FORCE_RELOCATION): Don't define for ELF.
+ * config/tc-i386.c (i386_force_relocation): Delete.
+ * config/tc-i386.h (TC_FORCE_RELOCATION): Don't define for
+ BFD_ASSEMBLER.
+ (EXTERN_FORCE_RELOC): Fix TE_PE and STRICT_PE_FORMAT nesting.
+ * config/tc-m68k.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-pj.h (TC_FORCE_RELOCATION): Don't define.
+ * config/tc-sh.h (TC_FORCE_RELOCATION_SUB_ABS): Don't call
+ S_FORCE_RELOC.
+ (TC_FORCE_RELOCATION_SUB_SAME): Test TC_FORCE_RELOCATION too.
+ * config/tc-sh64.h (TC_FORCE_RELOCATION_SUB_SAME): Likewise.
+
+2003-01-23 Alan Modra <amodra@bigpond.net.au>
+
* config/tc-sh64.c (shmedia_frob_section_type): Adjust for changed
sh64_elf_section_data.
* config/tc-sh64.h: Include elf32-sh64.h.
diff --git a/gas/as.h b/gas/as.h
index 73b6b2b..eff09ce 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -608,6 +608,8 @@ int eh_frame_estimate_size_before_relax PARAMS ((fragS *));
int eh_frame_relax_frag PARAMS ((fragS *));
void eh_frame_convert_frag PARAMS ((fragS *));
+int generic_force_reloc PARAMS ((struct fix *));
+
#include "expr.h" /* Before targ-*.h */
/* this one starts the chain of target dependant headers */
diff --git a/gas/config/obj-aout.h b/gas/config/obj-aout.h
index 505c1a5..7fca45d 100644
--- a/gas/config/obj-aout.h
+++ b/gas/config/obj-aout.h
@@ -1,6 +1,6 @@
/* obj-aout.h, a.out object file format for gas, the assembler.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -112,7 +112,7 @@ extern void obj_aout_frob_file_before_fix PARAMS ((void));
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
-#define S_FORCE_RELOC(s) \
+#define S_FORCE_RELOC(s, strict) \
(!SEG_NORMAL (S_GET_SEGMENT (s)))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h
index 3293902..374abbc 100644
--- a/gas/config/obj-bout.h
+++ b/gas/config/obj-bout.h
@@ -1,6 +1,6 @@
/* b.out object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -185,7 +185,7 @@ struct relocation_info
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
-#define S_FORCE_RELOC(s) \
+#define S_FORCE_RELOC(s, strict) \
(!SEG_NORMAL (S_GET_SEGMENT (s)))
#define S_IS_COMMON(s) \
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index e90dd70..6e852be 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -1,6 +1,6 @@
/* coff object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2002
+ 1999, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS.
@@ -500,8 +500,8 @@ typedef struct
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
-#define S_FORCE_RELOC(s) \
- (!SEG_NORMAL (S_GET_SEGMENT (s)) || S_IS_WEAK (s))
+#define S_FORCE_RELOC(s, strict) \
+ (!SEG_NORMAL (S_GET_SEGMENT (s)) || (strict && S_IS_WEAK (s)))
/* True if a debug special symbol entry. */
#define S_IS_DEBUG(s) \
diff --git a/gas/config/obj-ieee.h b/gas/config/obj-ieee.h
index 685ac4e..c0bd628 100644
--- a/gas/config/obj-ieee.h
+++ b/gas/config/obj-ieee.h
@@ -1,5 +1,5 @@
/* This file is obj-ieee.h
- Copyright 1987, 1988, 1989, 1990, 1991, 1992, 2000, 2002
+ Copyright 1987, 1988, 1989, 1990, 1991, 1992, 2000, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -35,7 +35,7 @@ obj_symbol_type;
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
-#define S_FORCE_RELOC(s) (!SEG_NORMAL (x->sy_symbol.seg))
+#define S_FORCE_RELOC(s, strict) (!SEG_NORMAL (x->sy_symbol.seg))
typedef struct
{
diff --git a/gas/config/obj-vms.h b/gas/config/obj-vms.h
index ac1fd3d..a535fc4 100644
--- a/gas/config/obj-vms.h
+++ b/gas/config/obj-vms.h
@@ -1,6 +1,6 @@
/* VMS object file format
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -142,7 +142,7 @@ typedef struct nlist obj_symbol_type; /* Symbol table entry */
/* Return true for symbols that should not be reduced to section
symbols or eliminated from expressions, because they may be
overridden by the linker. */
-#define S_FORCE_RELOC(s) \
+#define S_FORCE_RELOC(s, strict) \
(!SEG_NORMAL (S_GET_SEGMENT (s)))
#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index abbc96b..5a65c43 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -1,6 +1,6 @@
/* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU.
Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002 Free Software Foundation, Inc.
+ 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Carnegie Mellon University, 1993.
Written by Alessandro Forin, based on earlier gas-1.38 target CPU files.
Modified by Ken Raeburn for gas-2.x and ECOFF support.
@@ -1448,8 +1448,6 @@ alpha_force_relocation (f)
case BFD_RELOC_ALPHA_LINKAGE:
case BFD_RELOC_ALPHA_CODEADDR:
case BFD_RELOC_ALPHA_BRSGP:
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_ALPHA_TLSGD:
case BFD_RELOC_ALPHA_TLSLDM:
case BFD_RELOC_ALPHA_GOTDTPREL16:
@@ -1466,7 +1464,7 @@ alpha_force_relocation (f)
break;
}
- return S_FORCE_RELOC (f->fx_addsy);
+ return generic_force_reloc (f);
}
/* Return true if we can partially resolve a relocation now. */
@@ -1528,7 +1526,7 @@ alpha_fix_adjustable (f)
const char *name;
int offset = 0;
- if (S_FORCE_RELOC (sym))
+ if (generic_force_reloc (f))
return 0;
switch (S_GET_OTHER (sym) & STO_ALPHA_STD_GPLOAD)
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index e1e962b..e588486 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -1,5 +1,5 @@
/* tc-arm.c -- Assemble for the ARM
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
Modified by David Taylor (dtaylor@armltd.co.uk)
@@ -11443,9 +11443,7 @@ arm_force_relocation (fixp)
return 1;
#endif
#ifdef OBJ_ELF
- if ( fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
+ if (fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
|| fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BLX
|| fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX
|| fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23)
@@ -11457,7 +11455,7 @@ arm_force_relocation (fixp)
|| fixp->fx_r_type == BFD_RELOC_ARM_ADRL_IMMEDIATE)
return 0;
- return S_FORCE_RELOC (fixp->fx_addsy);
+ return generic_force_reloc (fixp);
}
#ifdef OBJ_COFF
diff --git a/gas/config/tc-cris.c b/gas/config/tc-cris.c
index 84f1a75..f5d724b 100644
--- a/gas/config/tc-cris.c
+++ b/gas/config/tc-cris.c
@@ -1,5 +1,5 @@
/* tc-cris.c -- Assembler code for the CRIS CPU core.
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Axis Communications AB, Lund, Sweden.
Originally written for GAS 1.38.1 by Mikael Asker.
@@ -3158,8 +3158,6 @@ md_cris_force_relocation (fixp)
{
switch (fixp->fx_r_type)
{
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_CRIS_16_GOT:
case BFD_RELOC_CRIS_32_GOT:
case BFD_RELOC_CRIS_16_GOTPLT:
@@ -3172,7 +3170,7 @@ md_cris_force_relocation (fixp)
;
}
- return S_FORCE_RELOC (fixp->fx_addsy);
+ return generic_force_reloc (fixp);
}
/* Check and emit error if broken-word handling has failed to fix up a
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index 2689ded..23bf1bb 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -1,5 +1,5 @@
/* tc-d10v.c -- Assembler code for the Mitsubishi D10V
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -1903,14 +1903,3 @@ d10v_fix_adjustable (fixP)
return 1;
}
-
-int
-d10v_force_relocation (fixp)
- fixS *fixp;
-{
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fixp->fx_addsy);
-}
diff --git a/gas/config/tc-d10v.h b/gas/config/tc-d10v.h
index dd8ad58..5023662 100644
--- a/gas/config/tc-d10v.h
+++ b/gas/config/tc-d10v.h
@@ -60,9 +60,6 @@ int d10v_cleanup PARAMS ((void));
#define tc_fix_adjustable(FIX) d10v_fix_adjustable(FIX)
bfd_boolean d10v_fix_adjustable PARAMS ((struct fix *));
-#define TC_FORCE_RELOCATION(FIX) d10v_force_relocation(FIX)
-extern int d10v_force_relocation PARAMS ((struct fix *));
-
/* Values passed to md_apply_fix3 don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index 04ba940..7d45ee1 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -1,5 +1,5 @@
/* tc-ldx.c -- Assemble for the DLX
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -1142,18 +1142,6 @@ md_chars_to_number (val, n)
return retval;
}
-/* Definition of TC_FORCE_RELOCATION.
- we need this for gas to force relocation for VTABLE. */
-
-int
-md_dlx_force_relocation (fixp)
- struct fix *fixp;
-{
- return (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || S_FORCE_RELOC (fixp->fx_addsy));
-}
-
bfd_boolean
md_dlx_fix_adjustable (fixP)
fixS *fixP;
diff --git a/gas/config/tc-dlx.h b/gas/config/tc-dlx.h
index aa3890b..8a78c77 100644
--- a/gas/config/tc-dlx.h
+++ b/gas/config/tc-dlx.h
@@ -1,5 +1,5 @@
/* tc-dlx.h -- Assemble for the DLX
- Copyright 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -74,11 +74,6 @@ extern int dlx_unrecognized_line PARAMS ((int));
visible symbols can be overridden. */
#define EXTERN_FORCE_RELOC 0
-/* We need to force out some relocations when relaxing. */
-#define TC_FORCE_RELOCATION(FIX) md_dlx_force_relocation (FIX)
-struct fix;
-extern int md_dlx_force_relocation PARAMS ((struct fix *));
-
#define tc_fix_adjustable(FIX) md_dlx_fix_adjustable (FIX)
extern bfd_boolean md_dlx_fix_adjustable PARAMS ((struct fix *));
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 0a1c9e5..f406107 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -1,5 +1,6 @@
/* tc-fr30.c -- Assembler for the Fujitsu FR30.
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -469,21 +470,6 @@ md_cgen_lookup_reloc (insn, operand, fixP)
return BFD_RELOC_NONE;
}
-
-/* See whether we need to force a relocation into the output file.
- This is used to force out switch and PC relative relocations when
- relaxing. */
-
-int
-fr30_force_relocation (fix)
- fixS * fix;
-{
- if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fix->fx_addsy);
-}
/* Write a value out to the object file, using the appropriate endianness. */
diff --git a/gas/config/tc-fr30.h b/gas/config/tc-fr30.h
index 5f7bc62..ea283dc 100644
--- a/gas/config/tc-fr30.h
+++ b/gas/config/tc-fr30.h
@@ -51,10 +51,6 @@
struct fix;
extern bfd_boolean fr30_fix_adjustable PARAMS ((struct fix *));
-/* When relaxing, we need to emit various relocs we otherwise wouldn't. */
-#define TC_FORCE_RELOCATION(fix) fr30_force_relocation (fix)
-extern int fr30_force_relocation PARAMS ((struct fix *));
-
#define tc_gen_reloc gas_cgen_tc_gen_reloc
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c
index 79367f0..f4b5bbd 100644
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -1,5 +1,5 @@
/* tc-frv.c -- Assembler for the Fujitsu FRV.
- Copyright 2002 Free Software Foundation.
+ Copyright 2002, 2003 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -1232,13 +1232,11 @@ int
frv_force_relocation (fix)
fixS * fix;
{
- if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fix->fx_r_type == BFD_RELOC_FRV_GPREL12
+ if (fix->fx_r_type == BFD_RELOC_FRV_GPREL12
|| fix->fx_r_type == BFD_RELOC_FRV_GPRELU12)
return 1;
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
/* Write a value out to the object file, using the appropriate endianness. */
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index e19ac93..1cb9b70 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -1,6 +1,6 @@
/* tc-hppa.c -- Assemble for the PA
Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -8518,7 +8518,7 @@ hppa_force_relocation (fixp)
/* Ensure we emit a relocation for global symbols so that dynamic
linking works. */
- if (S_FORCE_RELOC (fixp->fx_addsy))
+ if (S_FORCE_RELOC (fixp->fx_addsy, 1))
return 1;
/* It is necessary to force PC-relative calls/jumps to have a relocation
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index fc1eeaf..5b01605 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -1,6 +1,6 @@
/* i386.c -- Assemble code for the Intel 80386
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002
+ 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -4647,7 +4647,7 @@ md_apply_fix3 (fixP, valP, seg)
if ((sym_seg == seg
|| (symbol_section_p (fixP->fx_addsy)
&& sym_seg != absolute_section))
- && !S_FORCE_RELOC (fixP->fx_addsy))
+ && !generic_force_reloc (fixP))
{
/* Yes, we add the values in twice. This is because
bfd_install_relocation subtracts them out again. I think
@@ -5146,17 +5146,6 @@ i386_validate_fix (fixp)
}
}
-bfd_boolean
-i386_force_relocation (fixp)
- fixS *fixp;
-{
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fixp->fx_addsy);
-}
-
arelent *
tc_gen_reloc (section, fixp)
asection *section ATTRIBUTE_UNUSED;
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 0a15fcd..45c3acf 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -1,6 +1,6 @@
/* tc-i386.h -- Header file for tc-i386.c
Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002
+ 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -471,20 +471,15 @@ extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
#define MD_APPLY_SYM_VALUE(FIX) 0
/* ELF wants external syms kept, as does PE COFF. */
-#ifdef TE_PE
-# ifdef STRICT_PE_FORMAT
-# define EXTERN_FORCE_RELOC \
+#if defined (TE_PE) && defined (STRICT_PE_FORMAT)
+#define EXTERN_FORCE_RELOC \
(OUTPUT_FLAVOR == bfd_target_elf_flavour \
|| OUTPUT_FLAVOR == bfd_target_coff_flavour)
-# endif
#else
#define EXTERN_FORCE_RELOC \
(OUTPUT_FLAVOR == bfd_target_elf_flavour)
#endif
-#define TC_FORCE_RELOCATION(FIX) i386_force_relocation (FIX)
-extern bfd_boolean i386_force_relocation PARAMS ((struct fix *));
-
/* This expression evaluates to true if the relocation is for a local
object for which we still want to do the relocation at runtime.
False if we are willing to perform this relocation while building
@@ -513,7 +508,7 @@ extern bfd_boolean i386_force_relocation PARAMS ((struct fix *));
/* For COFF. */
#define TC_FORCE_RELOCATION(FIX) \
- ((FIX)->fx_r_type == 7 || S_FORCE_RELOC ((FIX)->fx_addsy))
+ ((FIX)->fx_r_type == 7 || generic_force_reloc (FIX))
#endif /* ! BFD_ASSEMBLER */
#define md_operand(x)
diff --git a/gas/config/tc-i960.h b/gas/config/tc-i960.h
index f75fc3b..1df82f2 100644
--- a/gas/config/tc-i960.h
+++ b/gas/config/tc-i960.h
@@ -134,7 +134,8 @@ struct relocation_info
as the target of a call instruction. */
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
((FIX)->fx_tcbit \
- || ! SEG_NORMAL (SEG))
+ || ! SEG_NORMAL (SEG) \
+ || TC_FORCE_RELOCATION (FIX))
/* reloc_callj() may replace a 'call' with a 'calls' or a
'bal', in which cases it modifies *fixP as appropriate.
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index a86da0e..fa9ae00 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -10015,7 +10015,7 @@ ia64_force_relocation (fix)
break;
}
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
/* Decide from what point a pc-relative relocation is relative to,
diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c
index 973b660..10f9895 100644
--- a/gas/config/tc-ip2k.c
+++ b/gas/config/tc-ip2k.c
@@ -1,5 +1,5 @@
/* tc-ip2k.c -- Assembler for the Scenix IP2xxx.
- Copyright (C) 2000, 2002 Free Software Foundation.
+ Copyright (C) 2000, 2002, 2003 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -385,10 +385,6 @@ ip2k_force_relocation (fix)
{
switch (fix->fx_r_type)
{
- /* (No C++ support in ip2k. */
- /* case BFD_RELOC_VTABLE_INHERIT: */
- /* case BFD_RELOC_VTABLE_ENTRY: */
-
case BFD_RELOC_IP2K_FR9:
case BFD_RELOC_IP2K_FR_OFFSET:
case BFD_RELOC_IP2K_BANK:
@@ -417,7 +413,7 @@ ip2k_force_relocation (fix)
break;
}
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
void
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index adb084b..f6f5801 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -1,5 +1,5 @@
/* tc-m32r.c -- Assembler for the Mitsubishi M32R.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -1818,9 +1818,7 @@ int
m32r_force_relocation (fix)
fixS *fix;
{
- if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || S_FORCE_RELOC (fix->fx_addsy))
+ if (generic_force_reloc (fix))
return 1;
if (! m32r_relax)
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index da0f2ba..08e1a6e 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -3187,18 +3187,10 @@ int
tc_m68hc11_force_relocation (fixP)
fixS * fixP;
{
- switch (fixP->fx_r_type)
- {
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
- case BFD_RELOC_M68HC11_RL_GROUP:
- return 1;
-
- default:
- break;
- }
+ if (fixP->fx_r_type == BFD_RELOC_M68HC11_RL_GROUP)
+ return 1;
- return S_FORCE_RELOC (fixP->fx_addsy);
+ return generic_force_reloc (fixP);
}
/* Here we decide which fixups can be adjusted to make them relative
diff --git a/gas/config/tc-m68k.h b/gas/config/tc-m68k.h
index 428d1f7..4770300 100644
--- a/gas/config/tc-m68k.h
+++ b/gas/config/tc-m68k.h
@@ -1,6 +1,6 @@
/* This file is tc-m68k.h
Copyright 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002
+ 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -179,11 +179,6 @@ extern int tc_m68k_fix_adjustable PARAMS ((struct fix *));
extern void m68k_elf_final_processing PARAMS ((void));
#endif
-#define TC_FORCE_RELOCATION(FIX) \
- ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
- || (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY \
- || S_FORCE_RELOC ((FIX)->fx_addsy))
-
#else /* ! BFD_ASSEMBLER */
#define tc_frob_coff_symbol(sym) m68k_frob_symbol (sym)
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 9b59166..fe33170 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -1,5 +1,5 @@
/* tc-mcore.c -- Assemble code for M*Core
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -2371,12 +2371,10 @@ int
mcore_force_relocation (fix)
fixS * fix;
{
- if ( fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fix->fx_r_type == BFD_RELOC_RVA)
+ if (fix->fx_r_type == BFD_RELOC_RVA)
return 1;
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
/* Return true if the fix can be handled by GAS, false if it must
diff --git a/gas/config/tc-mcore.h b/gas/config/tc-mcore.h
index c8e56f8..4ab84e4 100644
--- a/gas/config/tc-mcore.h
+++ b/gas/config/tc-mcore.h
@@ -1,6 +1,7 @@
/* This file is tc-mcore.h
- Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -73,7 +74,7 @@ struct mcore_tc_sy
# if defined TE_PE
# define TC_FORCE_RELOCATION(x) \
- ((x)->fx_r_type == BFD_RELOC_RVA || S_FORCE_RELOC ((x)->fx_addsy))
+ ((x)->fx_r_type == BFD_RELOC_RVA || generic_force_reloc (x))
# endif
#endif /* OBJ_COFF */
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index b15d84f..2d5440e 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -737,7 +737,7 @@ static int mips_relax_branch;
#define RELAX_BRANCH_UNCOND(i) (((i) & 8) != 0)
#define RELAX_BRANCH_LIKELY(i) (((i) & 4) != 0)
#define RELAX_BRANCH_LINK(i) (((i) & 2) != 0)
-#define RELAX_BRANCH_TOOFAR(i) (((i) & 1))
+#define RELAX_BRANCH_TOOFAR(i) (((i) & 1) != 0)
/* For mips16 code, we use an entirely different form of relaxation.
mips16 supports two versions of most instructions which take
@@ -11173,9 +11173,7 @@ int
mips_force_relocation (fixp)
fixS *fixp;
{
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || S_FORCE_RELOC (fixp->fx_addsy))
+ if (generic_force_reloc (fixp))
return 1;
if (HAVE_NEWABI
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index a19c87d..8d9c4dd 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -140,10 +140,6 @@ extern int mips_fix_adjustable PARAMS ((struct fix *));
#define TC_FORCE_RELOCATION(FIX) mips_force_relocation (FIX)
extern int mips_force_relocation PARAMS ((struct fix *));
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (mips_force_relocation (FIX) \
- || !SEG_NORMAL (SEG))
-
/* Register mask variables. These are set by the MIPS assembly code
and used by ECOFF and possibly other object file formats. */
extern unsigned long mips_gprmask;
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index 1a5f7ae..c6ce34f 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -1,5 +1,5 @@
/* tc-mmix.c -- Assembler for Don Knuth's MMIX.
- Copyright (C) 2001, 2002 Free Software Foundation.
+ Copyright (C) 2001, 2002, 2003 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -3246,8 +3246,6 @@ mmix_force_relocation (fixP)
fixS *fixP;
{
if (fixP->fx_r_type == BFD_RELOC_MMIX_LOCAL
- || fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixP->fx_r_type == BFD_RELOC_MMIX_BASE_PLUS_OFFSET)
return 1;
@@ -3261,7 +3259,7 @@ mmix_force_relocation (fixP)
if (fixP->fx_pcrel)
return 1;
- return S_FORCE_RELOC (fixP->fx_addsy);
+ return generic_force_reloc (fixP);
}
/* The location from which a PC relative jump should be calculated,
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index be127c0..c011bfb 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -1,5 +1,5 @@
/* tc-mn10300.c -- Assembler code for the Matsushita 10300
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -1992,21 +1992,6 @@ md_apply_fix3 (fixP, valP, seg)
fixP->fx_done = 1;
}
-/* Return nonzero if the fixup in FIXP will require a relocation,
- even it if appears that the fixup could be completely handled
- within GAS. */
-
-int
-mn10300_force_relocation (fixp)
- struct fix *fixp;
-{
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fixp->fx_addsy);
-}
-
/* Return zero if the fixup in fixp should be left alone and not
adjusted. */
diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h
index 69b752e..736f93b 100644
--- a/gas/config/tc-mn10300.h
+++ b/gas/config/tc-mn10300.h
@@ -1,5 +1,6 @@
/* tc-mn10300.h -- Header file for tc-mn10300.c.
- Copyright 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1996, 1997, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -35,17 +36,14 @@
visible symbols can be overridden. */
#define EXTERN_FORCE_RELOC 0
-/* For fixup and relocation handling. */
-#define TC_FORCE_RELOCATION(fixp) mn10300_force_relocation (fixp)
-extern int mn10300_force_relocation PARAMS ((struct fix *));
-
/* Do not adjust relocations involving symbols in code sections,
because it breaks linker relaxations. This could be fixed in the
linker, but this fix is simpler, and it pretty much only affects
object size a little bit. */
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG) \
- || ((SEG)->flags & SEC_CODE) != 0)
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
+ (((SEC)->flags & SEC_CODE) != 0 \
+ || ! SEG_NORMAL (SEC) \
+ || TC_FORCE_RELOCATION (FIX))
/* We validate subtract arguments within tc_gen_reloc(), so don't
report errors at this point. */
diff --git a/gas/config/tc-openrisc.c b/gas/config/tc-openrisc.c
index 726b583..091ef27 100644
--- a/gas/config/tc-openrisc.c
+++ b/gas/config/tc-openrisc.c
@@ -1,5 +1,5 @@
/* tc-openrisc.c -- Assembler for the OpenRISC family.
- Copyright 2001, 2002 Free Software Foundation.
+ Copyright 2001, 2002, 2003 Free Software Foundation.
Contributed by Johan Rydberg, jrydberg@opencores.org
This file is part of GAS, the GNU Assembler.
@@ -398,23 +398,6 @@ md_cgen_lookup_reloc (insn, operand, fixP)
return BFD_RELOC_NONE;
}
-
-/* See whether we need to force a relocation into the output file.
- This is used to force out switch and PC relative relocations when
- relaxing. */
-
-int
-openrisc_force_relocation (fix)
- fixS * fix ATTRIBUTE_UNUSED;
-{
- if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fix->fx_addsy);
-}
-
-
/* Write a value out to the object file, using the appropriate endianness. */
diff --git a/gas/config/tc-openrisc.h b/gas/config/tc-openrisc.h
index 24db9ab..b822800 100644
--- a/gas/config/tc-openrisc.h
+++ b/gas/config/tc-openrisc.h
@@ -1,5 +1,5 @@
/* tc-openrisc.h -- Header file for tc-openrisc.c.
- Copyright 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -55,10 +55,6 @@ extern const char openrisc_comment_chars [];
extern bfd_boolean openrisc_fix_adjustable PARAMS ((struct fix *));
#define tc_fix_adjustable(FIX) openrisc_fix_adjustable (FIX)
-/* When relaxing, we need to emit various relocs we otherwise wouldn't. */
-extern int openrisc_force_relocation PARAMS ((struct fix *));
-#define TC_FORCE_RELOCATION(fix) openrisc_force_relocation (fix)
-
#define tc_gen_reloc gas_cgen_tc_gen_reloc
/* Call md_pcrel_from_section(), not md_pcrel_from(). */
diff --git a/gas/config/tc-pj.h b/gas/config/tc-pj.h
index 4e6c92d..7d0a07d 100644
--- a/gas/config/tc-pj.h
+++ b/gas/config/tc-pj.h
@@ -1,5 +1,5 @@
/* This file is tc-pj.h
- Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
Contributed by Steve Chamberlain of Transmeta, sac@pobox.com
@@ -52,12 +52,6 @@ arelent *tc_gen_reloc PARAMS((asection *, struct fix *));
visible symbols can be overridden. */
#define EXTERN_FORCE_RELOC 0
-/* Always leave vtable relocs untouched in the output. */
-#define TC_FORCE_RELOCATION(FIX) \
- ((FIX)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
- || (FIX)->fx_r_type == BFD_RELOC_VTABLE_ENTRY \
- || S_FORCE_RELOC ((FIX)->fx_addsy))
-
/* Values passed to md_apply_fix3 don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index ba058f6..8f298f3 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -1,5 +1,5 @@
/* tc-ppc.c -- Assemble for the PowerPC or POWER (RS/6000)
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
@@ -5256,7 +5256,7 @@ ppc_force_relocation (fix)
<= fix->fx_frag->fr_address))))
return 1;
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
#endif /* OBJ_XCOFF */
@@ -5278,14 +5278,12 @@ ppc_force_relocation (fix)
case BFD_RELOC_PPC_BA16_BRTAKEN:
case BFD_RELOC_PPC_BA16_BRNTAKEN:
case BFD_RELOC_PPC64_TOC:
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
return 1;
default:
break;
}
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
int
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index d65c406..cdf3af2 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1,5 +1,5 @@
/* tc-s390.c -- Assemble for the S390
- Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of GAS, the GNU Assembler.
@@ -1736,14 +1736,12 @@ tc_s390_force_relocation (fixp)
case BFD_RELOC_390_GOTPLT32:
case BFD_RELOC_390_GOTPLT64:
case BFD_RELOC_390_GOTPLTENT:
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
return 1;
default:
break;;
}
- return S_FORCE_RELOC (fixp->fx_addsy);
+ return generic_force_reloc (fixp);
}
/* Apply a fixup to the object code. This is called for all the
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index e9b5d0d..fcc5b75 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -1,5 +1,5 @@
/* tc-sh.c -- Assemble code for the Hitachi Super-H
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -3236,16 +3236,14 @@ sh_force_relocation (fix)
return 0;
/* Make sure some relocations get emitted. */
- if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY
- || fix->fx_r_type == BFD_RELOC_SH_LOOP_START
+ if (fix->fx_r_type == BFD_RELOC_SH_LOOP_START
|| fix->fx_r_type == BFD_RELOC_SH_LOOP_END
|| fix->fx_r_type == BFD_RELOC_SH_TLS_GD_32
|| fix->fx_r_type == BFD_RELOC_SH_TLS_LD_32
|| fix->fx_r_type == BFD_RELOC_SH_TLS_IE_32
|| fix->fx_r_type == BFD_RELOC_SH_TLS_LDO_32
|| fix->fx_r_type == BFD_RELOC_SH_TLS_LE_32
- || S_FORCE_RELOC (fix->fx_addsy))
+ || generic_force_reloc (fix))
return 1;
if (! sh_relax)
@@ -3705,7 +3703,7 @@ md_pcrel_from_section (fixP, sec)
{
if (! sh_local_pcrel (fixP)
&& fixP->fx_addsy != (symbolS *) NULL
- && (S_FORCE_RELOC (fixP->fx_addsy)
+ && (generic_force_reloc (fixP)
|| S_GET_SEGMENT (fixP->fx_addsy) != sec))
{
/* The symbol is undefined (or is defined but not in this section,
diff --git a/gas/config/tc-sh.h b/gas/config/tc-sh.h
index 2324285..6537a6d 100644
--- a/gas/config/tc-sh.h
+++ b/gas/config/tc-sh.h
@@ -1,6 +1,6 @@
/* This file is tc-sh.h
- Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -85,8 +85,9 @@ extern int sh_force_relocation PARAMS ((struct fix *));
|| (FIX)->fx_r_type == BFD_RELOC_8 \
|| SWITCH_TABLE_CONS (FIX)))
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG) \
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
+ (! SEG_NORMAL (SEC) \
+ || TC_FORCE_RELOCATION (FIX) \
|| (sh_relax && SWITCH_TABLE (FIX)))
/* Don't complain when we leave fx_subsy around. */
@@ -237,8 +238,7 @@ extern bfd_boolean sh_fix_adjustable PARAMS ((struct fix *));
/* This keeps the subtracted symbol around, for use by PLT_PCREL
relocs. */
#define TC_FORCE_RELOCATION_SUB_ABS(FIX) \
- ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
- || S_FORCE_RELOC ((FIX)->fx_subsy))
+ ((FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL)
/* Don't complain when we leave fx_subsy around. */
#undef TC_VALIDATE_FIX_SUB
diff --git a/gas/config/tc-sh64.h b/gas/config/tc-sh64.h
index c5758d2..1fb8e76 100644
--- a/gas/config/tc-sh64.h
+++ b/gas/config/tc-sh64.h
@@ -107,8 +107,9 @@ extern int sh64_target_mach PARAMS ((void));
|| TC_FORCE_RELOCATION (FIX))
#undef TC_FORCE_RELOCATION_SUB_SAME
-#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG) \
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC) \
+ (! SEG_NORMAL (SEC) \
+ || TC_FORCE_RELOCATION (FIX) \
|| (sh_relax && SWITCH_TABLE (FIX)) \
|| *symbol_get_tc ((FIX)->fx_addsy) != NULL)
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index c9ea5e2..da9252b 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -1,6 +1,6 @@
/* tc-sparc.c -- Assemble for the SPARC
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002
+ 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -3329,7 +3329,7 @@ tc_gen_reloc (section, fixp)
switch (code)
{
case BFD_RELOC_32_PCREL_S2:
- if (S_FORCE_RELOC (fixp->fx_addsy))
+ if (generic_force_reloc (fixp))
code = BFD_RELOC_SPARC_WPLT30;
break;
case BFD_RELOC_HI22:
@@ -4349,16 +4349,3 @@ cons_fix_new_sparc (frag, where, nbytes, exp)
fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
}
-
-#ifdef OBJ_ELF
-int
-elf32_sparc_force_relocation (fixp)
- struct fix *fixp;
-{
- if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
- return S_FORCE_RELOC (fixp->fx_addsy);
-}
-#endif
diff --git a/gas/config/tc-sparc.h b/gas/config/tc-sparc.h
index 62be749..1d44506 100644
--- a/gas/config/tc-sparc.h
+++ b/gas/config/tc-sparc.h
@@ -1,6 +1,6 @@
/* tc-sparc.h - Macros and type defines for the sparc.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -69,11 +69,6 @@ extern void sparc_handle_align PARAMS ((struct frag *));
#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 4)
-#ifdef OBJ_ELF
-#define TC_FORCE_RELOCATION(FIX) elf32_sparc_force_relocation(FIX)
-extern int elf32_sparc_force_relocation PARAMS ((struct fix *));
-#endif
-
/* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
don't know about other relocation types, or other formats, yet. */
#ifdef OBJ_COFF
@@ -112,7 +107,7 @@ extern int elf32_sparc_force_relocation PARAMS ((struct fix *));
&& (FIX)->fx_r_type != BFD_RELOC_LO10 \
&& (FIX)->fx_r_type != BFD_RELOC_SPARC13 \
&& ((FIX)->fx_r_type != BFD_RELOC_32_PCREL_S2 \
- || !S_FORCE_RELOC ((FIX)->fx_addsy)) \
+ || !generic_force_reloc (FIX)) \
&& ((FIX)->fx_pcrel \
|| ((FIX)->fx_subsy != NULL \
&& (S_GET_SEGMENT ((FIX)->fx_subsy) \
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index cdc3940..590dc0a 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1,5 +1,5 @@
/* tc-v850.c -- Assembler code for the NEC V850
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -2474,10 +2474,6 @@ int
v850_force_relocation (fixP)
struct fix *fixP;
{
- if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
- || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
- return 1;
-
if (fixP->fx_r_type == BFD_RELOC_V850_LONGCALL
|| fixP->fx_r_type == BFD_RELOC_V850_LONGJUMP)
return 1;
@@ -2490,5 +2486,5 @@ v850_force_relocation (fixP)
|| fixP->fx_r_type >= BFD_RELOC_UNUSED))
return 1;
- return S_FORCE_RELOC (fixP->fx_addsy);
+ return generic_force_reloc (fixP);
}
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index cf57bd9..e7b6efd 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -1,5 +1,5 @@
/* tc-xstormy16.c -- Assembler for the Sanyo XSTORMY16.
- Copyright 2000, 2001, 2002 Free Software Foundation.
+ Copyright 2000, 2001, 2002, 2003 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@@ -380,18 +380,10 @@ int
xstormy16_force_relocation (fix)
fixS * fix;
{
- switch (fix->fx_r_type)
- {
- case BFD_RELOC_XSTORMY16_FPTR16:
- case BFD_RELOC_VTABLE_INHERIT:
- case BFD_RELOC_VTABLE_ENTRY:
- return 1;
-
- default:
- break;
- }
+ if (fix->fx_r_type == BFD_RELOC_XSTORMY16_FPTR16)
+ return 1;
- return S_FORCE_RELOC (fix->fx_addsy);
+ return generic_force_reloc (fix);
}
/* Return true if a relocation against a symbol may be replaced with
diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index f88e6b2..afff9f9 100644
--- a/gas/doc/internals.texi
+++ b/gas/doc/internals.texi
@@ -1,6 +1,6 @@
\input texinfo
@c Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-@c 2001, 2002
+@c 2001, 2002, 2003
@c Free Software Foundation, Inc.
@setfilename internals.info
@node Top
@@ -1294,12 +1294,13 @@ symbol in the current section. If undefined, fixups that are not
returns non-zero, will emit relocs.
@item TC_FORCE_RELOCATION_SUB_SAME (@var{fix}, @var{seg})
-@cindex TC_FORCE_RELOCATION_SUB
+@cindex TC_FORCE_RELOCATION_SUB_SAME
This macro controls resolution of fixup expressions involving the
difference of two symbols in the same section. If this macro returns zero,
the subtrahend will be resolved and @code{fx_subsy} set to @code{NULL} for
@code{md_apply_fix3}. If undefined, the default of
-@w{@code{! SEG_NORMAL (@var{seg})}} will be used.
+@w{@code{! SEG_NORMAL (@var{seg}) || TC_FORCE_RELOCATION (@var{fix})}} will
+be used.
@item TC_FORCE_RELOCATION_SUB_ABS (@var{fix})
@cindex TC_FORCE_RELOCATION_SUB_ABS
@@ -1324,13 +1325,13 @@ to @code{md_apply_fix3}. If the macro is undefined, or returns non-zero, the
symbol value will be included. For ELF, a suitable definition might simply be
@code{0}, because ELF relocations don't include the symbol value in the addend.
-@item S_FORCE_RELOC (@var{sym})
+@item S_FORCE_RELOC (@var{sym}, @var{strict})
@cindex S_FORCE_RELOC
This macro (or function, for @code{BFD_ASSEMBLER} gas) returns true for symbols
that should not be reduced to section symbols or eliminated from expressions,
because they may be overridden by the linker. ie. for symbols that are
-undefined, common or weak, or for ELF assemblers that support ELF shared
-library linking semantics, global.
+undefined or common, and when @var{strict} is set, weak, or global (for ELF
+assemblers that support ELF shared library linking semantics).
@item EXTERN_FORCE_RELOC
@cindex EXTERN_FORCE_RELOC
diff --git a/gas/symbols.c b/gas/symbols.c
index fd969f0..4b02b99 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -1807,15 +1807,17 @@ S_IS_DEFINED (s)
symbols or eliminated from expressions, because they may be
overridden by the linker. */
int
-S_FORCE_RELOC (s)
+S_FORCE_RELOC (s, strict)
symbolS *s;
+ int strict;
{
if (LOCAL_SYMBOL_CHECK (s))
return ((struct local_symbol *) s)->lsy_section == undefined_section;
- return ((s->bsym->flags & BSF_WEAK) != 0
- || (EXTERN_FORCE_RELOC
- && (s->bsym->flags & BSF_GLOBAL) != 0)
+ return ((strict
+ && ((s->bsym->flags & BSF_WEAK) != 0
+ || (EXTERN_FORCE_RELOC
+ && (s->bsym->flags & BSF_GLOBAL) != 0)))
|| s->bsym->section == undefined_section
|| bfd_is_com_section (s->bsym->section));
}
diff --git a/gas/symbols.h b/gas/symbols.h
index 914a930..65fb849 100644
--- a/gas/symbols.h
+++ b/gas/symbols.h
@@ -1,6 +1,6 @@
/* symbols.h -
Copyright 1987, 1990, 1992, 1993, 1994, 1995, 1997, 1999, 2000, 2001,
- 2002 Free Software Foundation, Inc.
+ 2002, 2003 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -90,7 +90,7 @@ extern int S_IS_EXTERNAL PARAMS ((symbolS *));
extern int S_IS_WEAK PARAMS ((symbolS *));
extern int S_IS_COMMON PARAMS ((symbolS *));
extern int S_IS_DEFINED PARAMS ((symbolS *));
-extern int S_FORCE_RELOC PARAMS ((symbolS *));
+extern int S_FORCE_RELOC PARAMS ((symbolS *, int));
extern int S_IS_DEBUG PARAMS ((symbolS *));
extern int S_IS_LOCAL PARAMS ((symbolS *));
extern int S_IS_EXTERN PARAMS ((symbolS *));
diff --git a/gas/write.c b/gas/write.c
index f46bbac..27fd0eb 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1,6 +1,6 @@
/* write.c - emit .o file
Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002
+ 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -34,7 +34,7 @@
#ifndef TC_FORCE_RELOCATION
#define TC_FORCE_RELOCATION(FIX) \
- (S_FORCE_RELOC ((FIX)->fx_addsy))
+ (generic_force_reloc (FIX))
#endif
#ifndef TC_FORCE_RELOCATION_ABS
@@ -51,7 +51,7 @@
#ifndef TC_FORCE_RELOCATION_SUB_SAME
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG) \
- (! SEG_NORMAL (SEG))
+ (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
#endif
#ifndef TC_FORCE_RELOCATION_SUB_ABS
@@ -374,6 +374,19 @@ fix_new_exp (frag, where, size, exp, pcrel, r_type)
return fix_new_internal (frag, where, size, add, sub, off, pcrel, r_type);
}
+/* Generic function to determine whether a fixup requires a relocation. */
+int
+generic_force_reloc (fix)
+ fixS *fix;
+{
+#ifdef BFD_ASSEMBLER
+ if (fix->fx_r_type == BFD_RELOC_VTABLE_INHERIT
+ || fix->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
+ return 1;
+#endif
+ return S_FORCE_RELOC (fix->fx_addsy, fix->fx_subsy == NULL);
+}
+
/* Append a string onto another string, bumping the pointer along. */
void
append (charPP, fromP, length)
@@ -823,7 +836,7 @@ adjust_reloc_syms (abfd, sec, xxx)
/* If the symbol is undefined, common, weak, or global (ELF
shared libs), we can't replace it with the section symbol. */
- if (S_FORCE_RELOC (fixp->fx_addsy))
+ if (S_FORCE_RELOC (fixp->fx_addsy, 1))
continue;
/* Is there some other (target cpu dependent) reason we can't adjust