diff options
| author | Russ Cox <rsc@golang.org> | 2015-01-29 16:16:24 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-02-03 18:22:45 +0000 |
| commit | 76fed5426ceaea6cd08be0d22da57062d4ae29a9 (patch) | |
| tree | 39b488ade818f7be3b231d033cfec286faf60629 /src/liblink/obj8.c | |
| parent | 6654188190cb8ff2be716417cc1b5086b20a5fa3 (diff) | |
| download | go-76fed5426ceaea6cd08be0d22da57062d4ae29a9.tar.xz | |
liblink: the zero Prog is now valid and ready for use
Use AXXX instead of AGOK (neither is a valid instruction but AXXX is zero)
for the initial setting of Prog.as, and now there are no non-zero default
field settings.
Remove the arch-specific zprog/zprg in favor of a single global zprog.
Remove the arch-specific prg constructor in favor of emallocz(sizeof(Prog)).
Change-Id: Ia73078726768333d7cdba296f548170c1bea9498
Reviewed-on: https://go-review.googlesource.com/3575
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink/obj8.c')
| -rw-r--r-- | src/liblink/obj8.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/liblink/obj8.c b/src/liblink/obj8.c index 37ef8a490e..7ce21ec6cd 100644 --- a/src/liblink/obj8.c +++ b/src/liblink/obj8.c @@ -35,18 +35,6 @@ #include "../cmd/8l/8.out.h" #include "../runtime/stack.h" -static Prog zprg = { - .as = AGOK, - .from = { - .type = TYPE_NONE, - .index = REG_NONE, - }, - .to = { - .type = TYPE_NONE, - .index = REG_NONE, - }, -}; - static int isdata(Prog *p) { @@ -244,16 +232,6 @@ progedit(Link *ctxt, Prog *p) } } -static Prog* -prg(void) -{ - Prog *p; - - p = emallocz(sizeof(*p)); - *p = zprg; - return p; -} - static Prog* load_g_cx(Link*, Prog*); static Prog* stacksplit(Link*, Prog*, int32, int, Prog**); @@ -681,7 +659,7 @@ follow(Link *ctxt, LSym *s) ctxt->cursym = s; - firstp = ctxt->arch->prg(); + firstp = emallocz(sizeof(Prog)); lastp = firstp; xfol(ctxt, s->text, &lastp); lastp->link = nil; @@ -808,7 +786,7 @@ loop: goto loop; } } /* */ - q = ctxt->arch->prg(); + q = emallocz(sizeof(Prog)); q->as = AJMP; q->lineno = p->lineno; q->to.type = TYPE_BRANCH; @@ -877,7 +855,6 @@ LinkArch link386 = { .follow = follow, .iscall = iscall, .isdata = isdata, - .prg = prg, .progedit = progedit, .minlc = 1, |
