diff options
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/9a/doc.go | 4 | ||||
-rw-r--r-- | src/cmd/9a/lex.c | 8 | ||||
-rw-r--r-- | src/cmd/9g/doc.go | 6 | ||||
-rw-r--r-- | src/cmd/9g/galign.c | 8 | ||||
-rw-r--r-- | src/cmd/9g/ggen.c | 6 | ||||
-rw-r--r-- | src/cmd/9g/peep.c | 4 | ||||
-rw-r--r-- | src/cmd/9l/asm.c | 2 | ||||
-rw-r--r-- | src/cmd/9l/doc.go | 6 | ||||
-rw-r--r-- | src/cmd/9l/obj.c | 10 | ||||
-rw-r--r-- | src/cmd/api/goapi.go | 153 | ||||
-rw-r--r-- | src/cmd/cgo/main.go | 24 | ||||
-rw-r--r-- | src/cmd/dist/build.c | 23 | ||||
-rw-r--r-- | src/cmd/dist/buildruntime.c | 41 | ||||
-rw-r--r-- | src/cmd/dist/unix.c | 4 | ||||
-rw-r--r-- | src/cmd/gc/popt.c | 4 | ||||
-rw-r--r-- | src/cmd/go/build.go | 3 | ||||
-rw-r--r-- | src/cmd/internal/objfile/disasm.go | 10 | ||||
-rw-r--r-- | src/cmd/internal/objfile/elf.go | 2 | ||||
-rw-r--r-- | src/cmd/internal/objfile/macho.go | 2 | ||||
-rw-r--r-- | src/cmd/ld/ldelf.c | 4 | ||||
-rw-r--r-- | src/cmd/objdump/objdump_test.go | 4 |
21 files changed, 67 insertions, 261 deletions
diff --git a/src/cmd/9a/doc.go b/src/cmd/9a/doc.go index 44bf89dc0..f6eed6d86 100644 --- a/src/cmd/9a/doc.go +++ b/src/cmd/9a/doc.go @@ -14,8 +14,8 @@ Go-specific considerations are documented at http://golang.org/doc/asm -Its target architecture is the Power64, referred to by these tools as -power64 (big endian) or power64le (little endian). +Its target architecture is 64-bit PowerPC and Power Architecture processors, +referred to by these tools as ppc64 (big endian) or ppc64le (little endian). */ package main diff --git a/src/cmd/9a/lex.c b/src/cmd/9a/lex.c index e2945ef89..c8073b07d 100644 --- a/src/cmd/9a/lex.c +++ b/src/cmd/9a/lex.c @@ -71,7 +71,7 @@ dodef(char *p) Dlist[nDlist++] = p; } -LinkArch* thelinkarch = &linkpower64; +LinkArch* thelinkarch = &linkppc64; void usage(void) @@ -87,15 +87,15 @@ main(int argc, char *argv[]) char *p; thechar = '9'; - thestring = "power64"; + thestring = "ppc64"; // Allow GOARCH=thestring or GOARCH=thestringsuffix, // but not other values. p = getgoarch(); if(strncmp(p, thestring, strlen(thestring)) != 0) sysfatal("cannot use %cc with GOARCH=%s", thechar, p); - if(strcmp(p, "power64le") == 0) - thelinkarch = &linkpower64le; + if(strcmp(p, "ppc64le") == 0) + thelinkarch = &linkppc64le; ctxt = linknew(thelinkarch); ctxt->diag = yyerror; diff --git a/src/cmd/9g/doc.go b/src/cmd/9g/doc.go index 200be2eda..56bb14344 100644 --- a/src/cmd/9g/doc.go +++ b/src/cmd/9g/doc.go @@ -6,9 +6,9 @@ /* -9g is the version of the gc compiler for the Power64. -The $GOARCH for these tools is power64 (big endian) or -power64le (little endian). +9g is the version of the gc compiler for 64-bit PowerPC or Power Architecture processors. +The $GOARCH for these tools is ppc64 (big endian) or +ppc64le (little endian). It reads .go files and outputs .9 files. The flags are documented in ../gc/doc.go. diff --git a/src/cmd/9g/galign.c b/src/cmd/9g/galign.c index 97a5a5d06..67514faa4 100644 --- a/src/cmd/9g/galign.c +++ b/src/cmd/9g/galign.c @@ -7,17 +7,17 @@ #include "gg.h" int thechar = '9'; -char* thestring = "power64"; +char* thestring = "ppc64"; LinkArch* thelinkarch; void linkarchinit(void) { thestring = getgoarch(); - if(strcmp(thestring, "power64le") == 0) - thelinkarch = &linkpower64le; + if(strcmp(thestring, "ppc64le") == 0) + thelinkarch = &linkppc64le; else - thelinkarch = &linkpower64; + thelinkarch = &linkppc64; } vlong MAXWIDTH = 1LL<<50; diff --git a/src/cmd/9g/ggen.c b/src/cmd/9g/ggen.c index 7d9cf5050..f08c263c2 100644 --- a/src/cmd/9g/ggen.c +++ b/src/cmd/9g/ggen.c @@ -212,8 +212,8 @@ ginscall(Node *f, int proc) // However, the stack trace code will show the line // of the instruction byte before the return PC. // To avoid that being an unrelated instruction, - // insert a Power64 NOP that we will have the right line number. - // Power64 NOP is really or r0, r0, r0; use that description + // insert a ppc64 NOP that we will have the right line number. + // The ppc64 NOP is really or r0, r0, r0; use that description // because the NOP pseudo-instruction would be removed by // the linker. nodreg(®, types[TINT], D_R0); @@ -953,7 +953,7 @@ clearfat(Node *nl) f = sysfunc("duffzero"); p = gins(ADUFFZERO, N, f); afunclit(&p->to, f); - // 4 and 128 = magic constants: see ../../runtime/asm_power64x.s + // 4 and 128 = magic constants: see ../../runtime/asm_ppc64x.s p->to.offset = 4*(128-q); // duffzero leaves R3 on the last zeroed dword boff = 8; diff --git a/src/cmd/9g/peep.c b/src/cmd/9g/peep.c index 1f430220e..4e636b148 100644 --- a/src/cmd/9g/peep.c +++ b/src/cmd/9g/peep.c @@ -935,7 +935,7 @@ copyau1(Prog *p, Addr *v) } // copysub replaces v with s in a if f!=0 or indicates it if could if f==0. -// Returns 1 on failure to substitute (it always succeeds on power64). +// Returns 1 on failure to substitute (it always succeeds on ppc64). static int copysub(Addr *a, Addr *v, Addr *s, int f) { @@ -946,7 +946,7 @@ copysub(Addr *a, Addr *v, Addr *s, int f) } // copysub1 replaces v with s in p1->reg if f!=0 or indicates if it could if f==0. -// Returns 1 on failure to substitute (it always succeeds on power64). +// Returns 1 on failure to substitute (it always succeeds on ppc64). static int copysub1(Prog *p1, Addr *v, Addr *s, int f) { diff --git a/src/cmd/9l/asm.c b/src/cmd/9l/asm.c index 65a36285d..f9e2810ad 100644 --- a/src/cmd/9l/asm.c +++ b/src/cmd/9l/asm.c @@ -129,7 +129,7 @@ archreloc(Reloc *r, LSym *s, vlong *val) *val = symaddr(r->sym) + r->add - symaddr(linklookup(ctxt, ".got", 0)); return 0; case R_ADDRPOWER: - // r->add is two power64 instructions holding an immediate 32-bit constant. + // r->add is two ppc64 instructions holding an immediate 32-bit constant. // We want to add r->sym's address to that constant. // The encoding of the immediate x<<16 + y, // where x is the low 16 bits of the first instruction and y is the low 16 diff --git a/src/cmd/9l/doc.go b/src/cmd/9l/doc.go index 9df5dc614..3e3c48018 100644 --- a/src/cmd/9l/doc.go +++ b/src/cmd/9l/doc.go @@ -6,9 +6,9 @@ /* -9l is the linker for the Power64. -The $GOARCH for these tools is power64 (big endian) or -power64le (little endian). +9l is the linker for 64-bit PowerPC and Power Architecture processors. +The $GOARCH for these tools is ppc64 (big endian) or +ppc64le (little endian). The flags are documented in ../ld/doc.go. diff --git a/src/cmd/9l/obj.c b/src/cmd/9l/obj.c index badb72a1a..dab1ffb31 100644 --- a/src/cmd/9l/obj.c +++ b/src/cmd/9l/obj.c @@ -36,17 +36,17 @@ #include "../ld/dwarf.h" #include <ar.h> -char *thestring = "power64"; +char *thestring = "ppc64"; LinkArch *thelinkarch; void linkarchinit(void) { thestring = getgoarch(); - if(strcmp(thestring, "power64le") == 0) - thelinkarch = &linkpower64le; + if(strcmp(thestring, "ppc64le") == 0) + thelinkarch = &linkppc64le; else - thelinkarch = &linkpower64; + thelinkarch = &linkppc64; } void @@ -79,7 +79,7 @@ archinit(void) if(INITRND == -1) INITRND = 4096; break; - case Hlinux: /* power64 elf */ + case Hlinux: /* ppc64 elf */ debug['d'] = 1; // TODO(minux): dynamic linking is not supported yet. elfinit(); HEADR = ELFRESERVE; diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index e49ba33bb..568aec8c0 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -352,140 +352,16 @@ var parsedFileCache = make(map[string]*ast.File) func (w *Walker) parseFile(dir, file string) (*ast.File, error) { filename := filepath.Join(dir, file) - f, _ := parsedFileCache[filename] - if f != nil { + if f := parsedFileCache[filename]; f != nil { return f, nil } - var err error - - // generate missing context-dependent files. - - if w.context != nil && file == fmt.Sprintf("zgoos_%s.go", w.context.GOOS) { - src := fmt.Sprintf("package runtime; const theGoos = `%s`", w.context.GOOS) - f, err = parser.ParseFile(fset, filename, src, 0) - if err != nil { - log.Fatalf("incorrect generated file: %s", err) - } - } - - if w.context != nil && file == fmt.Sprintf("zgoarch_%s.go", w.context.GOARCH) { - src := fmt.Sprintf("package runtime; const theGoarch = `%s`", w.context.GOARCH) - f, err = parser.ParseFile(fset, filename, src, 0) - if err != nil { - log.Fatalf("incorrect generated file: %s", err) - } - } - if w.context != nil && file == fmt.Sprintf("zruntime_defs_%s_%s.go", w.context.GOOS, w.context.GOARCH) { - // Just enough to keep the api checker happy. Keep sorted. - src := "package runtime; type (" + - " _defer struct{};" + - " _func struct{};" + - " _panic struct{};" + - " _select struct{}; " + - " _type struct{};" + - " alg struct{};" + - " chantype struct{};" + - " context struct{};" + // windows - " eface struct{};" + - " epollevent struct{};" + - " funcval struct{};" + - " g struct{};" + - " gobuf struct{};" + - " hchan struct{};" + - " iface struct{};" + - " interfacetype struct{};" + - " itab struct{};" + - " keventt struct{};" + - " m struct{};" + - " maptype struct{};" + - " mcache struct{};" + - " mspan struct{};" + - " mutex struct{};" + - " note struct{};" + - " p struct{};" + - " parfor struct{};" + - " slice struct{};" + - " slicetype struct{};" + - " stkframe struct{};" + - " sudog struct{};" + - " timespec struct{};" + - " waitq struct{};" + - " wincallbackcontext struct{};" + - "); " + - "const (" + - " cb_max = 2000;" + - " _CacheLineSize = 64;" + - " _Gidle = 1;" + - " _Grunnable = 2;" + - " _Grunning = 3;" + - " _Gsyscall = 4;" + - " _Gwaiting = 5;" + - " _Gdead = 6;" + - " _Genqueue = 7;" + - " _Gcopystack = 8;" + - " _NSIG = 32;" + - " _FlagNoScan = iota;" + - " _FlagNoZero;" + - " _TinySize;" + - " _TinySizeClass;" + - " _MaxSmallSize;" + - " _PageShift;" + - " _PageSize;" + - " _PageMask;" + - " _BitsPerPointer;" + - " _BitsMask;" + - " _PointersPerByte;" + - " _MaxGCMask;" + - " _BitsDead;" + - " _BitsPointer;" + - " _MSpanInUse;" + - " _ConcurrentSweep;" + - " _KindBool;" + - " _KindInt;" + - " _KindInt8;" + - " _KindInt16;" + - " _KindInt32;" + - " _KindInt64;" + - " _KindUint;" + - " _KindUint8;" + - " _KindUint16;" + - " _KindUint32;" + - " _KindUint64;" + - " _KindUintptr;" + - " _KindFloat32;" + - " _KindFloat64;" + - " _KindComplex64;" + - " _KindComplex128;" + - " _KindArray;" + - " _KindChan;" + - " _KindFunc;" + - " _KindInterface;" + - " _KindMap;" + - " _KindPtr;" + - " _KindSlice;" + - " _KindString;" + - " _KindStruct;" + - " _KindUnsafePointer;" + - " _KindDirectIface;" + - " _KindGCProg;" + - " _KindNoPointers;" + - " _KindMask;" + - ")" - f, err = parser.ParseFile(fset, filename, src, 0) - if err != nil { - log.Fatalf("incorrect generated file: %s", err) - } - } - - if f == nil { - f, err = parser.ParseFile(fset, filename, nil, 0) - if err != nil { - return nil, err - } + f, err := parser.ParseFile(fset, filename, nil, 0) + if err != nil { + return nil, err } - parsedFileCache[filename] = f + return f, nil } @@ -592,25 +468,6 @@ func (w *Walker) Import(name string) (pkg *types.Package) { filenames := append(append([]string{}, info.GoFiles...), info.CgoFiles...) - // Certain files only exist when building for the specified context. - // Add them manually. - if name == "runtime" { - n := fmt.Sprintf("zgoos_%s.go", w.context.GOOS) - if !contains(filenames, n) { - filenames = append(filenames, n) - } - - n = fmt.Sprintf("zgoarch_%s.go", w.context.GOARCH) - if !contains(filenames, n) { - filenames = append(filenames, n) - } - - n = fmt.Sprintf("zruntime_defs_%s_%s.go", w.context.GOOS, w.context.GOARCH) - if !contains(filenames, n) { - filenames = append(filenames, n) - } - } - // Parse package files. var files []*ast.File for _, file := range filenames { diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go index 28ded816d..911270383 100644 --- a/src/cmd/cgo/main.go +++ b/src/cmd/cgo/main.go @@ -130,23 +130,19 @@ func usage() { } var ptrSizeMap = map[string]int64{ - "386": 4, - "amd64": 8, - "arm": 4, - "ppc64": 8, - "ppc64le": 8, - "power64": 8, - "power64le": 8, + "386": 4, + "amd64": 8, + "arm": 4, + "ppc64": 8, + "ppc64le": 8, } var intSizeMap = map[string]int64{ - "386": 4, - "amd64": 8, - "arm": 4, - "ppc64": 8, - "ppc64le": 8, - "power64": 8, - "power64le": 8, + "386": 4, + "amd64": 8, + "arm": 4, + "ppc64": 8, + "ppc64le": 8, } var cPrefix string diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c index bfb3d15b8..5feb77612 100644 --- a/src/cmd/dist/build.c +++ b/src/cmd/dist/build.c @@ -48,8 +48,8 @@ static char *okgoarch[] = { "amd64", "amd64p32", "386", - "power64", - "power64le", + "ppc64", + "ppc64le", }; // The known operating systems. @@ -588,9 +588,6 @@ static struct { }}, {"runtime", { "zaexperiment.h", - "zsys_$GOOS_$GOARCH.s", - "zgoarch_$GOARCH.go", - "zgoos_$GOOS.go", "zversion.go", }}, }; @@ -614,7 +611,6 @@ static struct { {"anames8.c", mkanames}, {"anames9.c", mkanames}, {"zdefaultcc.go", mkzdefaultcc}, - {"zsys_", mkzsys}, {"zversion.go", mkzversion}, {"zaexperiment.h", mkzexperiment}, @@ -1391,6 +1387,11 @@ static char *cleantab[] = { "unicode/utf8", }; +static char *runtimegen[] = { + "zaexperiment.h", + "zversion.go", +}; + static void clean(void) { @@ -1417,15 +1418,11 @@ clean(void) xremove(bpathf(&b, "%s/%s", bstr(&path), cleantab[i]+4)); } - // remove src/runtime/z* unconditionally, + // remove src/runtime/zaexperiment.h and // except leave zgoos and zgoarch, now maintained with go generate. - vreset(&dir); bpathf(&path, "%s/src/runtime", goroot); - xreaddir(&dir, bstr(&path)); - for(j=0; j<dir.len; j++) { - if(hasprefix(dir.p[j], "z") && !hasprefix(dir.p[j], "zg")) - xremove(bpathf(&b, "%s/%s", bstr(&path), dir.p[j])); - } + for(j=0; j<nelem(runtimegen); j++) + xremove(bpathf(&b, "%s/%s", bstr(&path), runtimegen[j])); if(rebuildall) { // Remove object tree. diff --git a/src/cmd/dist/buildruntime.c b/src/cmd/dist/buildruntime.c index 38e99e116..add689768 100644 --- a/src/cmd/dist/buildruntime.c +++ b/src/cmd/dist/buildruntime.c @@ -66,44 +66,3 @@ mkzexperiment(char *dir, char *file) bfree(&out); bfree(&exp); } - -#define MAXWINCB 2000 /* maximum number of windows callbacks allowed */ - -// mkzsys writes zsys_$GOOS_$GOARCH.s, -// which contains arch or os specific asm code. -// -void -mkzsys(char *dir, char *file) -{ - int i; - Buf out; - - USED(dir); - - binit(&out); - - bwritestr(&out, "// auto generated by go tool dist\n\n"); - if(streq(goos, "linux")) { - bwritestr(&out, "// +build !android\n\n"); - } - - if(streq(goos, "windows")) { - bwritef(&out, - "// runtime·callbackasm is called by external code to\n" - "// execute Go implemented callback function. It is not\n" - "// called from the start, instead runtime·compilecallback\n" - "// always returns address into runtime·callbackasm offset\n" - "// appropriately so different callbacks start with different\n" - "// CALL instruction in runtime·callbackasm. This determines\n" - "// which Go callback function is executed later on.\n" - "TEXT runtime·callbackasm(SB),7,$0\n"); - for(i=0; i<MAXWINCB; i++) { - bwritef(&out, "\tCALL\truntime·callbackasm1(SB)\n"); - } - bwritef(&out, "\tRET\n"); - } - - writefile(&out, file, 0); - - bfree(&out); -} diff --git a/src/cmd/dist/unix.c b/src/cmd/dist/unix.c index 893ed5cdd..0fd17c150 100644 --- a/src/cmd/dist/unix.c +++ b/src/cmd/dist/unix.c @@ -709,9 +709,9 @@ main(int argc, char **argv) else if(contains(u.machine, "arm")) gohostarch = "arm"; else if(contains(u.machine, "ppc64le")) - gohostarch = "power64le"; + gohostarch = "ppc64le"; else if(contains(u.machine, "ppc64")) - gohostarch = "power64"; + gohostarch = "ppc64"; else fatal("unknown architecture: %s", u.machine); } diff --git a/src/cmd/gc/popt.c b/src/cmd/gc/popt.c index 6e6db88ef..993bb2482 100644 --- a/src/cmd/gc/popt.c +++ b/src/cmd/gc/popt.c @@ -847,10 +847,6 @@ nilopt(Prog *firstp) Graph *g; int ncheck, nkill; - // TODO(minux): nilopt on power64 throw away seemly random segment of code. - if(thechar == '9') - return; - g = flowstart(firstp, sizeof(NilFlow)); if(g == nil) return; diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 5dcaa04a1..58fc98d84 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -813,7 +813,8 @@ func (b *builder) build(a *action) (err error) { } if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" && - !hasString(a.p.SFiles, "zsys_"+buildContext.GOOS+"_"+buildContext.GOARCH+".s") { + (!hasString(a.p.GoFiles, "zgoos_"+buildContext.GOOS+".go") || + !hasString(a.p.GoFiles, "zgoarch_"+buildContext.GOARCH+".go")) { return fmt.Errorf("%s/%s must be bootstrapped using make%v", buildContext.GOOS, buildContext.GOARCH, defaultSuffix()) } diff --git a/src/cmd/internal/objfile/disasm.go b/src/cmd/internal/objfile/disasm.go index 1a339c321..9838ce285 100644 --- a/src/cmd/internal/objfile/disasm.go +++ b/src/cmd/internal/objfile/disasm.go @@ -240,9 +240,9 @@ var disasms = map[string]disasmFunc{ } var byteOrders = map[string]binary.ByteOrder{ - "386": binary.LittleEndian, - "amd64": binary.LittleEndian, - "arm": binary.LittleEndian, - "power64": binary.BigEndian, - "power64le": binary.LittleEndian, + "386": binary.LittleEndian, + "amd64": binary.LittleEndian, + "arm": binary.LittleEndian, + "ppc64": binary.BigEndian, + "ppc64le": binary.LittleEndian, } diff --git a/src/cmd/internal/objfile/elf.go b/src/cmd/internal/objfile/elf.go index 17755b84d..305706d43 100644 --- a/src/cmd/internal/objfile/elf.go +++ b/src/cmd/internal/objfile/elf.go @@ -98,7 +98,7 @@ func (f *elfFile) goarch() string { case elf.EM_ARM: return "arm" case elf.EM_PPC64: - return "power64" + return "ppc64" } return "" } diff --git a/src/cmd/internal/objfile/macho.go b/src/cmd/internal/objfile/macho.go index 7dd84a339..a6cd02b93 100644 --- a/src/cmd/internal/objfile/macho.go +++ b/src/cmd/internal/objfile/macho.go @@ -104,7 +104,7 @@ func (f *machoFile) goarch() string { case macho.CpuArm: return "arm" case macho.CpuPpc64: - return "power64" + return "ppc64" } return "" } diff --git a/src/cmd/ld/ldelf.c b/src/cmd/ld/ldelf.c index ec8e7c4ea..243c8d807 100644 --- a/src/cmd/ld/ldelf.c +++ b/src/cmd/ld/ldelf.c @@ -62,7 +62,7 @@ enum ElfMachSparc32Plus, /* SPARC V8+ */ ElfMach960, /* Intel 80960 */ ElfMachPower, /* PowerPC */ - ElfMachPower64, /* PowerPC 64 */ + ElfMachPower64, /* PowerPC 64-bit */ ElfMachS390, /* IBM System/390 */ ElfMachV800 = 36, /* NEC V800 */ ElfMachFr20, /* Fujitsu FR20 */ @@ -438,7 +438,7 @@ ldelf(Biobuf *f, char *pkg, int64 len, char *pn) break; case '9': if(obj->machine != ElfMachPower64 || hdr->ident[4] != ElfClass64) { - diag("%s: elf object but not power64", pn); + diag("%s: elf object but not ppc64", pn); return; } break; diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go index bd09ae9f9..513efbf96 100644 --- a/src/cmd/objdump/objdump_test.go +++ b/src/cmd/objdump/objdump_test.go @@ -102,7 +102,7 @@ func testDisasm(t *testing.T, flags ...string) { func TestDisasm(t *testing.T) { switch runtime.GOARCH { - case "power64", "power64le": + case "ppc64", "ppc64le": t.Skipf("skipping on %s, issue 9039", runtime.GOARCH) } testDisasm(t) @@ -114,7 +114,7 @@ func TestDisasmExtld(t *testing.T) { t.Skipf("skipping on %s", runtime.GOOS) } switch runtime.GOARCH { - case "power64", "power64le": + case "ppc64", "ppc64le": t.Skipf("skipping on %s, no support for external linking, issue 9038", runtime.GOARCH) } testDisasm(t, "-ldflags=-linkmode=external") |