This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Your gas changes caused weakref failures for cris-elf,supposedly others too


On Nov  4, 2005, "Jan Beulich" <JBeulich@novell.com> wrote:

> Finally, Alexandre promised to address the problems (attached,
> unfortunately not copied to the list), which is why I didn't spend
> any time on addressing these (not to mention that I didn't really
> have time to do so).  Meanwhile I suggest the following (probably I
> could even consider this obvious and don't wait for approval...):

Yeah, sorry that it took me so long to get back to this.  Funny that
I'd start working on the patch before even seeing this exchange of
yours.  I had to update my source tree and re-create my patch such
that it would apply after your check in :-)

There's one bit I'm confused about.  It seems to be that, after your
patch to flag redefinitions, we'd still accept:

.set a, b
a:

although I'd think this should be rejected, just like other
redefinitions, no?  I've included the change to reject this (and
similar redefinitions of weakrefs) in my patch, which I'm checking in
as obvious, although I'm a bit concerned that this one change is not
entirely obvious, so if anyone disagrees with it, feel free to revert
the bit in symbols.c to get it back in shape.

Jan, I couldn't quite figure out the meaning of volatile and
forward_ref, that I believe were introduced in your patch (I don't
recall having seen them before).  Would you please document them in
gas/doc, like the other fields and accessor functions?

Tested on amd64-linux-gnu.  Checking in...

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* read.c (s_weakref): Do not permit redefinitions.
	* symbols.c (colon): Do not permit redefinitions of equated
	symbols.

Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.111
diff -u -p -r1.111 read.c
--- gas/read.c 27 Oct 2005 07:40:07 -0000 1.111
+++ gas/read.c 4 Nov 2005 19:36:10 -0000
@@ -3178,6 +3178,14 @@ s_weakref (int ignore ATTRIBUTE_UNUSED)
 
   symbolP = symbol_find_or_make (name);
 
