public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix s390 as
@ 2003-01-22  9:59 Martin Schwidefsky
  2003-01-22 11:54 ` Alan Modra
  2003-01-22 12:21 ` Jakub Jelinek
  0 siblings, 2 replies; 21+ messages in thread
From: Martin Schwidefsky @ 2003-01-22  9:59 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: amodra, binutils


Hi Jakub,

>The problem is that assembler relocates f1@PLT-.LT1 into constant
>instead of emitting relocation for the linker (note that f1
>is global symbol and as such should be overridable in another shared
>library etc.).

Some four letter words come to mind. Just tested with 2.12.90.0.15
and luckily this version doesn't show the problem (relevant for the
current s390 distributions). I wonder since when this problem has
been there.

blue skies,
   Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22  9:59 [PATCH] Fix s390 as Martin Schwidefsky
@ 2003-01-22 11:54 ` Alan Modra
  2003-01-22 12:21 ` Jakub Jelinek
  1 sibling, 0 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-22 11:54 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: Jakub Jelinek, binutils

On Wed, Jan 22, 2003 at 10:56:23AM +0100, Martin Schwidefsky wrote:
> 
> I wonder since when this problem has been there.

Most likely 2002-09-05 (mainline only).

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22  9:59 [PATCH] Fix s390 as Martin Schwidefsky
  2003-01-22 11:54 ` Alan Modra
@ 2003-01-22 12:21 ` Jakub Jelinek
  2003-01-22 13:09   ` Alan Modra
  1 sibling, 1 reply; 21+ messages in thread
From: Jakub Jelinek @ 2003-01-22 12:21 UTC (permalink / raw)
  To: Martin Schwidefsky; +Cc: amodra, binutils

On Wed, Jan 22, 2003 at 10:56:23AM +0100, Martin Schwidefsky wrote:
> 
> Hi Jakub,
> 
> >The problem is that assembler relocates f1@PLT-.LT1 into constant
> >instead of emitting relocation for the linker (note that f1
> >is global symbol and as such should be overridable in another shared
> >library etc.).
> 
> Some four letter words come to mind. Just tested with 2.12.90.0.15
> and luckily this version doesn't show the problem (relevant for the
> current s390 distributions). I wonder since when this problem has
> been there.

At least TC_FORCE_RELOCATION_SUB_SAME was introduced with Alan's
2002-09-05 patch. It is already in hjl's 2.13.90.0.16.

Now, thinking about debug info, AFAIK debug info doesn't contain
subtractions of global symbol and local one in the same section,
it always uses .L*-. etc. instead, so !S_IS_EXTERNAL
before !TC_FORCE_RELOCATION_SUB_SAME IMHO really
shouldn't hurt.

	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22 12:21 ` Jakub Jelinek
@ 2003-01-22 13:09   ` Alan Modra
  2003-01-22 23:41     ` Alan Modra
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Modra @ 2003-01-22 13:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Martin Schwidefsky, binutils

On Wed, Jan 22, 2003 at 01:21:33PM +0100, Jakub Jelinek wrote:
> Now, thinking about debug info, AFAIK debug info doesn't contain
> subtractions of global symbol and local one in the same section,
> it always uses .L*-. etc. instead,

For all released versions of gcc?  I'm sure I saw a case involving
subtractions of weak syms, but can't remember whether it was syms
in the same section or even whether the problem was with the first
or second sym.

> so !S_IS_EXTERNAL
> before !TC_FORCE_RELOCATION_SUB_SAME IMHO really
> shouldn't hurt.

The way to do this is to change the default definition of
TC_FORCE_RELOCATION_SUB_SAME, and look at all target re-definitions.
I don't want some condition here that can't be overridden.

Hmm, looking over the old code, I guess I should have used
a default of 

#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
  (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))

TC_FORCE_RELOCATION_SUB_SAME is different from the other
TC_FORCE_RELOCATION_SUB_* macros in that it results in both
fx_addsy and fx_subsy being resolved.  The others just resolve
fx_subsy.

I'll set up an overnight build and testsuite run of a representative
sample of gas targets to see how this goes.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22 13:09   ` Alan Modra
@ 2003-01-22 23:41     ` Alan Modra
  2003-01-23  0:46       ` Jakub Jelinek
  2003-01-23  1:01       ` Hans-Peter Nilsson
  0 siblings, 2 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-22 23:41 UTC (permalink / raw)
  To: Jakub Jelinek, Martin Schwidefsky, binutils

On Wed, Jan 22, 2003 at 11:39:36PM +1030, Alan Modra wrote:
> #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
>   (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))

Breaks gas/testsuite/gas/cris/binop-segref.s

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22 23:41     ` Alan Modra
@ 2003-01-23  0:46       ` Jakub Jelinek
  2003-01-23  1:01       ` Hans-Peter Nilsson
  1 sibling, 0 replies; 21+ messages in thread
From: Jakub Jelinek @ 2003-01-23  0:46 UTC (permalink / raw)
  To: Hans-Peter Nilsson, Martin Schwidefsky, binutils

On Thu, Jan 23, 2003 at 10:11:52AM +1030, Alan Modra wrote:
> On Wed, Jan 22, 2003 at 11:39:36PM +1030, Alan Modra wrote:
> > #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
> >   (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
> 
> Breaks gas/testsuite/gas/cris/binop-segref.s

The question is if the test is ok and especially if it is
derived from any real-world usage.
If yes, then maybe cris should haev a special TC_FORCE_RELOCATION_SUB_SAME
definition (and comment why it needs such behaviour), otherwise the testcase
just should be fixed.

	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22 23:41     ` Alan Modra
  2003-01-23  0:46       ` Jakub Jelinek
@ 2003-01-23  1:01       ` Hans-Peter Nilsson
  2003-01-23  1:06         ` Hans-Peter Nilsson
  2003-01-23  1:47         ` Alan Modra
  1 sibling, 2 replies; 21+ messages in thread
