diff options
author | Russ Cox <rsc@golang.org> | 2013-12-16 12:51:38 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-12-16 12:51:38 -0500 |
commit | 737d6de29569572e16839f9cf6d91cc1db75b622 (patch) | |
tree | 8d2d16fd6763a7e7317028e0b61b50e538ca98f0 /src/cmd/6a | |
parent | e8d8bd79905af585c48536115f96399e0e362326 (diff) | |
download | go-737d6de29569572e16839f9cf6d91cc1db75b622.tar.gz |
cmd/cc, cmd/gc: update compilers, assemblers for liblink changes
- add buffered stdout to all tools and provide to link ctxt.
- avoid extra \n before ! in .6 files written by assemblers
(makes them match the C compilers).
- use linkwriteobj instead of linkouthist+linkwritefuncs.
- in assemblers and C compilers, record pc explicitly in Prog,
for use by liblink.
- in C compilers, preserve jump target links.
- in Go compilers (gsubr.c) attach gotype directly to
corresponding LSym* instead of rederiving from instruction stream.
- in Go compilers, emit just one definition for runtime.zerovalue
from each compilation.
This CL consists entirely of small adjustments.
The heavy lifting is in CL 39680043.
Each depends on the other.
R=golang-dev, dave, iant
CC=golang-dev
https://codereview.appspot.com/37030045
Diffstat (limited to 'src/cmd/6a')
-rw-r--r-- | src/cmd/6a/a.h | 1 | ||||
-rw-r--r-- | src/cmd/6a/lex.c | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/cmd/6a/a.h b/src/cmd/6a/a.h index db72accd7..da12b3298 100644 --- a/src/cmd/6a/a.h +++ b/src/cmd/6a/a.h @@ -137,6 +137,7 @@ EXTERN char* thestring; EXTERN int32 thunk; EXTERN Biobuf obuf; EXTERN Link* ctxt; +EXTERN Biobuf bstdout; void* alloc(int32); void* allocn(void*, int32, int32); diff --git a/src/cmd/6a/lex.c b/src/cmd/6a/lex.c index 97c78d161..e69069e41 100644 --- a/src/cmd/6a/lex.c +++ b/src/cmd/6a/lex.c @@ -65,8 +65,12 @@ main(int argc, char *argv[]) thechar = '6'; thestring = "amd64"; + ctxt = linknew(&linkamd64); ctxt->diag = yyerror; + ctxt->bso = &bstdout; + Binit(&bstdout, 1, OWRITE); + listinit6(); ensuresymb(NSYMB); memset(debug, 0, sizeof(debug)); @@ -103,6 +107,7 @@ main(int argc, char *argv[]) ctxt->debugasm++; break; } ARGEND + if(*argv == 0) { print("usage: %ca [-options] file.s\n", thechar); errorexit(); @@ -113,6 +118,7 @@ main(int argc, char *argv[]) } if(assemble(argv[0])) errorexit(); + Bflush(&bstdout); exits(0); } @@ -152,7 +158,7 @@ assemble(char *file) } Binit(&obuf, of, OWRITE); Bprint(&obuf, "go object %s %s %s\n", getgoos(), thestring, getgoversion()); - Bprint(&obuf, "\n!\n"); + Bprint(&obuf, "!\n"); for(pass = 1; pass <= 2; pass++) { pinit(file); @@ -164,8 +170,7 @@ assemble(char *file) return nerrors; } - linkouthist(ctxt, &obuf); - linkwritefuncs(ctxt, &obuf); + linkwriteobj(ctxt, &obuf); Bflush(&obuf); return 0; } @@ -1098,6 +1103,7 @@ outcode(int a, Addr2 *g2) p->lineno = stmtline; p->from = g2->from; p->to = g2->to; + p->pc = pc; if(lastpc == nil) { pl = linknewplist(ctxt); |