This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
PATCH: PR 528: .set is broken for weak symbols
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Cc: aaron98wiridge9 at aaronwl dot com, gcc at gcc dot gnu dot org
- Date: Mon, 8 Nov 2004 16:30:25 -0800
- Subject: PATCH: PR 528: .set is broken for weak symbols
- References: <20041108235940.GA18970@lucon.org>
On Mon, Nov 08, 2004 at 03:59:40PM -0800, H. J. Lu wrote:
> This patch
>
> http://sources.redhat.com/ml/binutils/2004-11/msg00098.html
>
> breaks .set, which should only copy the value, not other flags. See
>
> http://sources.redhat.com/bugzilla/show_bug.cgi?id=528
>
> Please fix it now.
>
>
This patch fixes the problem for me. I have 2 questions:
1. Should .set change the behavior on weak symbols on any platforms?
Does gcc expect that?
2. The ChangeLog entry has
2004-11-08 Aaron W. LaFramboise <aaron98wiridge9@aaronwl.com>
* symbols.c (any_external_name): Define.
(resolve_symbol_value): Do not convert weak symbols.
^^^^^^^
Is this a typo? From the code, it seems that weak symbols are
converted.
H.J.
----
2004-11-08 H.J. Lu <hongjiu.lu@intel.com>
PR 528
* symbols.c (resolve_symbol_value): Convert weak symbols only
for Windows PECOFF.
(symbol_equated_reloc_p): Don't equate weaks when relocating
only for Windows PECOFF.
--- gas/symbols.c.set 2004-11-08 09:43:00.000000000 -0800
+++ gas/symbols.c 2004-11-08 16:18:44.988697868 -0800
@@ -995,7 +995,7 @@ resolve_symbol_value (symbolS *symp)
relocation to be against the symbol to which this symbol
is equated. */
if (! S_IS_DEFINED (add_symbol)
-#if defined(BFD_ASSEMBLER) || defined(S_IS_WEAK)
+#if defined (OBJ_COFF) && defined (TE_PE) && (defined(BFD_ASSEMBLER) || defined(S_IS_WEAK))
|| S_IS_WEAK (add_symbol)
#endif
|| S_IS_COMMON (add_symbol))
@@ -2239,7 +2239,7 @@ symbol_equated_reloc_p (symbolS *s)
resolve_symbol_value to flag expression syms that have been
equated. */
return (s->sy_value.X_op == O_symbol
-#if defined(BFD_ASSEMBLER) || defined(S_IS_WEAK)
+#if defined (OBJ_COFF) && defined (TE_PE) && (defined(BFD_ASSEMBLER) || defined(S_IS_WEAK))
&& ! S_IS_WEAK (s)
#endif
&& ((s->sy_resolved && s->sy_value.X_op_symbol != NULL)