+  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;
+    }
+
   *end_name = delim;
 
   SKIP_WHITESPACE ();
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.68
diff -u -p -r1.68 symbols.c
--- gas/symbols.c 27 Oct 2005 07:40:07 -0000 1.68
+++ gas/symbols.c 4 Nov 2005 19:36:12 -0000
@@ -332,7 +332,8 @@ colon (/* Just seen "x:" - rattle symbol
 	  local_symbol_set_frag (locsym, frag_now);
 	  locsym->lsy_value = frag_now_fix ();
 	}
-      else if (!S_IS_DEFINED (symbolP) || S_IS_COMMON (symbolP))
+      else if (!(S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP))
+	       || S_IS_COMMON (symbolP))
 	{
 	  if (S_GET_VALUE (symbolP) == 0)
 	    {
Index: gas/testsuite/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* gas/all/gas.exp: Remove weakref xfail.  Run weakref4.s.
	* gas/all/weakref1.s: Move redefinition bits to...
	* gas/all/weakref4.s: ... new file.
	* gas/all/weakref1.d: Remove command moved to weakref1u.  Adjust
	remaining command for leading tabs.  Regenerate.
	* gas/all/weakref1l.d: Regenerate.
	* gas/all/weakref1u.d: Likewise.
	* gas/all/wealref1w.d: Likewise.

Index: gas/testsuite/gas/all/gas.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/gas.exp,v
retrieving revision 1.35
diff -u -p -r1.35 gas.exp
--- gas/testsuite/gas/all/gas.exp 4 Nov 2005 13:25:59 -0000 1.35
+++ gas/testsuite/gas/all/gas.exp 4 Nov 2005 19:36:19 -0000
@@ -256,20 +256,16 @@ if { ![istarget "i960-*-*"] } {
 case $target_triplet in {
     { z80-*-* } { }
     default {
-	setup_xfail *-*-*
 	run_dump_test weakref1
-	setup_xfail *-*-*
 	run_dump_test weakref1g
-	setup_xfail *-*-*
 	run_dump_test weakref1l
-	setup_xfail *-*-*
 	run_dump_test weakref1u
-	setup_xfail *-*-*
 	run_dump_test weakref1w
     }
 }
 gas_test_error "weakref2.s" "" "e: would close weakref loop: e => a => b => c => d => e"
 gas_test_error "weakref3.s" "" "a: would close weakref loop: a => b => c => d => e => a"
+gas_test_error "weakref4.s" "" "is already defined"
 
 load_lib gas-dg.exp
 dg-init
Index: gas/testsuite/gas/all/weakref1.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1.d,v
retrieving revision 1.1
diff -u -p -r1.1 weakref1.d
--- gas/testsuite/gas/all/weakref1.d 24 Oct 2005 17:51:42 -0000 1.1
+++ gas/testsuite/gas/all/weakref1.d 4 Nov 2005 19:36:19 -0000
@@ -11,9 +11,7 @@ OFFSET +TYPE +VALUE *
 # the rest of this file is generated with the following script:
 # # script begin
 # echo \#...
-# sed -n 's:^\.weakref .*, \(\(u\|\(w\)\).*\)$:.*( \3 |\(sec  0\)).* \1:p' weakref1.s | uniq | while read line; do echo "$line"; echo "#..."; done
-
-# sed -n 's:^\.long \(W\|\)\(.*[^a-z]\)[a-z]*\(\| - .*\)$:\2:p' weakref1.s | sed -e 's,^[lg].*,(&|\\.text)(\\+0x[0-9a-f]+)?,' | sed 's,^,[0-9a-f]+ [^ ]*  +,'
+# sed -n 's:^[ 	]*\.long \(W\|\)\(.*[^a-z]\)[a-z]*\(\| - .*\)$:\2:p' weakref1.s | sed -e 's,^[lg].*,(&|\\.text)(\\+0x[0-9a-f]+)?,' | sed 's,^,[0-9a-f]+ [^ ]*  +,'
 # # script output:
 #...
 [0-9a-f]+ [^ ]*  +wa1
@@ -71,8 +69,6 @@ OFFSET +TYPE +VALUE *
 [0-9a-f]+ [^ ]*  +ww9
 [0-9a-f]+ [^ ]*  +ww10
 [0-9a-f]+ [^ ]*  +ww10
-[0-9a-f]+ [^ ]*  +um2
-[0-9a-f]+ [^ ]*  +wm3
 [0-9a-f]+ [^ ]*  +um5
 [0-9a-f]+ [^ ]*  +wm6
 [0-9a-f]+ [^ ]*  +wm7
@@ -87,18 +83,6 @@ OFFSET +TYPE +VALUE *
 [0-9a-f]+ [^ ]*  +uh8
 [0-9a-f]+ [^ ]*  +uh9
 [0-9a-f]+ [^ ]*  +uh9
-[0-9a-f]+ [^ ]*  +(lr1|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(lr1|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(lr2|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(lr2|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +wr3
-[0-9a-f]+ [^ ]*  +wr3
-[0-9a-f]+ [^ ]*  +wr4
-[0-9a-f]+ [^ ]*  +wr5
-[0-9a-f]+ [^ ]*  +(lr6|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +ur6
-[0-9a-f]+ [^ ]*  +(lr7|\.text)(\+0x[0-9a-f]+)?
-[0-9a-f]+ [^ ]*  +(lr7|\.text)(\+0x[0-9a-f]+)?
 [0-9a-f]+ [^ ]*  +(ld1|\.text)(\+0x[0-9a-f]+)?
 [0-9a-f]+ [^ ]*  +(ld2|\.text)(\+0x[0-9a-f]+)?
 [0-9a-f]+ [^ ]*  +(ld3|\.text)(\+0x[0-9a-f]+)?
Index: gas/testsuite/gas/all/weakref1.s
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1.s,v
retrieving revision 1.1
diff -u -p -r1.1 weakref1.s
--- gas/testsuite/gas/all/weakref1.s 24 Oct 2005 17:51:42 -0000 1.1
+++ gas/testsuite/gas/all/weakref1.s 4 Nov 2005 19:36:19 -0000
@@ -126,17 +126,6 @@ l:
 	.weak ww10
 
 /* m# test multiple weakrefs */
-	.weakref Wnm1, nm1
-	.weakref Wnm1, nm1
-
-	.weakref Wum2, um2
-	.weakref Wum2, um2
-	.long um2
-
-	.weakref Wwm3, wm3
-	.weakref Wwm3, wm3
-	.long Wwm3
-
 	.weakref Wnm4a, nm4
 	.weakref Wnm4b, nm4
 
@@ -197,40 +186,6 @@ l:
 	.weakref Wuh9a, uh9
 	.long uh9
 
-/* r# weakref redefinitions, to and from */
-	.weakref lr1, nr1
-	.long lr1
-	.set lr1, l
-	.long lr1
-
-	.long lr2
-	.weakref lr2, nr2
-	.set lr2, l
-	.long lr2
-
-	.set Wwr3, l
-	.long Wwr3
-	.weakref Wwr3, wr3
-	.long Wwr3
-
-	.set Wwr4, l
-	.weakref Wwr4, wr4
-	.long Wwr4
-
-	.set Wwr5, l
-	.long Wwr5
-	.weakref Wwr5, wr5
-
-	.weakref lr6, ur6
-	.long lr6
-	.set lr6, l
-	.long ur6
-
-	.weakref lr7, nr7
-	.long lr7
-lr7:
-	.long lr7
-
 /* d# target symbol definitions */
 	.weakref Wld1, ld1
 	.long Wld1
Index: gas/testsuite/gas/all/weakref1l.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1l.d,v
retrieving revision 1.1
diff -u -p -r1.1 weakref1l.d
--- gas/testsuite/gas/all/weakref1l.d 24 Oct 2005 17:51:42 -0000 1.1
+++ gas/testsuite/gas/all/weakref1l.d 4 Nov 2005 19:36:19 -0000
@@ -13,14 +13,6 @@
 #...
 .* t l
 #...
-.* t lr1
-#...
-.* t lr2
-#...
-.* t lr6
-#...
-.* t lr7
-#...
 .* t ld1
 #...
 .* t ld2
Index: gas/testsuite/gas/all/weakref1u.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1u.d,v
retrieving revision 1.1
diff -u -p -r1.1 weakref1u.d
--- gas/testsuite/gas/all/weakref1u.d 24 Oct 2005 17:51:42 -0000 1.1
+++ gas/testsuite/gas/all/weakref1u.d 4 Nov 2005 19:36:19 -0000
@@ -39,15 +39,11 @@
 #...
 .* U uc9
 #...
-.* U um2
-#...
 .* U um5
 #...
 .* U uh8
 #...
 .* U uh9
 #...
-.* U ur6
-#...
 .* U ud5
 #pass
Index: gas/testsuite/gas/all/weakref1w.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/all/weakref1w.d,v
retrieving revision 1.1
diff -u -p -r1.1 weakref1w.d
--- gas/testsuite/gas/all/weakref1w.d 24 Oct 2005 17:51:42 -0000 1.1
+++ gas/testsuite/gas/all/weakref1w.d 4 Nov 2005 19:36:19 -0000
@@ -36,8 +36,6 @@
 #...
 .* w ww10
 #...
-.* w wm3
-#...
 .* w wm6
 #...
 .* w wm7
@@ -55,10 +53,4 @@
 .* w wh6
 #...
 .* w wh7
-#...
-.* w wr3
-#...
-.* w wr4
-#...
-.* w wr5
 #pass
Index: gas/testsuite/gas/all/weakref4.s
===================================================================
RCS file: gas/testsuite/gas/all/weakref4.s
diff -N gas/testsuite/gas/all/weakref4.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/all/weakref4.s 4 Nov 2005 19:36:19 -0000
@@ -0,0 +1,45 @@
+/* m# test multiple weakrefs */
+	.weakref Wnm1, nm1
+	.weakref Wnm1, nm1
+
+	.weakref Wum2, um2
+	.weakref Wum2, um2
+	.long um2
+
+	.weakref Wwm3, wm3
+	.weakref Wwm3, wm3
+	.long Wwm3
+
+/* r# weakref redefinitions, to and from */
+	.weakref lr1, nr1
+	.long lr1
+	.set lr1, l
+	.long lr1
+
+	.long lr2
+	.weakref lr2, nr2
+	.set lr2, l
+	.long lr2
+
+	.set Wwr3, l
+	.long Wwr3
+	.weakref Wwr3, wr3
+	.long Wwr3
+
+	.set Wwr4, l
+	.weakref Wwr4, wr4
+	.long Wwr4
+
+	.set Wwr5, l
+	.long Wwr5
+	.weakref Wwr5, wr5
+
+	.weakref lr6, ur6
+	.long lr6
+	.set lr6, l
+	.long ur6
+
+	.weakref lr7, nr7
+	.long lr7
+lr7:
+	.long lr7
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]