From: Hans-Peter Nilsson @ 2003-01-23  1:01 UTC (permalink / raw)
  To: Alan Modra; +Cc: Jakub Jelinek, Martin Schwidefsky, binutils

On Thu, 23 Jan 2003, Alan Modra wrote:

> On Wed, Jan 22, 2003 at 11:39:36PM +1030, Alan Modra wrote:
> > #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
> >   (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
>
> Breaks gas/testsuite/gas/cris/binop-segref.s

I'm not totally sure about the test-case.  It includes
subtraction of two global symbols.  This *is* actually fine
provided they are *not* supposed to be overridden by other
objects (as expected when producing a DSO).

I think the globalness of a subtractive symbol was deemed to be
ignored for a similar case for x86 some time ago, which leaves
the globalness of the additive symbol, which isn't changed into
a PC-relative reloc for CRIS, but instead an error case.

Altogether, I lean towards a specific
TC_FORCE_RELOCATION_SUB_SAME for CRIS.

brgds, H-P

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-23  1:01       ` Hans-Peter Nilsson
@ 2003-01-23  1:06         ` Hans-Peter Nilsson
  2003-01-23  1:47         ` Alan Modra
  1 sibling, 0 replies; 21+ messages in thread
From: Hans-Peter Nilsson @ 2003-01-23  1:06 UTC (permalink / raw)
  To: Alan Modra; +Cc: Jakub Jelinek, Martin Schwidefsky, binutils

On Wed, 22 Jan 2003, Hans-Peter Nilsson wrote:
> On Thu, 23 Jan 2003, Alan Modra wrote:
> > On Wed, Jan 22, 2003 at 11:39:36PM +1030, Alan Modra wrote:
> > > #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
> > >   (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
> >
> > Breaks gas/testsuite/gas/cris/binop-segref.s

> Altogether, I lean towards a specific
> TC_FORCE_RELOCATION_SUB_SAME for CRIS.

I mean to say it's ok with me if you break this test-case with a
changed default definition of TC_FORCE_RELOCATION_SUB_SAME.
I'll fix it in tc-cris.h.  Caveat: I haven't looked into this
deeply, so if I miss something that seems obvious, please tell.

brgds, H-P

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-23  1:01       ` Hans-Peter Nilsson
  2003-01-23  1:06         ` Hans-Peter Nilsson
@ 2003-01-23  1:47         ` Alan Modra
  2003-01-23 12:52           ` Alan Modra
  2003-03-09 17:26           ` [PATCH] Fix s390 as Hans-Peter Nilsson
  1 sibling, 2 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-23  1:47 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Jakub Jelinek, Martin Schwidefsky, binutils

On Wed, Jan 22, 2003 at 08:01:22PM -0500, Hans-Peter Nilsson wrote:
> On Thu, 23 Jan 2003, Alan Modra wrote:
> 
> > On Wed, Jan 22, 2003 at 11:39:36PM +1030, Alan Modra wrote:
> > > #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
> > >   (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
> >
> > Breaks gas/testsuite/gas/cris/binop-segref.s
> 
> I'm not totally sure about the test-case.  It includes
> subtraction of two global symbols.  This *is* actually fine
> provided they are *not* supposed to be overridden by other
> objects (as expected when producing a DSO).
> 
> I think the globalness of a subtractive symbol was deemed to be
> ignored for a similar case for x86 some time ago, which leaves
> the globalness of the additive symbol, which isn't changed into
> a PC-relative reloc for CRIS, but instead an error case.

Hmm, you named the tests using binop-segref.s:

FAIL: gas/cris/rd-dw2-2
FAIL: False broken words

which leads me to suspect this construct is used when emitting
dwarf debug info, at least in some versions of gcc.

I'm inclined to say the test is correct.  On one hand we have ELF
symbol overriding to consider, but on the other hand can an expression
like sym1 - sym2, with both syms in the same section and no relocation
specifiers really have any sensible meaning other than the value
calculated using known symbol values?

To allow these expressions to resolve, we can tweak all the target
force_relocation routines to test for relocs, then call S_FORCE_RELOC
only when fx_subsy is 0.  Sound reasonable?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-23  1:47         ` Alan Modra
@ 2003-01-23 12:52           ` Alan Modra
  2003-01-24  1:11             ` Alan Modra
  2003-02-12 11:23             ` Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as) Jakub Jelinek
  2003-03-09 17:26           ` [PATCH] Fix s390 as Hans-Peter Nilsson
  1 sibling, 2 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-23 12:52 UTC (permalink / raw)
  To: Jakub Jelinek, Martin Schwidefsky, binutils

This should fix the bug shown by Jakub's s390 testcase in a way that
preserves old behaviour regarding subtraction expressions.  Would one
of you mind committing the testcase?

gas/ChangeLog
	* 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.

Committed.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: gas/as.h
===================================================================
RCS file: /cvs/src/src/gas/as.h,v
retrieving revision 1.29
diff -u -p -r1.29 as.h
--- gas/as.h	22 Jan 2003 10:10:25 -0000	1.29
+++ gas/as.h	23 Jan 2003 11:57:12 -0000
@@ -608,6 +608,8 @@ int eh_frame_estimate_size_before_relax 
 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 */
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.41
diff -u -p -r1.41 symbols.c
--- gas/symbols.c	1 Dec 2002 03:18:49 -0000	1.41
+++ gas/symbols.c	23 Jan 2003 11:57:17 -0000
@@ -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));
 }
Index: gas/symbols.h
===================================================================
RCS file: /cvs/src/src/gas/symbols.h,v
retrieving revision 1.10
diff -u -p -r1.10 symbols.h
--- gas/symbols.h	28 Nov 2002 14:15:54 -0000	1.10
+++ gas/symbols.h	23 Jan 2003 11:57:17 -0000
@@ -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 ((symbol
 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 *));
Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.67
diff -u -p -r1.67 write.c
--- gas/write.c	12 Dec 2002 22:46:45 -0000	1.67
+++ gas/write.c	23 Jan 2003 11:57:18 -0000
@@ -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, pcr
   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
Index: gas/config/obj-aout.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-aout.h,v
retrieving revision 1.7
diff -u -p -r1.7 obj-aout.h
--- gas/config/obj-aout.h	5 Sep 2002 00:01:16 -0000	1.7
+++ gas/config/obj-aout.h	23 Jan 2003 11:57:18 -0000
@@ -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_fi
 /* 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)
Index: gas/config/obj-bout.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-bout.h,v
retrieving revision 1.5
diff -u -p -r1.5 obj-bout.h
--- gas/config/obj-bout.h	5 Sep 2002 00:01:16 -0000	1.5
+++ gas/config/obj-bout.h	23 Jan 2003 11:57:18 -0000
@@ -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) \
Index: gas/config/obj-coff.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.h,v
retrieving revision 1.17
diff -u -p -r1.17 obj-coff.h
--- gas/config/obj-coff.h	5 Sep 2002 00:01:16 -0000	1.17
+++ gas/config/obj-coff.h	23 Jan 2003 11:57:19 -0000
@@ -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) \
Index: gas/config/obj-ieee.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-ieee.h,v
retrieving revision 1.5
diff -u -p -r1.5 obj-ieee.h
--- gas/config/obj-ieee.h	5 Sep 2002 00:01:16 -0000	1.5
+++ gas/config/obj-ieee.h	23 Jan 2003 11:57:19 -0000
@@ -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
   {
Index: gas/config/obj-vms.h
===================================================================
RCS file: /cvs/src/src/gas/config/obj-vms.h,v
retrieving revision 1.7
diff -u -p -r1.7 obj-vms.h
--- gas/config/obj-vms.h	5 Sep 2002 00:01:16 -0000	1.7
+++ gas/config/obj-vms.h	23 Jan 2003 11:57:20 -0000
@@ -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;	/*
 /* 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)
Index: gas/config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.53
diff -u -p -r1.53 tc-alpha.c
--- gas/config/tc-alpha.c	30 Dec 2002 19:25:07 -0000	1.53
+++ gas/config/tc-alpha.c	23 Jan 2003 11:57:22 -0000
@@ -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)
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.135
diff -u -p -r1.135 tc-arm.c
--- gas/config/tc-arm.c	12 Dec 2002 22:43:45 -0000	1.135
+++ gas/config/tc-arm.c	23 Jan 2003 11:57:27 -0000
@@ -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
Index: gas/config/tc-cris.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-cris.c,v
retrieving revision 1.25
diff -u -p -r1.25 tc-cris.c
--- gas/config/tc-cris.c	30 Nov 2002 08:39:43 -0000	1.25
+++ gas/config/tc-cris.c	23 Jan 2003 11:57:29 -0000
@@ -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
Index: gas/config/tc-d10v.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-d10v.c,v
retrieving revision 1.31
diff -u -p -r1.31 tc-d10v.c
--- gas/config/tc-d10v.c	17 Dec 2002 01:13:55 -0000	1.31
+++ gas/config/tc-d10v.c	23 Jan 2003 11:57:30 -0000
@@ -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.
@@ -1902,15 +1902,4 @@ d10v_fix_adjustable (fixP)
     return 0;
 
   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);
 }
Index: gas/config/tc-d10v.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-d10v.h,v
retrieving revision 1.11
diff -u -p -r1.11 tc-d10v.h
--- gas/config/tc-d10v.h	30 Nov 2002 08:39:43 -0000	1.11
+++ gas/config/tc-d10v.h	23 Jan 2003 11:57:30 -0000
@@ -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
 
Index: gas/config/tc-dlx.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-dlx.c,v
retrieving revision 1.5
diff -u -p -r1.5 tc-dlx.c
--- gas/config/tc-dlx.c	17 Dec 2002 01:13:55 -0000	1.5
+++ gas/config/tc-dlx.c	23 Jan 2003 11:57:31 -0000
@@ -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.
 
@@ -1140,18 +1140,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
Index: gas/config/tc-dlx.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-dlx.h,v
retrieving revision 1.3
diff -u -p -r1.3 tc-dlx.h
--- gas/config/tc-dlx.h	30 Nov 2002 08:39:43 -0000	1.3
+++ gas/config/tc-dlx.h	23 Jan 2003 11:57:31 -0000
@@ -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.
 
@@ -73,11 +73,6 @@ extern int dlx_unrecognized_line PARAMS 
 /* No shared lib support, so we don't need to ensure externally
    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 *));
Index: gas/config/tc-fr30.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-fr30.c,v
retrieving revision 1.11
diff -u -p -r1.11 tc-fr30.c
--- gas/config/tc-fr30.c	12 Dec 2002 22:39:40 -0000	1.11
+++ gas/config/tc-fr30.c	23 Jan 2003 11:57:31 -0000
@@ -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.
 
@@ -468,21 +469,6 @@ md_cgen_lookup_reloc (insn, operand, fix
     }
 
   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);
 }
 \f
 /* Write a value out to the object file, using the appropriate endianness.  */
Index: gas/config/tc-fr30.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-fr30.h,v
retrieving revision 1.6
diff -u -p -r1.6 tc-fr30.h
--- gas/config/tc-fr30.h	30 Nov 2002 08:39:43 -0000	1.6
+++ gas/config/tc-fr30.h	23 Jan 2003 11:57:31 -0000
@@ -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().  */
Index: gas/config/tc-frv.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-frv.c,v
retrieving revision 1.5
diff -u -p -r1.5 tc-frv.c
--- gas/config/tc-frv.c	12 Dec 2002 22:37:47 -0000	1.5
+++ gas/config/tc-frv.c	23 Jan 2003 11:57:32 -0000
@@ -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);
 }
 \f
 /* Write a value out to the object file, using the appropriate endianness.  */
Index: gas/config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.101
diff -u -p -r1.101 tc-hppa.c
--- gas/config/tc-hppa.c	30 Nov 2002 08:39:43 -0000	1.101
+++ gas/config/tc-hppa.c	23 Jan 2003 11:57:36 -0000
@@ -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
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.136
diff -u -p -r1.136 tc-i386.c
--- gas/config/tc-i386.c	30 Nov 2002 08:39:43 -0000	1.136
+++ gas/config/tc-i386.c	23 Jan 2003 12:36:36 -0000
@@ -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
@@ -5144,17 +5144,6 @@ i386_validate_fix (fixp)
 	}
       fixp->fx_subsy = 0;
     }
-}
-
-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 *
Index: gas/config/tc-i386.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.h,v
retrieving revision 1.38
diff -u -p -r1.38 tc-i386.h
--- gas/config/tc-i386.h	30 Nov 2002 08:39:43 -0000	1.38
+++ gas/config/tc-i386.h	23 Jan 2003 11:57:40 -0000
@@ -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
 #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
 
 /* 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)
Index: gas/config/tc-i960.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i960.h,v
retrieving revision 1.9
diff -u -p -r1.9 tc-i960.h
--- gas/config/tc-i960.h	5 Sep 2002 00:01:17 -0000	1.9
+++ gas/config/tc-i960.h	23 Jan 2003 11:57:40 -0000
@@ -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.
Index: gas/config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.78
diff -u -p -r1.78 tc-ia64.c
--- gas/config/tc-ia64.c	16 Jan 2003 21:31:17 -0000	1.78
+++ gas/config/tc-ia64.c	23 Jan 2003 11:57:44 -0000
@@ -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,
Index: gas/config/tc-ip2k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ip2k.c,v
retrieving revision 1.4
diff -u -p -r1.4 tc-ip2k.c
--- gas/config/tc-ip2k.c	12 Dec 2002 22:21:04 -0000	1.4
+++ gas/config/tc-ip2k.c	23 Jan 2003 11:57:45 -0000
@@ -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
Index: gas/config/tc-m32r.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m32r.c,v
retrieving revision 1.27
diff -u -p -r1.27 tc-m32r.c
--- gas/config/tc-m32r.c	12 Dec 2002 22:18:10 -0000	1.27
+++ gas/config/tc-m32r.c	23 Jan 2003 11:57:46 -0000
@@ -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)
Index: gas/config/tc-m68hc11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68hc11.c,v
retrieving revision 1.37
diff -u -p -r1.37 tc-m68hc11.c
--- gas/config/tc-m68hc11.c	23 Jan 2003 11:51:34 -0000	1.37
+++ gas/config/tc-m68hc11.c	23 Jan 2003 11:57:48 -0000
@@ -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;
+  if (fixP->fx_r_type == BFD_RELOC_M68HC11_RL_GROUP)
+    return 1;
 
-    default:
-      break;
-    }
-
-  return S_FORCE_RELOC (fixP->fx_addsy);
+  return generic_force_reloc (fixP);
 }
 
 /* Here we decide which fixups can be adjusted to make them relative
Index: gas/config/tc-m68k.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.h,v
retrieving revision 1.12
diff -u -p -r1.12 tc-m68k.h
--- gas/config/tc-m68k.h	5 Sep 2002 00:01:18 -0000	1.12
+++ gas/config/tc-m68k.h	23 Jan 2003 11:57:48 -0000
@@ -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.
@@ -178,11 +178,6 @@ extern int tc_m68k_fix_adjustable PARAMS
 #define elf_tc_final_processing m68k_elf_final_processing
 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 */
 
Index: gas/config/tc-mcore.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mcore.c,v
retrieving revision 1.32
diff -u -p -r1.32 tc-mcore.c
--- gas/config/tc-mcore.c	16 Dec 2002 09:57:49 -0000	1.32
+++ gas/config/tc-mcore.c	23 Jan 2003 11:57:49 -0000
@@ -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
Index: gas/config/tc-mcore.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mcore.h,v
retrieving revision 1.12
diff -u -p -r1.12 tc-mcore.h
--- gas/config/tc-mcore.h	12 Dec 2002 22:11:32 -0000	1.12
+++ gas/config/tc-mcore.h	23 Jan 2003 11:57:49 -0000
@@ -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 */
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.187
diff -u -p -r1.187 tc-mips.c
--- gas/config/tc-mips.c	2 Jan 2003 20:03:07 -0000	1.187
+++ gas/config/tc-mips.c	23 Jan 2003 11:57:56 -0000
@@ -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
Index: gas/config/tc-mips.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.h,v
retrieving revision 1.21
diff -u -p -r1.21 tc-mips.h
--- gas/config/tc-mips.h	25 Dec 2002 21:20:31 -0000	1.21
+++ gas/config/tc-mips.h	23 Jan 2003 11:57:57 -0000
@@ -140,10 +140,6 @@ extern int mips_fix_adjustable PARAMS ((
 #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;
Index: gas/config/tc-mmix.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mmix.c,v
retrieving revision 1.12
diff -u -p -r1.12 tc-mmix.c
--- gas/config/tc-mmix.c	10 Nov 2002 18:35:51 -0000	1.12
+++ gas/config/tc-mmix.c	23 Jan 2003 11:57:59 -0000
@@ -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,
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.40
diff -u -p -r1.40 tc-mn10300.c
--- gas/config/tc-mn10300.c	12 Dec 2002 03:16:33 -0000	1.40
+++ gas/config/tc-mn10300.c	23 Jan 2003 11:58:00 -0000
@@ -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.
@@ -1990,21 +1990,6 @@ md_apply_fix3 (fixP, valP, seg)
   /* If a symbol remains, pass the fixup, as a reloc, onto the linker.  */
   if (fixP->fx_addsy == NULL)
     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
Index: gas/config/tc-mn10300.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.h,v
retrieving revision 1.11
diff -u -p -r1.11 tc-mn10300.h
--- gas/config/tc-mn10300.h	12 Dec 2002 04:32:07 -0000	1.11
+++ gas/config/tc-mn10300.h	23 Jan 2003 11:58:00 -0000
@@ -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.  */
Index: gas/config/tc-openrisc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-openrisc.c,v
retrieving revision 1.7
diff -u -p -r1.7 tc-openrisc.c
--- gas/config/tc-openrisc.c	12 Dec 2002 22:05:00 -0000	1.7
+++ gas/config/tc-openrisc.c	23 Jan 2003 11:58:00 -0000
@@ -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, fix
 
   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);
-}
-
-
 \f
 /* Write a value out to the object file, using the appropriate endianness.  */
 
Index: gas/config/tc-openrisc.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-openrisc.h,v
retrieving revision 1.4
diff -u -p -r1.4 tc-openrisc.h
--- gas/config/tc-openrisc.h	30 Nov 2002 08:39:43 -0000	1.4
+++ gas/config/tc-openrisc.h	23 Jan 2003 11:58:00 -0000
@@ -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.
 
@@ -54,10 +54,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
 
Index: gas/config/tc-pj.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-pj.h,v
retrieving revision 1.5
diff -u -p -r1.5 tc-pj.h
--- gas/config/tc-pj.h	5 Sep 2002 00:01:18 -0000	1.5
+++ gas/config/tc-pj.h	23 Jan 2003 11:58:00 -0000
@@ -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
 
@@ -51,12 +51,6 @@ arelent *tc_gen_reloc PARAMS((asection *
 /* No shared lib support, so we don't need to ensure externally
    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
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.63
diff -u -p -r1.63 tc-ppc.c
--- gas/config/tc-ppc.c	3 Dec 2002 18:24:32 -0000	1.63
+++ gas/config/tc-ppc.c	23 Jan 2003 11:58:04 -0000
@@ -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
Index: gas/config/tc-s390.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-s390.c,v
retrieving revision 1.27
diff -u -p -r1.27 tc-s390.c
--- gas/config/tc-s390.c	20 Jan 2003 11:48:32 -0000	1.27
+++ gas/config/tc-s390.c	23 Jan 2003 11:58:04 -0000
@@ -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
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.78
diff -u -p -r1.78 tc-sh.c
--- gas/config/tc-sh.c	30 Nov 2002 14:09:10 -0000	1.78
+++ gas/config/tc-sh.c	23 Jan 2003 11:58:06 -0000
@@ -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,
Index: gas/config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.24
diff -u -p -r1.24 tc-sh.h
--- gas/config/tc-sh.h	17 Dec 2002 01:13:55 -0000	1.24
+++ gas/config/tc-sh.h	23 Jan 2003 11:58:06 -0000
@@ -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 ((
        || (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 PAR
 /* 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
Index: gas/config/tc-sh64.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh64.h,v
retrieving revision 1.4
diff -u -p -r1.4 tc-sh64.h
--- gas/config/tc-sh64.h	23 Jan 2003 11:51:34 -0000	1.4
+++ gas/config/tc-sh64.h	23 Jan 2003 11:58:06 -0000
@@ -107,8 +107,9 @@ extern int sh64_target_mach PARAMS ((voi
    || 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)
 
Index: gas/config/tc-sparc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.c,v
retrieving revision 1.44
diff -u -p -r1.44 tc-sparc.c
--- gas/config/tc-sparc.c	12 Dec 2002 21:37:36 -0000	1.44
+++ gas/config/tc-sparc.c	23 Jan 2003 11:58:09 -0000
@@ -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,
 
   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
Index: gas/config/tc-sparc.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.h,v
retrieving revision 1.16
diff -u -p -r1.16 tc-sparc.h
--- gas/config/tc-sparc.h	5 Sep 2002 00:01:18 -0000	1.16
+++ gas/config/tc-sparc.h	23 Jan 2003 11:58:09 -0000
@@ -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 ((
 
 #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 
 	   && (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)			\
Index: gas/config/tc-v850.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-v850.c,v
retrieving revision 1.29
diff -u -p -r1.29 tc-v850.c
--- gas/config/tc-v850.c	30 Nov 2002 08:39:44 -0000	1.29
+++ gas/config/tc-v850.c	23 Jan 2003 11:58:09 -0000
@@ -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);
 }
Index: gas/config/tc-xstormy16.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xstormy16.c,v
retrieving revision 1.8
diff -u -p -r1.8 tc-xstormy16.c
--- gas/config/tc-xstormy16.c	7 Jan 2003 21:27:58 -0000	1.8
+++ gas/config/tc-xstormy16.c	23 Jan 2003 11:58:10 -0000
@@ -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
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.34
diff -u -p -r1.34 internals.texi
--- gas/doc/internals.texi	25 Dec 2002 21:20:31 -0000	1.34
+++ gas/doc/internals.texi	23 Jan 2003 12:08:22 -0000
@@ -1294,12 +1294,13 @@ symbol in the current section.  If undef
 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 i
 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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-23 12:52           ` Alan Modra
@ 2003-01-24  1:11             ` Alan Modra
  2003-02-12 11:23             ` Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as) Jakub Jelinek
  1 sibling, 0 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-24  1:11 UTC (permalink / raw)
  To: binutils

Missed a few.

	* as.h: Update copyright date.
	* symbols.c: Likewise.
	* config/tc-d10v.h: Likewise.
	* config/tc-fr30.h: Likewise.
	* config/tc-i960.h: Likewise.
	* config/tc-mips.h: Likewise.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as)
  2003-01-23 12:52           ` Alan Modra
  2003-01-24  1:11             ` Alan Modra
@ 2003-02-12 11:23             ` Jakub Jelinek
  2003-02-12 12:41               ` Alan Modra
  1 sibling, 1 reply; 21+ messages in thread
From: Jakub Jelinek @ 2003-02-12 11:23 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

On Thu, Jan 23, 2003 at 11:21:59PM +1030, Alan Modra wrote:
> This should fix the bug shown by Jakub's s390 testcase in a way that
> preserves old behaviour regarding subtraction expressions.

Unfortunately, it seems to break things on various platforms
(those which define their own TC_FORCE_RELOCATION).

Say on Alpha
        .text
1:      lda $15,-128($15)
        .text   1
2:      ldgp $29,2b-1b($27)
causes
Fatal error: internal error? cannot generate `BFD_RELOC_ALPHA_GPDISP' relocation
(this is distilled from much bigger assembly which actually did not change
subsections in between the two labels, just a fragment break happened to
be in between the two instructions (only on Alpha, not on i686->Alpha cross)
and thus expr did not optimize that into constant 4.
As alpha_force_relocation returns 1 for BFD_RELOC_ALPHA_GPDISP_HI16,
TC_FORCE_RELOCATION_SUB_SAME was 1, later on TC_FORCE_RELOCATION_SUB_LOCAL
was 0 and thus BFD_RELOC_ALPHA_GPDISP_HI16 was turned into PC relative
gpdisp16 relocation which tc-alpha.c then complained about.

Dunno if it is better to handle subtraction of two local labels in the same
section in the generic TC_FORCE_RELOCATION_SUB_SAME implementation (and in
the unlikely case some machine wants to override that behaviour, it could
define its own TC_FORCE_RELOCATION_SUB_SAME), or call some new function
in each arch_force_relocation before checking relocation type.

	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as)
  2003-02-12 11:23             ` Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as) Jakub Jelinek
@ 2003-02-12 12:41               ` Alan Modra
  2003-02-12 13:22                 ` Jakub Jelinek
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Modra @ 2003-02-12 12:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

On Wed, Feb 12, 2003 at 12:23:10PM +0100, Jakub Jelinek wrote:
> On Thu, Jan 23, 2003 at 11:21:59PM +1030, Alan Modra wrote:
> > This should fix the bug shown by Jakub's s390 testcase in a way that
> > preserves old behaviour regarding subtraction expressions.
> 
> Unfortunately, it seems to break things on various platforms
> (those which define their own TC_FORCE_RELOCATION).

I'm understanding better why sane people are afraid to touch the gas
reloc code.

> Say on Alpha
>         .text
> 1:      lda $15,-128($15)
>         .text   1
> 2:      ldgp $29,2b-1b($27)
> causes
> Fatal error: internal error? cannot generate `BFD_RELOC_ALPHA_GPDISP' relocation
> (this is distilled from much bigger assembly which actually did not change
> subsections in between the two labels, just a fragment break happened to
> be in between the two instructions (only on Alpha, not on i686->Alpha cross)
> and thus expr did not optimize that into constant 4.

Yeah, that's nasty.  Turning on gas listings exposes these problems too.

> Dunno if it is better to handle subtraction of two local labels in the same
> section in the generic TC_FORCE_RELOCATION_SUB_SAME implementation (and in
> the unlikely case some machine wants to override that behaviour, it could
> define its own TC_FORCE_RELOCATION_SUB_SAME), or call some new function
> in each arch_force_relocation before checking relocation type.

I'm not going to try to come up with a patch, as it's getting late here,
but my thoughts are to go back to using

#ifndef TC_FORCE_RELOCATION_SUB_SAME
#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
  (! SEG_NORMAL (SEG))
#endif

as a default in write.c, and something special in tc-s390.h.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as)
  2003-02-12 12:41               ` Alan Modra
