Commit 725e3a7a authored by Russ Cox's avatar Russ Cox

[dev.cc] liblink: invoke go tool objwriter during writeobj

This doesn't actually use objwriter for any real work.
It's just to check that objwriter is available.
The real work will be moved once the bootstrapping
mechanisms are working.

Change-Id: I5f41c8910c4b11b9d80cb0b0847ff9cb582fc2be
Reviewed-on: https://go-review.googlesource.com/3045Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 328ace91
......@@ -119,11 +119,36 @@ static char *rdstring(Biobuf*);
static void rddata(Biobuf*, uchar**, int*);
static LSym *rdsym(Link*, Biobuf*, char*);
void writeobjdirect(Link*, Biobuf*);
void
writeobj(Link *ctxt, Biobuf *b)
{
char *cmd[2];
// TODO(rsc): Use 'go tool objwriter' to write object file,
// allowing the bulk of liblink to be moved into Go.
// As a first step, we check that we can invoke objwriter at all
// (it is an empty program for now).
// This tests the cmd/dist bootstrap process, making sure
// that objwriter is available when it needs to be.
// Once the support mechanisms are there, we can put the
// real code in.
cmd[0] = smprint("%s/pkg/tool/%s_%s/objwriter", getgoroot(), getgohostos(), getgohostarch());
cmd[1] = "ping";
cmd[2] = nil;
if(runcmd(cmd) < 0)
sysfatal("cannot run objwriter: %r");
writeobjdirect(ctxt, b);
}
// The Go and C compilers, and the assembler, call writeobj to write
// out a Go object file. The linker does not call this; the linker
// does not write out object files.
void
writeobj(Link *ctxt, Biobuf *b)
writeobjdirect(Link *ctxt, Biobuf *b)
{
int flag, found;
Hist *h;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment