]> Cypherpunks repositories - gostls13.git/commitdiff
liblink: use LinkArch.textflag() to get text and dataflag
authorShenghou Ma <minux@golang.org>
Wed, 6 Aug 2014 04:24:43 +0000 (00:24 -0400)
committerShenghou Ma <minux@golang.org>
Wed, 6 Aug 2014 04:24:43 +0000 (00:24 -0400)
Rather than switch on thechar.

LGTM=rsc, dave
R=rsc, iant, dave
CC=golang-codereviews
https://golang.org/cl/119330043

src/liblink/objfile.c

index 610f87954efb1afac36610253b340fc4183b751a..22c9199d5e13bfe2ac23811a4eaae6db7ac9d18a 100644 (file)
@@ -183,12 +183,7 @@ writeobj(Link *ctxt, Biobuf *b)
                                s->size = p->to.offset;
                                if(s->type == 0 || s->type == SXREF)
                                        s->type = SBSS;
-                               
-                               if(ctxt->arch->thechar == '5')
-                                       flag = p->reg;
-                               else
-                                       flag = p->from.scale;
-                                       
+                               flag = ctxt->arch->textflag(p);
                                if(flag & DUPOK)
                                        s->dupok = 1;
                                if(flag & RODATA)
@@ -221,10 +216,7 @@ writeobj(Link *ctxt, Biobuf *b)
                                else
                                        etext->next = s;
                                etext = s;
-                               if(ctxt->arch->thechar == '5')
-                                       flag = p->reg;
-                               else
-                                       flag = p->from.scale;
+                               flag = ctxt->arch->textflag(p);
                                if(flag & DUPOK)
                                        s->dupok = 1;
                                if(flag & NOSPLIT)