@ 2003-02-12 13:22                 ` Jakub Jelinek
  2003-02-12 23:20                   ` Alan Modra
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Jelinek @ 2003-02-12 13:22 UTC (permalink / raw)
  To: binutils

On Wed, Feb 12, 2003 at 11:11:24PM +1030, Alan Modra wrote:
> On Wed, Feb 12, 2003 at 12:23:10PM +0100, Jakub Jelinek wrote:
> > On Thu, Jan 23, 2003 at 11:21:59PM +1030, Alan Modra wrote:
> > > This should fix the bug shown by Jakub's s390 testcase in a way that
> > > preserves old behaviour regarding subtraction expressions.
> > 
> > Unfortunately, it seems to break things on various platforms
> > (those which define their own TC_FORCE_RELOCATION).
> 
> I'm understanding better why sane people are afraid to touch the gas
> reloc code.
> 
> > Say on Alpha
> >         .text
> > 1:      lda $15,-128($15)
> >         .text   1
> > 2:      ldgp $29,2b-1b($27)
> > causes
> > Fatal error: internal error? cannot generate `BFD_RELOC_ALPHA_GPDISP' relocation
> > (this is distilled from much bigger assembly which actually did not change
> > subsections in between the two labels, just a fragment break happened to
> > be in between the two instructions (only on Alpha, not on i686->Alpha cross)
> > and thus expr did not optimize that into constant 4.
> 
> Yeah, that's nasty.  Turning on gas listings exposes these problems too.
> 
> > Dunno if it is better to handle subtraction of two local labels in the same
> > section in the generic TC_FORCE_RELOCATION_SUB_SAME implementation (and in
> > the unlikely case some machine wants to override that behaviour, it could
> > define its own TC_FORCE_RELOCATION_SUB_SAME), or call some new function
> > in each arch_force_relocation before checking relocation type.
> 
> I'm not going to try to come up with a patch, as it's getting late here,
> but my thoughts are to go back to using
> 
> #ifndef TC_FORCE_RELOCATION_SUB_SAME
> #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
>   (! SEG_NORMAL (SEG))
> #endif
> 
> as a default in write.c, and something special in tc-s390.h.

Wouldn't something like:
(! SEG_NORMAL (SEG)
 || (EXTERN_FORCE_RELOC
     && (S_IS_EXTERNAL ((FIX)->fx_addsy)
	 || S_IS_EXTERNAL ((FIX)->fx_subsy))
     && TC_FORCE_RELOCATION (FIX)))

be a better default (or just
(! SEG_NORMAL (SEG)
 || (EXTERN_FORCE_RELOC
     && (S_IS_EXTERNAL ((FIX)->fx_addsy)
	 || S_IS_EXTERNAL ((FIX)->fx_subsy))))
).

	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as)
  2003-02-12 13:22                 ` Jakub Jelinek
