diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-29 14:58:54 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-02-03 18:22:15 +0000 |
| commit | 77a415e5a698e8f897aed8aa64db6855b8f952fc (patch) | |
| tree | a2adb923b983adfd5301f0d87c9c26949e22d9d6 /src/liblink/obj6.c | |
| parent | 72521319c733e5de62bb837508ea9fa2b1f3a0a2 (diff) | |
| download | go-77a415e5a698e8f897aed8aa64db6855b8f952fc.tar.xz | |
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 <austin@google.com>
Diffstat (limited to 'src/liblink/obj6.c')
| -rw-r--r-- | src/liblink/obj6.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/liblink/obj6.c b/src/liblink/obj6.c index 2b51061a0b..12e0606453 100644 --- a/src/liblink/obj6.c +++ b/src/liblink/obj6.c @@ -78,18 +78,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 void nacladdr(Link*, Prog*, Addr*); static int @@ -404,24 +392,24 @@ preprocess(Link *ctxt, LSym *cursym) cursym->args = textarg; cursym->locals = p->to.offset; - if(autoffset < StackSmall && !(p->from.scale & NOSPLIT)) { + if(autoffset < StackSmall && !(p->from3.offset & NOSPLIT)) { for(q = p; q != nil; q = q->link) { if(q->as == ACALL) goto noleaf; if((q->as == ADUFFCOPY || q->as == ADUFFZERO) && autoffset >= StackSmall - 8) goto noleaf; } - p->from.scale |= NOSPLIT; + p->from3.offset |= NOSPLIT; noleaf:; } 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, textarg, !(cursym->text->from.scale&NEEDCTXT), &q); // emit split check + if(!(cursym->text->from3.offset & NOSPLIT)) + p = stacksplit(ctxt, p, autoffset, textarg, !(cursym->text->from3.offset&NEEDCTXT), &q); // emit split check if(autoffset) { if(autoffset%ctxt->arch->regsize != 0) @@ -468,7 +456,7 @@ preprocess(Link *ctxt, LSym *cursym) p->to.reg = REG_BP; } - 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 // // MOVQ g_panic(CX), BX @@ -564,7 +552,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)) { // 6l -Z means zero the stack frame on entry. // This slows down function calls but can help avoid // false positives in garbage collection. @@ -1093,8 +1081,6 @@ LinkArch linkamd64 = { .isdata = isdata, .prg = prg, .progedit = progedit, - .settextflag = settextflag, - .textflag = textflag, .minlc = 1, .ptrsize = 8, @@ -1127,8 +1113,6 @@ LinkArch linkamd64p32 = { .isdata = isdata, .prg = prg, .progedit = progedit, - .settextflag = settextflag, - .textflag = textflag, .minlc = 1, .ptrsize = 4, |
