From: "Jan Beulich" <JBeulich@novell.com>
To: <binutils@sourceware.org>
Subject: Re: [PATCH] Re: Your gas changes caused weakref failures for cris-elf, supposedly others too
Date: Thu, 17 Nov 2005 08:37:00 -0000 [thread overview]
Message-ID: <437C4F49.76F0.0078.0@novell.com> (raw)
In-Reply-To: <20051116095943.GV28185@bubble.grove.modra.org>
[-- Attachment #1: Type: text/plain, Size: 13275 bytes --]
>>> Alan Modra <amodra@bigpond.net.au> 16.11.05 10:59:43 >>>
>On Wed, Nov 16, 2005 at 10:10:22AM +0100, Jan Beulich wrote:
>>
>> Actually, with the section set correctly on common symbols using
>> S_IS_COMMON here and in the other two places you pointed out
shouldn't
>> be necessary anymore; S_IS_DEFINED should now take care of this.
I'm
>
>True.
This is the final patch.
Re-built and re-tested on i686-pc-linux-gnu, x86_64-unknown-linux-gnu,
and for a large number of cross targets.
Jan
gas/
2005-11-16 Jan Beulich <jbeulich@novell.com>
* symbols.h (S_CLEAR_VOLATILE): Declare.
* symbols.c (colon): Also accept redefinable symbols for
redefinition. Clone them before modifying.
(S_CLEAR_VOLATILE): Define.
* cond.c (s_ifdef): Also test for equated symbols.
* read.c (s_comm_internal): Also exclude non-redefinable
equated symbols. Clone redefinable ones before modifying.
(s_weakref): Clone redefinable symbols before modifying.
* doc/internals.texi: Document sy_volatile, sy_forward_ref,
S_IS_VOLATILE, S_SET_VOLATILE, S_CLEAR_VOLATILE,
S_IS_FORWARD_REF, and S_SET_FORWARD_REF.
gas/testsuite/
2005-11-16 Jan Beulich <jbeulich@novell.com>
* gas/all/cond.s: Also check ifdef works on equates and
commons.
* gas/all/cond.l: Adjust.
* gas/all/redef2.s: Also test redefining equate to label.
* gas/all/redef2.d: Adjust.
* gas/all/redef3.[sd]: New.
* gas/all/redef4.s: New.
* gas/all/redef5.s: New.
* gas/elf/redef.s: New, copied from original gas/all/redef2.s.
* gas/elf/redef.d: Remove #source.
* gas/all/gas.exp: Remove exclusion of iq2000-*-* from and
adjust xfails for redefinition tests. Run new tests. Exclude
alpha*-*-*, mips*-*-*, *c54x*-*-* from weakref tests.
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/cond.c 2005-10-11
14:31:18.000000000 +0200
+++ 2005-11-16/gas/cond.c 2005-11-16 09:59:11.969665664 +0100
@@ -102,7 +102,7 @@ s_ifdef (int test_defined)
considered to be undefined. */
is_defined =
symbolP != NULL
- && S_IS_DEFINED (symbolP)
+ && (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
&& S_GET_SEGMENT (symbolP) != reg_section;
cframe.ignoring = ! (test_defined ^ is_defined);
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/doc/internals.texi 2005-10-26
14:26:28.000000000 +0200
+++ 2005-11-16/gas/doc/internals.texi 2005-11-10 11:20:47.000000000
+0100
@@ -93,6 +93,12 @@ responsible for setting it when a symbol
Whether the symbol is an MRI common symbol created by the
@code{COMMON}
pseudo-op when assembling in MRI mode.
+@item sy_volatile
+Whether the symbol can be re-defined.
+
+@item sy_forward_ref
+Whether the symbol's value must only be evaluated upon use.
+
@item sy_weakrefr
Whether the symbol is a @code{weakref} alias to another symbol.
@@ -165,6 +171,16 @@ Return non-zero if the symbol is a @code
Return non-zero if the symbol was aliased by a @code{weakref} alias
and has not
had any strong references.
+@item S_IS_VOLATILE
+@cindex S_IS_VOLATILE
+Return non-zero if the symbol may be re-defined. Such symbols get
created by
+the @code{=} operator, @code{equ}, or @code{set}.
+
+@item S_IS_FORWARD_REF
+@cindex S_IS_FORWARD_REF
+Return non-zero if the symbol is a forward reference, that is its
value must
+only be determined upon use.
+
@item S_IS_COMMON
@cindex S_IS_COMMON
Return non-zero if this is a common symbol. Common symbols are
sometimes
@@ -222,6 +238,19 @@ Clear the @code{weakref} aliased status
whenever the symbol is looked up, as part of a direct reference or a
definition, but not as part of a @code{weakref} directive.
+@item S_SET_VOLATILE
+@cindex S_SET_VOLATILE
+Indicate that the symbol may be re-defined.
+
+@item S_CLEAR_VOLATILE
+@cindex S_CLEAR_VOLATILE
+Indicate that the symbol may no longer be re-defined.
+
+@item S_SET_FORWARD_REF
+@cindex S_SET_FORWARD_REF
+Indicate that the symbol is a forward reference, that is its value
must only
+be determined upon use.
+
@item S_GET_TYPE
@item S_GET_DESC
@item S_GET_OTHER
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/read.c 2005-11-16
08:52:46.000000000 +0100
+++ 2005-11-16/gas/read.c 2005-11-16 10:00:24.869583192 +0100
@@ -1467,13 +1467,25 @@ s_comm_internal (int param,
*p = 0;
symbolP = symbol_find_or_make (name);
- if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
+ if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
+ && !S_IS_COMMON (symbolP))
{
- symbolP = NULL;
- as_bad (_("symbol `%s' is already defined"), name);
- *p = c;
- ignore_rest_of_line ();
- goto out;
+ if (!S_IS_VOLATILE (symbolP))
+ {
+ symbolP = NULL;
+ as_bad (_("symbol `%s' is already defined"), name);
+ *p = c;
+ ignore_rest_of_line ();
+ goto out;
+ }
+ /* This could be avoided when the symbol wasn't used so far,
but
+ the comment in struc-symbol.h says this flag isn't reliable.
*/
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_SET_SEGMENT (symbolP, undefined_section);
+ S_SET_VALUE (symbolP, 0);
+ symbol_set_frag (symbolP, &zero_address_frag);
+ S_CLEAR_VOLATILE (symbolP);
}
size = S_GET_VALUE (symbolP);
@@ -3174,10 +3186,18 @@ s_weakref (int ignore ATTRIBUTE_UNUSED)
if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
{
- as_bad (_("symbol `%s' is already defined"), name);
- *end_name = delim;
- ignore_rest_of_line ();
- return;
+ if(!S_IS_VOLATILE (symbolP))
+ {
+ as_bad (_("symbol `%s' is already defined"), name);
+ *end_name = delim;
+ ignore_rest_of_line ();
+ return;
+ }
+ /* This could be avoided when the symbol wasn't used so far,
but
+ the comment in struc-symbol.h says this flag isn't reliable.
*/
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_CLEAR_VOLATILE (symbolP);
}
*end_name = delim;
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/symbols.c 2005-11-15
09:30:28.000000000 +0100
+++ 2005-11-16/gas/symbols.c 2005-11-16 09:44:48.856878752 +0100
@@ -333,8 +333,18 @@ colon (/* Just seen "x:" - rattle symbol
locsym->lsy_value = frag_now_fix ();
}
else if (!(S_IS_DEFINED (symbolP) || symbol_equated_p
(symbolP))
- || S_IS_COMMON (symbolP))
+ || S_IS_COMMON (symbolP)
+ || S_IS_VOLATILE (symbolP))
{
+ if (S_IS_VOLATILE (symbolP)
+ /* This could be avoided when the symbol wasn't used so
far, but
+ the comment in struc-symbol.h says this flag isn't
reliable. */
+ && (1 || !symbol_used_p (symbolP)))
+ {
+ symbolP = symbol_clone (symbolP, 1);
+ S_SET_VALUE (symbolP, 0);
+ S_CLEAR_VOLATILE (symbolP);
+ }
if (S_GET_VALUE (symbolP) == 0)
{
symbolP->sy_frag = frag_now;
@@ -421,7 +431,10 @@ colon (/* Just seen "x:" - rattle symbol
if (!(frag_now == symbolP->sy_frag
&& S_GET_VALUE (symbolP) == frag_now_fix ()
&& S_GET_SEGMENT (symbolP) == now_seg))
- as_bad (_("symbol `%s' is already defined"), sym_name);
+ {
+ as_bad (_("symbol `%s' is already defined"), sym_name);
+ symbolP = symbol_clone (symbolP, 0);
+ }
}
}
@@ -2187,6 +2200,13 @@ S_SET_VOLATILE (symbolS *s)
}
void
+S_CLEAR_VOLATILE (symbolS *s)
+{
+ if (!LOCAL_SYMBOL_CHECK (s))
+ s->sy_volatile = 0;
+}
+
+void
S_SET_FORWARD_REF (symbolS *s)
{
if (LOCAL_SYMBOL_CHECK (s))
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/symbols.h 2005-10-26
14:26:28.000000000 +0200
+++ 2005-11-16/gas/symbols.h 2005-11-10 10:53:51.000000000 +0100
@@ -108,6 +108,7 @@ extern void S_SET_WEAKREFD (symbolS *);
extern void S_CLEAR_WEAKREFD (symbolS *);
extern void S_SET_THREAD_LOCAL (symbolS *);
extern void S_SET_VOLATILE (symbolS *);
+extern void S_CLEAR_VOLATILE (symbolS *);
extern void S_SET_FORWARD_REF (symbolS *);
#ifndef WORKING_DOT_WORD
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/cond.l 2005-10-11
13:16:17.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/cond.l 2005-11-11
13:44:02.000000000 +0100
@@ -24,7 +24,13 @@
29[ ]+.else
31[ ]+.endif
[ ]*[1-9][0-9]*[ ]+
+[ ]*[1-9][0-9]*[ ]+\.comm[ ]+c,[ ]*1[ ]*
+[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+c[ ]*
+[ ]*[1-9][0-9]*[ ]+\.endif[ ]*
+[ ]*[1-9][0-9]*[ ]+
[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+x,[ ]*y[ ]*
+[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+x[ ]*
+[ ]*[1-9][0-9]*[ ]+\.endif[ ]*
[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+y,[ ]*0[ ]*
[ ]*[1-9][0-9]*[ ]+\.if[ ]+x[ ]*
[ ]*[1-9][0-9]*[ ]+\.elseif[ ]+x[ ]*
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/cond.s 2005-10-11
14:31:18.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/cond.s 2005-11-11
13:40:54.000000000 +0100
@@ -30,7 +30,15 @@
.long 9
.endif
+ .comm c, 1
+ .ifndef c
+ .err
+ .endif
+
.equiv x, y
+ .ifndef x
+ .err
+ .endif
.equiv y, 0
.if x
.err
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/gas.exp 2005-11-09
15:40:05.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/gas.exp 2005-11-11
16:22:14.000000000 +0100
@@ -74,16 +74,24 @@ case $target_triplet in {
# .set works differently on some targets.
case $target_triplet in {
{ alpha*-*-* } { }
- { iq2000*-*-* } { }
{ mips*-*-* } { }
{ *c54x*-*-* } { }
{ z80-*-* } { }
default {
setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*"
run_dump_test redef
- setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-coff" "arm*-*-pe*"
"crx*-*-*"
- setup_xfail "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" "pdp11-*-*"
"vax*-*-*" "z8k-*-*"
+ setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-*aout*"
"*arm*-*-*coff" \
+ "*arm*-*-pe" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" "maxq-*-*"
\
+ "pdp11-*-*" "vax*-*-*" "z8k-*-*"
run_dump_test redef2
+ setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*"
"*-*-pe*" \
+ "bfin-*-*" "*c4x*-*-*" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*"
\
+ "maxq-*-*" "or32-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*"
+ run_dump_test redef3
+ setup_xfail "*c4x*-*-*"
+ gas_test_error "redef4.s" "" ".set for symbol already used as
label"
+ setup_xfail "*c4x*-*-*"
+ gas_test_error "redef5.s" "" ".set for symbol already defined
through .comm"
}
}
@@ -256,6 +264,9 @@ if { ![istarget "i960-*-*"] } {
# .set works differently on some targets.
case $target_triplet in {
+ { alpha*-*-* } { }
+ { mips*-*-* } { }
+ { *c54x*-*-* } { }
{ z80-*-* } { }
default {
run_dump_test weakref1
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef2.d 2005-10-20
17:29:25.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/redef2.d 2005-11-10
17:27:22.000000000 +0100
@@ -5,9 +5,11 @@
RELOCATION RECORDS FOR .*
.*
-0+0.*(here|\.data)
-0+8.*xtrn
+0+00.*(here|\.data)
+0+08.*xtrn
+0+10.*(sym|\.data(\+0x0+10)?)
#...
Contents of section \.data:
0000 00000000 11111111 00000000 22222222[ ]+................[
]*
+ 0010 [01]00000[01]0 .*
#pass
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef2.s 2005-10-20
16:22:58.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/redef2.s 2005-11-10
10:43:48.000000000 +0100
@@ -8,3 +8,5 @@ here:
.long sym
.set sym, 0x22222222
.long sym
+sym:
+ .long sym
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef3.d 1970-01-01
01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef3.d 2005-11-11
09:48:35.000000000 +0100
@@ -0,0 +1,15 @@
+#objdump: -rsj .data
+#name: .equ redefinitions (3)
+
+.*: .*
+
+RELOCATION RECORDS FOR .*
+.*
+0+00.*(here|\.data)
+0+08.*xtrn
+0+10.*sym
+#...
+Contents of section \.data:
+ 0000 00000000 11111111 00000000 22222222[ ]+................[
]*
+ 0010 00000000 .*
+#pass
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef3.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef3.s 2005-11-10
11:55:40.000000000 +0100
@@ -0,0 +1,12 @@
+ .data
+here:
+ .set sym, here
+ .long sym
+ .set sym, 0x11111111
+ .long sym
+ .set sym, xtrn
+ .long sym
+ .set sym, 0x22222222
+ .long sym
+ .comm sym, 1
+ .long sym
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef4.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef4.s 2005-11-10
10:44:51.000000000 +0100
@@ -0,0 +1,3 @@
+ .data
+sym:
+ .set sym, 0
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef5.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef5.s 2005-11-10
11:53:00.000000000 +0100
@@ -0,0 +1,2 @@
+ .comm sym, 1
+ .set sym, 0
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/elf/redef.d 2005-10-27
11:41:28.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/elf/redef.d 2005-11-10
11:08:19.000000000 +0100
@@ -1,6 +1,5 @@
#objdump: -t
#name: .equ redefinitions (ELF)
-#source: ../all/redef2.s
.*: .*
---
/home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/elf/redef.s 1970-01-01
01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/elf/redef.s 2005-11-10
11:07:10.000000000 +0100
@@ -0,0 +1,10 @@
+ .data
+here:
+ .set sym, here
+ .long sym
+ .set sym, 0x11111111
+ .long sym
+ .set sym, xtrn
+ .long sym
+ .set sym, 0x22222222
+ .long sym
[-- Attachment #2: binutils-mainline-equate-4.patch --]
[-- Type: text/plain, Size: 12923 bytes --]
This is the final patch.
Re-built and re-tested on i686-pc-linux-gnu, x86_64-unknown-linux-gnu,
and for a large number of cross targets.
Jan
gas/
2005-11-16 Jan Beulich <jbeulich@novell.com>
* symbols.h (S_CLEAR_VOLATILE): Declare.
* symbols.c (colon): Also accept redefinable symbols for
redefinition. Clone them before modifying.
(S_CLEAR_VOLATILE): Define.
* cond.c (s_ifdef): Also test for equated symbols.
* read.c (s_comm_internal): Also exclude non-redefinable
equated symbols. Clone redefinable ones before modifying.
(s_weakref): Clone redefinable symbols before modifying.
* doc/internals.texi: Document sy_volatile, sy_forward_ref,
S_IS_VOLATILE, S_SET_VOLATILE, S_CLEAR_VOLATILE,
S_IS_FORWARD_REF, and S_SET_FORWARD_REF.
gas/testsuite/
2005-11-16 Jan Beulich <jbeulich@novell.com>
* gas/all/cond.s: Also check ifdef works on equates and
commons.
* gas/all/cond.l: Adjust.
* gas/all/redef2.s: Also test redefining equate to label.
* gas/all/redef2.d: Adjust.
* gas/all/redef3.[sd]: New.
* gas/all/redef4.s: New.
* gas/all/redef5.s: New.
* gas/elf/redef.s: New, copied from original gas/all/redef2.s.
* gas/elf/redef.d: Remove #source.
* gas/all/gas.exp: Remove exclusion of iq2000-*-* from and
adjust xfails for redefinition tests. Run new tests. Exclude
alpha*-*-*, mips*-*-*, *c54x*-*-* from weakref tests.
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/cond.c 2005-10-11 14:31:18.000000000 +0200
+++ 2005-11-16/gas/cond.c 2005-11-16 09:59:11.969665664 +0100
@@ -102,7 +102,7 @@ s_ifdef (int test_defined)
considered to be undefined. */
is_defined =
symbolP != NULL
- && S_IS_DEFINED (symbolP)
+ && (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
&& S_GET_SEGMENT (symbolP) != reg_section;
cframe.ignoring = ! (test_defined ^ is_defined);
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/doc/internals.texi 2005-10-26 14:26:28.000000000 +0200
+++ 2005-11-16/gas/doc/internals.texi 2005-11-10 11:20:47.000000000 +0100
@@ -93,6 +93,12 @@ responsible for setting it when a symbol
Whether the symbol is an MRI common symbol created by the @code{COMMON}
pseudo-op when assembling in MRI mode.
+@item sy_volatile
+Whether the symbol can be re-defined.
+
+@item sy_forward_ref
+Whether the symbol's value must only be evaluated upon use.
+
@item sy_weakrefr
Whether the symbol is a @code{weakref} alias to another symbol.
@@ -165,6 +171,16 @@ Return non-zero if the symbol is a @code
Return non-zero if the symbol was aliased by a @code{weakref} alias and has not
had any strong references.
+@item S_IS_VOLATILE
+@cindex S_IS_VOLATILE
+Return non-zero if the symbol may be re-defined. Such symbols get created by
+the @code{=} operator, @code{equ}, or @code{set}.
+
+@item S_IS_FORWARD_REF
+@cindex S_IS_FORWARD_REF
+Return non-zero if the symbol is a forward reference, that is its value must
+only be determined upon use.
+
@item S_IS_COMMON
@cindex S_IS_COMMON
Return non-zero if this is a common symbol. Common symbols are sometimes
@@ -222,6 +238,19 @@ Clear the @code{weakref} aliased status
whenever the symbol is looked up, as part of a direct reference or a
definition, but not as part of a @code{weakref} directive.
+@item S_SET_VOLATILE
+@cindex S_SET_VOLATILE
+Indicate that the symbol may be re-defined.
+
+@item S_CLEAR_VOLATILE
+@cindex S_CLEAR_VOLATILE
+Indicate that the symbol may no longer be re-defined.
+
+@item S_SET_FORWARD_REF
+@cindex S_SET_FORWARD_REF
+Indicate that the symbol is a forward reference, that is its value must only
+be determined upon use.
+
@item S_GET_TYPE
@item S_GET_DESC
@item S_GET_OTHER
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/read.c 2005-11-16 08:52:46.000000000 +0100
+++ 2005-11-16/gas/read.c 2005-11-16 10:00:24.869583192 +0100
@@ -1467,13 +1467,25 @@ s_comm_internal (int param,
*p = 0;
symbolP = symbol_find_or_make (name);
- if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
+ if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
+ && !S_IS_COMMON (symbolP))
{
- symbolP = NULL;
- as_bad (_("symbol `%s' is already defined"), name);
- *p = c;
- ignore_rest_of_line ();
- goto out;
+ if (!S_IS_VOLATILE (symbolP))
+ {
+ symbolP = NULL;
+ as_bad (_("symbol `%s' is already defined"), name);
+ *p = c;
+ ignore_rest_of_line ();
+ goto out;
+ }
+ /* This could be avoided when the symbol wasn't used so far, but
+ the comment in struc-symbol.h says this flag isn't reliable. */
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_SET_SEGMENT (symbolP, undefined_section);
+ S_SET_VALUE (symbolP, 0);
+ symbol_set_frag (symbolP, &zero_address_frag);
+ S_CLEAR_VOLATILE (symbolP);
}
size = S_GET_VALUE (symbolP);
@@ -3174,10 +3186,18 @@ s_weakref (int ignore ATTRIBUTE_UNUSED)
if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
{
- as_bad (_("symbol `%s' is already defined"), name);
- *end_name = delim;
- ignore_rest_of_line ();
- return;
+ if(!S_IS_VOLATILE (symbolP))
+ {
+ as_bad (_("symbol `%s' is already defined"), name);
+ *end_name = delim;
+ ignore_rest_of_line ();
+ return;
+ }
+ /* This could be avoided when the symbol wasn't used so far, but
+ the comment in struc-symbol.h says this flag isn't reliable. */
+ if (1 || !symbol_used_p (symbolP))
+ symbolP = symbol_clone (symbolP, 1);
+ S_CLEAR_VOLATILE (symbolP);
}
*end_name = delim;
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/symbols.c 2005-11-15 09:30:28.000000000 +0100
+++ 2005-11-16/gas/symbols.c 2005-11-16 09:44:48.856878752 +0100
@@ -333,8 +333,18 @@ colon (/* Just seen "x:" - rattle symbol
locsym->lsy_value = frag_now_fix ();
}
else if (!(S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
- || S_IS_COMMON (symbolP))
+ || S_IS_COMMON (symbolP)
+ || S_IS_VOLATILE (symbolP))
{
+ if (S_IS_VOLATILE (symbolP)
+ /* This could be avoided when the symbol wasn't used so far, but
+ the comment in struc-symbol.h says this flag isn't reliable. */
+ && (1 || !symbol_used_p (symbolP)))
+ {
+ symbolP = symbol_clone (symbolP, 1);
+ S_SET_VALUE (symbolP, 0);
+ S_CLEAR_VOLATILE (symbolP);
+ }
if (S_GET_VALUE (symbolP) == 0)
{
symbolP->sy_frag = frag_now;
@@ -421,7 +431,10 @@ colon (/* Just seen "x:" - rattle symbol
if (!(frag_now == symbolP->sy_frag
&& S_GET_VALUE (symbolP) == frag_now_fix ()
&& S_GET_SEGMENT (symbolP) == now_seg))
- as_bad (_("symbol `%s' is already defined"), sym_name);
+ {
+ as_bad (_("symbol `%s' is already defined"), sym_name);
+ symbolP = symbol_clone (symbolP, 0);
+ }
}
}
@@ -2187,6 +2200,13 @@ S_SET_VOLATILE (symbolS *s)
}
void
+S_CLEAR_VOLATILE (symbolS *s)
+{
+ if (!LOCAL_SYMBOL_CHECK (s))
+ s->sy_volatile = 0;
+}
+
+void
S_SET_FORWARD_REF (symbolS *s)
{
if (LOCAL_SYMBOL_CHECK (s))
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/symbols.h 2005-10-26 14:26:28.000000000 +0200
+++ 2005-11-16/gas/symbols.h 2005-11-10 10:53:51.000000000 +0100
@@ -108,6 +108,7 @@ extern void S_SET_WEAKREFD (symbolS *);
extern void S_CLEAR_WEAKREFD (symbolS *);
extern void S_SET_THREAD_LOCAL (symbolS *);
extern void S_SET_VOLATILE (symbolS *);
+extern void S_CLEAR_VOLATILE (symbolS *);
extern void S_SET_FORWARD_REF (symbolS *);
#ifndef WORKING_DOT_WORD
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/cond.l 2005-10-11 13:16:17.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/cond.l 2005-11-11 13:44:02.000000000 +0100
@@ -24,7 +24,13 @@
29[ ]+.else
31[ ]+.endif
[ ]*[1-9][0-9]*[ ]+
+[ ]*[1-9][0-9]*[ ]+\.comm[ ]+c,[ ]*1[ ]*
+[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+c[ ]*
+[ ]*[1-9][0-9]*[ ]+\.endif[ ]*
+[ ]*[1-9][0-9]*[ ]+
[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+x,[ ]*y[ ]*
+[ ]*[1-9][0-9]*[ ]+\.ifndef[ ]+x[ ]*
+[ ]*[1-9][0-9]*[ ]+\.endif[ ]*
[ ]*[1-9][0-9]*[ ]+\.equiv[ ]+y,[ ]*0[ ]*
[ ]*[1-9][0-9]*[ ]+\.if[ ]+x[ ]*
[ ]*[1-9][0-9]*[ ]+\.elseif[ ]+x[ ]*
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/cond.s 2005-10-11 14:31:18.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/cond.s 2005-11-11 13:40:54.000000000 +0100
@@ -30,7 +30,15 @@
.long 9
.endif
+ .comm c, 1
+ .ifndef c
+ .err
+ .endif
+
.equiv x, y
+ .ifndef x
+ .err
+ .endif
.equiv y, 0
.if x
.err
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/gas.exp 2005-11-09 15:40:05.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/gas.exp 2005-11-11 16:22:14.000000000 +0100
@@ -74,16 +74,24 @@ case $target_triplet in {
# .set works differently on some targets.
case $target_triplet in {
{ alpha*-*-* } { }
- { iq2000*-*-* } { }
{ mips*-*-* } { }
{ *c54x*-*-* } { }
{ z80-*-* } { }
default {
setup_xfail "*c30*-*-*" "*c4x*-*-*" "pdp11-*-*"
run_dump_test redef
- setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-coff" "arm*-*-pe*" "crx*-*-*"
- setup_xfail "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*"
+ setup_xfail "*c30*-*-*" "*c4x*-*-*" "*arm*-*-*aout*" "*arm*-*-*coff" \
+ "*arm*-*-pe" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" "maxq-*-*" \
+ "pdp11-*-*" "vax*-*-*" "z8k-*-*"
run_dump_test redef2
+ setup_xfail "*-*-aix*" "*-*-coff" "*-*-cygwin" "*-*-mingw*" "*-*-pe*" \
+ "bfin-*-*" "*c4x*-*-*" "crx*-*-*" "h8300*-*-*" "m68hc*-*-*" \
+ "maxq-*-*" "or32-*-*" "pdp11-*-*" "vax*-*-*" "z8k-*-*"
+ run_dump_test redef3
+ setup_xfail "*c4x*-*-*"
+ gas_test_error "redef4.s" "" ".set for symbol already used as label"
+ setup_xfail "*c4x*-*-*"
+ gas_test_error "redef5.s" "" ".set for symbol already defined through .comm"
}
}
@@ -256,6 +264,9 @@ if { ![istarget "i960-*-*"] } {
# .set works differently on some targets.
case $target_triplet in {
+ { alpha*-*-* } { }
+ { mips*-*-* } { }
+ { *c54x*-*-* } { }
{ z80-*-* } { }
default {
run_dump_test weakref1
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef2.d 2005-10-20 17:29:25.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/redef2.d 2005-11-10 17:27:22.000000000 +0100
@@ -5,9 +5,11 @@
RELOCATION RECORDS FOR .*
.*
-0+0.*(here|\.data)
-0+8.*xtrn
+0+00.*(here|\.data)
+0+08.*xtrn
+0+10.*(sym|\.data(\+0x0+10)?)
#...
Contents of section \.data:
0000 00000000 11111111 00000000 22222222[ ]+................[ ]*
+ 0010 [01]00000[01]0 .*
#pass
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef2.s 2005-10-20 16:22:58.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/all/redef2.s 2005-11-10 10:43:48.000000000 +0100
@@ -8,3 +8,5 @@ here:
.long sym
.set sym, 0x22222222
.long sym
+sym:
+ .long sym
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef3.d 1970-01-01 01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef3.d 2005-11-11 09:48:35.000000000 +0100
@@ -0,0 +1,15 @@
+#objdump: -rsj .data
+#name: .equ redefinitions (3)
+
+.*: .*
+
+RELOCATION RECORDS FOR .*
+.*
+0+00.*(here|\.data)
+0+08.*xtrn
+0+10.*sym
+#...
+Contents of section \.data:
+ 0000 00000000 11111111 00000000 22222222[ ]+................[ ]*
+ 0010 00000000 .*
+#pass
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef3.s 1970-01-01 01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef3.s 2005-11-10 11:55:40.000000000 +0100
@@ -0,0 +1,12 @@
+ .data
+here:
+ .set sym, here
+ .long sym
+ .set sym, 0x11111111
+ .long sym
+ .set sym, xtrn
+ .long sym
+ .set sym, 0x22222222
+ .long sym
+ .comm sym, 1
+ .long sym
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef4.s 1970-01-01 01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef4.s 2005-11-10 10:44:51.000000000 +0100
@@ -0,0 +1,3 @@
+ .data
+sym:
+ .set sym, 0
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/all/redef5.s 1970-01-01 01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/all/redef5.s 2005-11-10 11:53:00.000000000 +0100
@@ -0,0 +1,2 @@
+ .comm sym, 1
+ .set sym, 0
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/elf/redef.d 2005-10-27 11:41:28.000000000 +0200
+++ 2005-11-16/gas/testsuite/gas/elf/redef.d 2005-11-10 11:08:19.000000000 +0100
@@ -1,6 +1,5 @@
#objdump: -t
#name: .equ redefinitions (ELF)
-#source: ../all/redef2.s
.*: .*
--- /home/jbeulich/src/binutils/mainline/2005-11-16/gas/testsuite/gas/elf/redef.s 1970-01-01 01:00:00.000000000 +0100
+++ 2005-11-16/gas/testsuite/gas/elf/redef.s 2005-11-10 11:07:10.000000000 +0100
@@ -0,0 +1,10 @@
+ .data
+here:
+ .set sym, here
+ .long sym
+ .set sym, 0x11111111
+ .long sym
+ .set sym, xtrn
+ .long sym
+ .set sym, 0x22222222
+ .long sym
next prev parent reply other threads:[~2005-11-17 8:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-27 10:41 Hans-Peter Nilsson
2005-10-27 11:21 ` Jan Beulich
2005-10-27 14:08 ` Alexandre Oliva
2005-10-27 15:02 ` Jan Beulich
2005-10-27 16:18 ` Alexandre Oliva
2005-10-29 10:55 ` Hans-Peter Nilsson
2005-10-31 9:35 ` Jan Beulich
2005-11-04 1:57 ` Alan Modra
2005-11-04 8:06 ` Jan Beulich
2005-11-04 9:59 ` Alan Modra
2005-11-04 19:44 ` Alexandre Oliva
2005-11-08 19:01 ` Khem Raj
2005-11-08 19:46 ` PATCH: Fix sysdeps/wordsize-32/symbol-hacks.h for new gas H. J. Lu
2005-11-09 8:24 ` Your gas changes caused weakref failures for cris-elf, supposedly others too Jan Beulich
2005-11-14 8:05 ` [PATCH] " Jan Beulich
2005-11-14 21:48 ` Alan Modra
2005-11-15 7:53 ` Jan Beulich
2005-11-15 9:04 ` Alan Modra
2005-11-15 22:57 ` Set bfd_com_section on all common syms Alan Modra
2005-11-16 1:49 ` Alan Modra
2005-11-16 7:59 ` Alan Modra
2005-11-16 9:10 ` [PATCH] Re: Your gas changes caused weakref failures for cris-elf, supposedly others too Jan Beulich
2005-11-16 9:59 ` Alan Modra
2005-11-17 8:37 ` Jan Beulich [this message]
2005-10-27 16:07 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=437C4F49.76F0.0078.0@novell.com \
--to=jbeulich@novell.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).