@ 2003-02-12 23:20                   ` Alan Modra
  0 siblings, 0 replies; 21+ messages in thread
From: Alan Modra @ 2003-02-12 23:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: binutils

On Wed, Feb 12, 2003 at 02:22:19PM +0100, Jakub Jelinek wrote:
> Wouldn't something like:
> (! SEG_NORMAL (SEG)
>  || (EXTERN_FORCE_RELOC
>      && (S_IS_EXTERNAL ((FIX)->fx_addsy)
> 	 || S_IS_EXTERNAL ((FIX)->fx_subsy))
>      && TC_FORCE_RELOCATION (FIX)))
> 
> be a better default (or just
> (! SEG_NORMAL (SEG)
>  || (EXTERN_FORCE_RELOC
>      && (S_IS_EXTERNAL ((FIX)->fx_addsy)
> 	 || S_IS_EXTERNAL ((FIX)->fx_subsy))))
> ).

No, I tried something like that at one stage and ran into problems.
It seems that most people who write "sym1 - sym2", with both symbols
defined in the same local section, expect the assembler to perform
the subtraction regardless of whether sym1 or sym2 are global.

s390 really needs special treatment for its foo@PLT-bar.  When
looking at the assembly source, it is obvious that this expression
is different from (foo-bar)@PLT, but the latter is exactly what the
generic relocation code sees.

gas/ChangeLog
	* write.c (TC_FORCE_RELOCATION_SUB_SAME): Revert last change.
	* config/tc-s390.h (TC_FORCE_RELOCATION_SUB_SAME): Define.

Index: gas/write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.68
diff -u -p -r1.68 write.c
--- gas/write.c	23 Jan 2003 12:51:04 -0000	1.68
+++ gas/write.c	12 Feb 2003 22:56:38 -0000
@@ -51,7 +51,7 @@
 
 #ifndef TC_FORCE_RELOCATION_SUB_SAME
 #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)	\
-  (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
+  (! SEG_NORMAL (SEG))
 #endif
 
 #ifndef TC_FORCE_RELOCATION_SUB_ABS
Index: gas/config/tc-s390.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-s390.h,v
retrieving revision 1.9
diff -u -p -r1.9 tc-s390.h
--- gas/config/tc-s390.h	5 Sep 2002 00:01:18 -0000	1.9
+++ gas/config/tc-s390.h	12 Feb 2003 22:56:38 -0000
@@ -32,6 +32,10 @@ struct fix;
 #define TC_FORCE_RELOCATION(FIX) tc_s390_force_relocation(FIX)
 extern int tc_s390_force_relocation PARAMS ((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))
+
 #define tc_fix_adjustable(X)  tc_s390_fix_adjustable(X)
 extern int tc_s390_fix_adjustable PARAMS ((struct fix *));
 
-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-23  1:47         ` Alan Modra
  2003-01-23 12:52           ` Alan Modra
@ 2003-03-09 17:26           ` Hans-Peter Nilsson
  1 sibling, 0 replies; 21+ messages in thread
