From 77a415e5a698e8f897aed8aa64db6855b8f952fc Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 29 Jan 2015 14:58:54 -0500 Subject: liblink: place TEXT/GLOBL flags in p->from3 always Before, amd64 and 386 stored the flags in p->from.scale and arm and ppc64 stored the flags in p->reg. Both caused special cases in printing and in handling of the addresses. To avoid possible conflicts with the real meaning of p->from and to avoid storing a non-register value in a reg field, use from3 to hold a TYPE_CONST value giving the flags. There is still a special case for printing, because the flags are specified without a $, and normally a TYPE_CONST prints with a $. But that's much less special than what came before. This allows us to remove the textflag and settextflag methods from LinkArch. They are no longer architecture-specific. Change-Id: I931da8e1ecd92e127cd9aa44ef5a73c42e730110 Reviewed-on: https://go-review.googlesource.com/3572 Reviewed-by: Austin Clements --- src/liblink/obj8.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src/liblink/obj8.c') diff --git a/src/liblink/obj8.c b/src/liblink/obj8.c index cceeeb1b87..16b0e07eac 100644 --- a/src/liblink/obj8.c +++ b/src/liblink/obj8.c @@ -68,18 +68,6 @@ datasize(Prog *p) return p->from.scale; } -static int -textflag(Prog *p) -{ - return p->from.scale; -} - -static void -settextflag(Prog *p, int f) -{ - p->from.scale = f; -} - static int canuselocaltls(Link *ctxt) { @@ -302,12 +290,12 @@ preprocess(Link *ctxt, LSym *cursym) q = nil; - if(!(p->from.scale & NOSPLIT) || (p->from.scale & WRAPPER)) { + if(!(p->from3.offset & NOSPLIT) || (p->from3.offset & WRAPPER)) { p = appendp(ctxt, p); p = load_g_cx(ctxt, p); // load g into CX } - if(!(cursym->text->from.scale & NOSPLIT)) - p = stacksplit(ctxt, p, autoffset, !(cursym->text->from.scale&NEEDCTXT), &q); // emit split check + if(!(cursym->text->from3.offset & NOSPLIT)) + p = stacksplit(ctxt, p, autoffset, !(cursym->text->from3.offset&NEEDCTXT), &q); // emit split check if(autoffset) { p = appendp(ctxt, p); @@ -330,7 +318,7 @@ preprocess(Link *ctxt, LSym *cursym) q->pcond = p; deltasp = autoffset; - if(cursym->text->from.scale & WRAPPER) { + if(cursym->text->from3.offset & WRAPPER) { // if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame // // MOVL g_panic(CX), BX @@ -401,7 +389,7 @@ preprocess(Link *ctxt, LSym *cursym) p2->pcond = p; } - if(ctxt->debugzerostack && autoffset && !(cursym->text->from.scale&NOSPLIT)) { + if(ctxt->debugzerostack && autoffset && !(cursym->text->from3.offset&NOSPLIT)) { // 8l -Z means zero the stack frame on entry. // This slows down function calls but can help avoid // false positives in garbage collection. @@ -894,8 +882,6 @@ LinkArch link386 = { .isdata = isdata, .prg = prg, .progedit = progedit, - .settextflag = settextflag, - .textflag = textflag, .minlc = 1, .ptrsize = 4, -- cgit v1.3-5-g9baa