]> Cypherpunks repositories - gostls13.git/commitdiff
liblink: use explicit field for globl duplicate detection
authorRuss Cox <rsc@golang.org>
Thu, 19 Dec 2013 00:36:14 +0000 (19:36 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 19 Dec 2013 00:36:14 +0000 (19:36 -0500)
Overloading size leads to problems if clients
try to set up an LSym by hand.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/44140043

include/link.h
src/liblink/objfile.c

index c5089fc84c673f851014ec859ce6a454754783e8..2e23d20c7c4ede4ecaf5bf71e408e1d86982fb11 100644 (file)
@@ -131,6 +131,7 @@ struct      LSym
        uchar   hide;
        uchar   leaf;   // arm only
        uchar   fnptr;  // arm only
+       uchar   seenglobl;
        int16   symid;  // for writing .5/.6/.8 files
        int32   dynid;
        int32   sig;
index ba4087f07552050752aefd46b420ef229eeebd14..94a2561062a82573309250360ee5541ef558eadd 100644 (file)
@@ -167,7 +167,8 @@ linkwriteobj(Link *ctxt, Biobuf *b)
 
                        if(p->as == ctxt->arch->AGLOBL) {
                                s = p->from.sym;
-                               if(s->size) print("duplicate %P\n", p);
+                               if(s->seenglobl++)
+                                       print("duplicate %P\n", p);
                                if(data == nil)
                                        data = s;
                                else