From: Hans-Peter Nilsson @ 2003-03-09 17:26 UTC (permalink / raw)
  To: Alan Modra; +Cc: Jakub Jelinek, Martin Schwidefsky, binutils

(old email-pending-edit-cleanout)

On Thu, 23 Jan 2003, Alan Modra wrote:
> Hmm, you named the tests using binop-segref.s:
>
> FAIL: gas/cris/rd-dw2-2
> FAIL: False broken words
>
> which leads me to suspect this construct is used when emitting
> dwarf debug info, at least in some versions of gcc.

For reference:  No, that's just a sanity check for the asm
dwarf2 info, using the quite constructed binop-segref.s.

(Not that this information should change the outcome of the
issue.)

brgds, H-P

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
@ 2003-01-23 12:55 Martin Schwidefsky
  0 siblings, 0 replies; 21+ messages in thread
From: Martin Schwidefsky @ 2003-01-23 12:55 UTC (permalink / raw)
  To: Alan Modra; +Cc: Jakub Jelinek, binutils


>This should fix the bug shown by Jakub's s390 testcase in a way that
>preserves old behaviour regarding subtraction expressions.  Would one
>of you mind committing the testcase?

I'll take care of the testcase.

blue skies,
   Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22  0:27   ` Jakub Jelinek
@ 2003-01-22  0:51     ` Alan Modra
  0 siblings, 0 replies; 21+ messages in thread
From: Alan Modra @ 2003-01-22  0:51 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: schwidefsky, binutils

On Tue, Jan 21, 2003 at 07:27:35PM -0500, Jakub Jelinek wrote:
> On Wed, Jan 22, 2003 at 10:50:20AM +1030, Alan Modra wrote:
> > On Wed, Jan 22, 2003 at 12:35:25AM +0100, Jakub Jelinek wrote:
> > > The following patch fixes this, though I'm not sure if at least
> > > a S_IS_EXTERNAL (fixp->fx_addsy) check shouldn't be done in write.c
> > > directly.
> > 
> > Tried that at one stage.  Ran into problems with debug info if I
> > remember correctly.  ie. gcc was emitting difference expressions that
> > needed to be resolved.
> 
> So should it be done for @something only on s390 (ie. copy
> tc_s390_force_relocation into tc_s390_force_relocation_sub_same,
> return 0 first if it is local symbol and kill the S_FORCE_RELOC
> at the end)?

I'm not sure.  See what happens with debug info for a weak function,
stabs as well as dwarf.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-22  0:20 ` Alan Modra
@ 2003-01-22  0:27   ` Jakub Jelinek
  2003-01-22  0:51     ` Alan Modra
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Jelinek @ 2003-01-22  0:27 UTC (permalink / raw)
  To: schwidefsky, binutils

On Wed, Jan 22, 2003 at 10:50:20AM +1030, Alan Modra wrote:
> On Wed, Jan 22, 2003 at 12:35:25AM +0100, Jakub Jelinek wrote:
> > The following patch fixes this, though I'm not sure if at least
> > a S_IS_EXTERNAL (fixp->fx_addsy) check shouldn't be done in write.c
> > directly.
> 
> Tried that at one stage.  Ran into problems with debug info if I
> remember correctly.  ie. gcc was emitting difference expressions that
> needed to be resolved.

So should it be done for @something only on s390 (ie. copy
tc_s390_force_relocation into tc_s390_force_relocation_sub_same,
return 0 first if it is local symbol and kill the S_FORCE_RELOC
at the end)?

	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH] Fix s390 as
  2003-01-21 23:35 Jakub Jelinek
@ 2003-01-22  0:20 ` Alan Modra
  2003-01-22  0:27   ` Jakub Jelinek
  0 siblings, 1 reply; 21+ messages in thread
From: Alan Modra @ 2003-01-22  0:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: schwidefsky, binutils

On Wed, Jan 22, 2003 at 12:35:25AM +0100, Jakub Jelinek wrote:
> The following patch fixes this, though I'm not sure if at least
> a S_IS_EXTERNAL (fixp->fx_addsy) check shouldn't be done in write.c
> directly.

Tried that at one stage.  Ran into problems with debug info if I
remember correctly.  ie. gcc was emitting difference expressions that
needed to be resolved.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH] Fix s390 as
@ 2003-01-21 23:35 Jakub Jelinek
  2003-01-22  0:20 ` Alan Modra
  0 siblings, 1 reply; 21+ messages in thread
From: Jakub Jelinek @ 2003-01-21 23:35 UTC (permalink / raw)
  To: schwidefsky, amodra; +Cc: binutils

Hi!

The following source is assembled incorrectly:

.text
        .align  4
.globl f1
        .type   f1,@function
f1:
        lhi     %r2,1
        br      %r14
.Lfe1:
        .size   f1,.Lfe1-f1
        .align  4
.globl f2
        .type   f2,@function
f2:
        stm     %r12,%r15,48(%r15)
        bras    %r13,.LTN1
.LT1:
.LC0:
        .long   f1@PLT-.LT1
.LC1:
        .long   _GLOBAL_OFFSET_TABLE_-.LT1
.LTN1:
        lr      %r14,%r15
        l       %r12,.LC1-.LT1(%r13)
        ahi     %r15,-96
        l       %r1,.LC0-.LT1(%r13)
        la      %r12,0(%r12,%r13)
        st      %r14,0(%r15)
        bas     %r14,0(%r13,%r1)
        l       %r4,152(%r15)
        ahi     %r2,1
        lm      %r12,%r15,144(%r15)
        br      %r4
.Lfe2:
        .size   f2,.Lfe2-f2

The problem is that assembler relocates f1@PLT-.LT1 into constant
instead of emitting relocation for the linker (note that f1
is global symbol and as such should be overridable in another shared
library etc.).

The following patch fixes this, though I'm not sure if at least
a S_IS_EXTERNAL (fixp->fx_addsy) check shouldn't be done in write.c
directly. The question is if:
.globl f1
f1:
.long f1-.
should say on IA-32 create a dynamic relocation (PC relative) or not.

2003-01-22  Jakub Jelinek  <jakub@redhat.com>

	* config/tc-s390.h (TC_FORCE_RELOCATION_SUB_SAME): Define.

--- gas/config/tc-s390.h.jj	2002-09-10 14:51:00.000000000 +0200
+++ gas/config/tc-s390.h	2003-01-22 00:18:24.000000000 +0100
@@ -94,6 +94,11 @@ if (fragP->fr_type == rs_align_code)				
 #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
 extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
 
+/* Ensure that PC relative relocs against global symbols in the same
+   section are resolved by the linker, not assembler.  */
+#define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEG)				\
+  (! SEG_NORMAL (SEG) || TC_FORCE_RELOCATION (FIX))
+
 #define md_operand(x)
 
 extern void s390_md_end PARAMS ((void));


	Jakub

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2003-03-09 17:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22  9:59 [PATCH] Fix s390 as Martin Schwidefsky
2003-01-22 11:54 ` Alan Modra
2003-01-22 12:21 ` Jakub Jelinek
2003-01-22 13:09   ` Alan Modra
2003-01-22 23:41     ` Alan Modra
2003-01-23  0:46       ` Jakub Jelinek
2003-01-23  1:01       ` Hans-Peter Nilsson
2003-01-23  1:06         ` Hans-Peter Nilsson
2003-01-23  1:47         ` Alan Modra
2003-01-23 12:52           ` Alan Modra
2003-01-24  1:11             ` Alan Modra
2003-02-12 11:23             ` Problems with the 2003-01-23 patch (was Re: [PATCH] Fix s390 as) Jakub Jelinek
2003-02-12 12:41               ` Alan Modra
2003-02-12 13:22                 ` Jakub Jelinek
2003-02-12 23:20                   ` Alan Modra
2003-03-09 17:26           ` [PATCH] Fix s390 as Hans-Peter Nilsson
  -- strict thread matches above, loose matches on Subject: below --
2003-01-23 12:55 Martin Schwidefsky
2003-01-21 23:35 Jakub Jelinek
2003-01-22  0:20 ` Alan Modra
2003-01-22  0:27   ` Jakub Jelinek
2003-01-22  0:51     ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).