mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
cmd/dist: add liblink build information
In addition to adding the library, change the way the anames array is created. Previously, it was written to src/cmd/6l/enam.c (and similarly for 5l and 8l) and each of the other tools (6g, 6c, 6a) compiled the 6l/enam.c file in addition to their own sources. Now that there is a library shared by all these programs, move the anames array into that library. To eliminate name conflicts, name the array after the architecture letter: anames5, anames6, anames8. First step to linker cleanup (golang.org/s/go13linker). This CL does not build by itself. It depends on the CLs introducing liblink and changing commands to use it. R=iant CC=golang-dev https://golang.org/cl/35740044
This commit is contained in:
parent
6965a752a7
commit
8642cbd660
|
@ -33,7 +33,7 @@ misc/goplay/goplay
|
||||||
misc/osx/*.pkg
|
misc/osx/*.pkg
|
||||||
misc/osx/*.dmg
|
misc/osx/*.dmg
|
||||||
src/cmd/?a/y.output
|
src/cmd/?a/y.output
|
||||||
src/cmd/?l/enam.c
|
src/liblink/anames?.c
|
||||||
src/cmd/cc/y.output
|
src/cmd/cc/y.output
|
||||||
src/cmd/cgo/zdefaultcc.go
|
src/cmd/cgo/zdefaultcc.go
|
||||||
src/cmd/dist/dist.dSYM
|
src/cmd/dist/dist.dSYM
|
||||||
|
|
2
src/cmd/dist/a.h
vendored
2
src/cmd/dist/a.h
vendored
|
@ -93,7 +93,7 @@ void cmdversion(int, char**);
|
||||||
|
|
||||||
// buildgc.c
|
// buildgc.c
|
||||||
void gcopnames(char*, char*);
|
void gcopnames(char*, char*);
|
||||||
void mkenam(char*, char*);
|
void mkanames(char*, char*);
|
||||||
|
|
||||||
// buildruntime.c
|
// buildruntime.c
|
||||||
void mkzasm(char*, char*);
|
void mkzasm(char*, char*);
|
||||||
|
|
33
src/cmd/dist/build.c
vendored
33
src/cmd/dist/build.c
vendored
|
@ -493,6 +493,18 @@ static struct {
|
||||||
"$GOROOT/include/ureg_arm.h",
|
"$GOROOT/include/ureg_arm.h",
|
||||||
"$GOROOT/include/ureg_x86.h",
|
"$GOROOT/include/ureg_x86.h",
|
||||||
}},
|
}},
|
||||||
|
{"liblink", {
|
||||||
|
"$GOROOT/include/u.h",
|
||||||
|
"$GOROOT/include/utf.h",
|
||||||
|
"$GOROOT/include/fmt.h",
|
||||||
|
"$GOROOT/include/libc.h",
|
||||||
|
"$GOROOT/include/bio.h",
|
||||||
|
"$GOROOT/include/ar.h",
|
||||||
|
"$GOROOT/include/link.h",
|
||||||
|
"anames5.c",
|
||||||
|
"anames6.c",
|
||||||
|
"anames8.c",
|
||||||
|
}},
|
||||||
{"cmd/cc", {
|
{"cmd/cc", {
|
||||||
"-pgen.c",
|
"-pgen.c",
|
||||||
"-pswt.c",
|
"-pswt.c",
|
||||||
|
@ -508,19 +520,16 @@ static struct {
|
||||||
{"cmd/5c", {
|
{"cmd/5c", {
|
||||||
"../cc/pgen.c",
|
"../cc/pgen.c",
|
||||||
"../cc/pswt.c",
|
"../cc/pswt.c",
|
||||||
"../5l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/6c", {
|
{"cmd/6c", {
|
||||||
"../cc/pgen.c",
|
"../cc/pgen.c",
|
||||||
"../cc/pswt.c",
|
"../cc/pswt.c",
|
||||||
"../6l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/8c", {
|
{"cmd/8c", {
|
||||||
"../cc/pgen.c",
|
"../cc/pgen.c",
|
||||||
"../cc/pswt.c",
|
"../cc/pswt.c",
|
||||||
"../8l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libcc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/5g", {
|
{"cmd/5g", {
|
||||||
|
@ -529,7 +538,6 @@ static struct {
|
||||||
"../gc/plive.c",
|
"../gc/plive.c",
|
||||||
"../gc/popt.c",
|
"../gc/popt.c",
|
||||||
"../gc/popt.h",
|
"../gc/popt.h",
|
||||||
"../5l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/6g", {
|
{"cmd/6g", {
|
||||||
|
@ -538,7 +546,6 @@ static struct {
|
||||||
"../gc/plive.c",
|
"../gc/plive.c",
|
||||||
"../gc/popt.c",
|
"../gc/popt.c",
|
||||||
"../gc/popt.h",
|
"../gc/popt.h",
|
||||||
"../6l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/8g", {
|
{"cmd/8g", {
|
||||||
|
@ -547,25 +554,22 @@ static struct {
|
||||||
"../gc/plive.c",
|
"../gc/plive.c",
|
||||||
"../gc/popt.c",
|
"../gc/popt.c",
|
||||||
"../gc/popt.h",
|
"../gc/popt.h",
|
||||||
"../8l/enam.c",
|
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libgc.a",
|
||||||
}},
|
}},
|
||||||
{"cmd/5l", {
|
{"cmd/5l", {
|
||||||
"../ld/*",
|
"../ld/*",
|
||||||
"enam.c",
|
|
||||||
}},
|
}},
|
||||||
{"cmd/6l", {
|
{"cmd/6l", {
|
||||||
"../ld/*",
|
"../ld/*",
|
||||||
"enam.c",
|
|
||||||
}},
|
}},
|
||||||
{"cmd/8l", {
|
{"cmd/8l", {
|
||||||
"../ld/*",
|
"../ld/*",
|
||||||
"enam.c",
|
|
||||||
}},
|
}},
|
||||||
{"cmd/go", {
|
{"cmd/go", {
|
||||||
"zdefaultcc.go",
|
"zdefaultcc.go",
|
||||||
}},
|
}},
|
||||||
{"cmd/", {
|
{"cmd/", {
|
||||||
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/liblink.a",
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libmach.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libmach.a",
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libbio.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/libbio.a",
|
||||||
"$GOROOT/pkg/obj/$GOOS_$GOARCH/lib9.a",
|
"$GOROOT/pkg/obj/$GOOS_$GOARCH/lib9.a",
|
||||||
|
@ -596,7 +600,9 @@ static struct {
|
||||||
void (*gen)(char*, char*);
|
void (*gen)(char*, char*);
|
||||||
} gentab[] = {
|
} gentab[] = {
|
||||||
{"opnames.h", gcopnames},
|
{"opnames.h", gcopnames},
|
||||||
{"enam.c", mkenam},
|
{"anames5.c", mkanames},
|
||||||
|
{"anames6.c", mkanames},
|
||||||
|
{"anames8.c", mkanames},
|
||||||
{"zasm_", mkzasm},
|
{"zasm_", mkzasm},
|
||||||
{"zdefaultcc.go", mkzdefaultcc},
|
{"zdefaultcc.go", mkzdefaultcc},
|
||||||
{"zsys_", mkzsys},
|
{"zsys_", mkzsys},
|
||||||
|
@ -605,6 +611,9 @@ static struct {
|
||||||
{"zruntime_defs_", mkzruntimedefs},
|
{"zruntime_defs_", mkzruntimedefs},
|
||||||
{"zversion.go", mkzversion},
|
{"zversion.go", mkzversion},
|
||||||
{"zaexperiment.h", mkzexperiment},
|
{"zaexperiment.h", mkzexperiment},
|
||||||
|
|
||||||
|
// not generated anymore, but delete the file if we see it
|
||||||
|
{"enam.c", nil},
|
||||||
};
|
};
|
||||||
|
|
||||||
// install installs the library, package, or binary associated with dir,
|
// install installs the library, package, or binary associated with dir,
|
||||||
|
@ -869,6 +878,8 @@ install(char *dir)
|
||||||
p = files.p[i];
|
p = files.p[i];
|
||||||
elem = lastelem(p);
|
elem = lastelem(p);
|
||||||
for(j=0; j<nelem(gentab); j++) {
|
for(j=0; j<nelem(gentab); j++) {
|
||||||
|
if(gentab[j].gen == nil)
|
||||||
|
continue;
|
||||||
if(hasprefix(elem, gentab[j].nameprefix)) {
|
if(hasprefix(elem, gentab[j].nameprefix)) {
|
||||||
if(vflag > 1)
|
if(vflag > 1)
|
||||||
errprintf("generate %s\n", p);
|
errprintf("generate %s\n", p);
|
||||||
|
@ -1247,6 +1258,7 @@ static char *buildorder[] = {
|
||||||
"lib9",
|
"lib9",
|
||||||
"libbio",
|
"libbio",
|
||||||
"libmach",
|
"libmach",
|
||||||
|
"liblink",
|
||||||
|
|
||||||
"misc/pprof",
|
"misc/pprof",
|
||||||
|
|
||||||
|
@ -1338,6 +1350,7 @@ static char *cleantab[] = {
|
||||||
"lib9",
|
"lib9",
|
||||||
"libbio",
|
"libbio",
|
||||||
"libmach",
|
"libmach",
|
||||||
|
"liblink",
|
||||||
"pkg/bufio",
|
"pkg/bufio",
|
||||||
"pkg/bytes",
|
"pkg/bytes",
|
||||||
"pkg/container/heap",
|
"pkg/container/heap",
|
||||||
|
|
10
src/cmd/dist/buildgc.c
vendored
10
src/cmd/dist/buildgc.c
vendored
|
@ -63,10 +63,10 @@ gcopnames(char *dir, char *file)
|
||||||
vfree(&fields);
|
vfree(&fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mkenam reads [568].out.h and writes enam.c
|
// mkanames reads [568].out.h and writes anames[568].c
|
||||||
// The format is much the same as the Go opcodes above.
|
// The format is much the same as the Go opcodes above.
|
||||||
void
|
void
|
||||||
mkenam(char *dir, char *file)
|
mkanames(char *dir, char *file)
|
||||||
{
|
{
|
||||||
int i, ch;
|
int i, ch;
|
||||||
Buf in, b, out;
|
Buf in, b, out;
|
||||||
|
@ -78,11 +78,11 @@ mkenam(char *dir, char *file)
|
||||||
binit(&out);
|
binit(&out);
|
||||||
vinit(&lines);
|
vinit(&lines);
|
||||||
|
|
||||||
ch = dir[xstrlen(dir)-2];
|
ch = file[xstrlen(file)-3];
|
||||||
bprintf(&b, "%s/../%cl/%c.out.h", dir, ch, ch);
|
bprintf(&b, "%s/../cmd/%cl/%c.out.h", dir, ch, ch);
|
||||||
readfile(&in, bstr(&b));
|
readfile(&in, bstr(&b));
|
||||||
splitlines(&lines, bstr(&in));
|
splitlines(&lines, bstr(&in));
|
||||||
bwritestr(&out, "char* anames[] = {\n");
|
bprintf(&out, "char* anames%c[] = {\n", ch);
|
||||||
for(i=0; i<lines.len; i++) {
|
for(i=0; i<lines.len; i++) {
|
||||||
if(hasprefix(lines.p[i], "\tA")) {
|
if(hasprefix(lines.p[i], "\tA")) {
|
||||||
p = xstrstr(lines.p[i], ",");
|
p = xstrstr(lines.p[i], ",");
|
||||||
|
|
Loading…
Reference in a new issue