This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] MIPS/gas: Redefined label alignment assertion failure fix
On Mon, Sep 21, 2009 at 02:28:42PM +0100, Maciej W. Rozycki wrote:
> > > * config/tc-mips.c (mips_align): Don't align the label if from
> > > another segment; remove the assertion failure for same.
I think it's a minor bug in the generic code. (Minor because we've
already hit as_bad.) Since we go to the bother of cloning the symbol
we may as well give the clone the proper value.
I'll apply this after running the testsuite on a bunch of targets.
* symbols.c (define_sym_at_dot): New function, extracted from..
(colon): ..here. Define error case cloned symbol.
Index: gas/symbols.c
===================================================================
RCS file: /cvs/src/src/gas/symbols.c,v
retrieving revision 1.98
diff -u -p -r1.98 symbols.c
--- gas/symbols.c 11 Sep 2009 15:27:33 -0000 1.98
+++ gas/symbols.c 23 Sep 2009 02:52:39 -0000
@@ -246,6 +246,17 @@ local_symbol_convert (struct local_symbo
return ret;
}
+static void
+define_sym_at_dot (symbolS *symbolP)
+{
+ symbolP->sy_frag = frag_now;
+#ifdef OBJ_VMS
+ S_SET_OTHER (symbolP, const_flag);
+#endif
+ S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
+ S_SET_SEGMENT (symbolP, now_seg);
+}
+
/* We have just seen "<name>:".
Creates a struct symbol unless it already exists.
@@ -343,12 +354,7 @@ colon (/* Just seen "x:" - rattle symbol
}
if (S_GET_VALUE (symbolP) == 0)
{
- symbolP->sy_frag = frag_now;
-#ifdef OBJ_VMS
- S_SET_OTHER (symbolP, const_flag);
-#endif
- S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
- S_SET_SEGMENT (symbolP, now_seg);
+ define_sym_at_dot (symbolP);
#ifdef N_UNDF
know (N_UNDF == 0);
#endif /* if we have one, it better be zero. */
@@ -393,12 +399,7 @@ colon (/* Just seen "x:" - rattle symbol
{
/* It is a .comm/.lcomm being converted to initialized
data. */
- symbolP->sy_frag = frag_now;
-#ifdef OBJ_VMS
- S_SET_OTHER (symbolP, const_flag);
-#endif
- S_SET_VALUE (symbolP, (valueT) frag_now_fix ());
- S_SET_SEGMENT (symbolP, now_seg); /* Keep N_EXT bit. */
+ define_sym_at_dot (symbolP);
}
}
else
@@ -431,6 +432,7 @@ colon (/* Just seen "x:" - rattle symbol
{
as_bad (_("symbol `%s' is already defined"), sym_name);
symbolP = symbol_clone (symbolP, 0);
+ define_sym_at_dot (symbolP);
}
}
--
Alan Modra
Australia Development Lab, IBM