This CL removes the remaining visible uses of the "architecture letter" concept.
(They are no longer in tool names nor in source directory names.)
Because the architecture letter concept is now gone, delete GOCHAR
from "go env" output, and change go/build.ArchChar to return an
error always.
The architecture letter is still used in the compiler and linker sources
as a clumsy architecture enumeration, but that use is not visible to
Go users and can be cleaned up separately.
Change-Id: I4d97a38f372003fb610c9c5241bea440d9dbeb8d
Reviewed-on: https://go-review.googlesource.com/10289
Reviewed-by: Rob Pike <r@golang.org>
 Overall:
 - toolchain in Go
 - new GC
+- go tool asm, go tool compile, go tool link
+- default output files changed: now file.o and a.out
 
 Language:
 - permit omission of key type in map composite literals where key is a composite literal (https://golang.org/cl/2591)
 
        os.Exit(2)
 }
 
-func Parse(theChar int) {
+func Parse() {
        flag.Usage = Usage
        flag.Parse()
        if flag.NArg() != 1 {
                if strings.HasSuffix(input, ".s") {
                        input = input[:len(input)-2]
                }
-               *OutputFile = fmt.Sprintf("%s.%c", input, theChar)
+               *OutputFile = fmt.Sprintf("%s.o", input)
        }
 }
 
                log.Fatalf("asm: unrecognized architecture %s", GOARCH)
        }
 
-       flags.Parse(architecture.Thechar)
+       flags.Parse()
 
        // Create object file, write header.
        fd, err := os.Create(*flags.OutputFile)
 
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
-               file = fmt.Sprintf("%s.%c", name, Thearch.Thechar)
+               file = fmt.Sprintf("%s.o", name)
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
-               file = fmt.Sprintf("%s/%s.%c", p.dir, name, Thearch.Thechar)
+               file = fmt.Sprintf("%s/%s.o", p.dir, name)
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
-               file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.%c", goroot, goos, goarch, suffixsep, suffix, name, Thearch.Thechar)
+               file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.o", goroot, goos, goarch, suffixsep, suffix, name)
                if obj.Access(file, 0) >= 0 {
                        return file, true
                }
 
 func fakeimport() {
        importpkg = mkpkg("fake")
-       cannedimports("fake.6", "$$\n")
+       cannedimports("fake.o", "$$\n")
 }
 
 func importfile(f *Val, line int) {
                }
 
                importpkg = mkpkg(f.U.(string))
-               cannedimports("unsafe.6", unsafeimport)
+               cannedimports("unsafe.o", unsafeimport)
                imported_unsafe = 1
                return
        }
                if i := strings.LastIndex(p, "."); i >= 0 {
                        p = p[:i]
                }
-               outfile = fmt.Sprintf("%s.%c", p, Thearch.Thechar)
+               outfile = fmt.Sprintf("%s.o", p)
        }
 }
 
 import (
        "bufio"
        "fmt"
-       "go/build"
        "io"
        "log"
        "os"
        "os/exec"
-       "runtime"
        "strings"
 )
 
 func main() {
-       gochar, err := build.ArchChar(runtime.GOARCH)
-       if err != nil {
-               log.Fatal(err)
-       }
-
        f, err := os.Create("builtin.go")
        if err != nil {
                log.Fatal(err)
        fmt.Fprintln(w, "package gc")
 
        for _, name := range os.Args[1:] {
-               mkbuiltin(w, gochar, name)
+               mkbuiltin(w, name)
        }
 
        if err := w.Flush(); err != nil {
 }
 
 // Compile .go file, import data from .6 file, and write Go string version.
-func mkbuiltin(w io.Writer, gochar string, name string) {
-       if err := exec.Command("go", "tool", gochar+"g", "-A", "builtin/"+name+".go").Run(); err != nil {
+func mkbuiltin(w io.Writer, name string) {
+       if err := exec.Command("go", "tool", "compile", "-A", "builtin/"+name+".go").Run(); err != nil {
                log.Fatal(err)
        }
-       obj := fmt.Sprintf("%s.%s", name, gochar)
+       obj := "name.o"
        defer os.Remove(obj)
 
        r, err := os.Open(obj)
        fmt.Fprintf(w, "\nconst %simport = \"\" +\n", name)
 
        // sys.go claims to be in package PACKAGE to avoid
-       // conflicts during "6g sys.go".  Rename PACKAGE to $2.
+       // conflicts during "go tool compile sys.go".  Rename PACKAGE to $2.
        replacer := strings.NewReplacer("PACKAGE", name)
 
        // Process imports, stopping at $$ that closes them.
 
                        obj.Bputc(bout, 0)
                }
                obj.Bseek(bout, startobj-ArhdrSize, 0)
-               name := fmt.Sprintf("_go_.%c", Thearch.Thechar)
-               formathdr(arhdr[:], name, size)
+               formathdr(arhdr[:], "_go_.o", size)
                bout.Write(arhdr[:])
        }
 
 
        goarch           string
        gobin            string
        gohostarch       string
-       gohostchar       string
        gohostos         string
        goos             string
        goarm            string
        goextlinkenabled string
        workdir          string
        tooldir          string
-       gochar           string
        oldgoos          string
        oldgoarch        string
-       oldgochar        string
        slash            string
        exe              string
        defaultcc        string
        vflag int  // verbosity
 )
 
-// The known architecture letters.
-var gochars = "5667899"
-
 // The known architectures.
 var okgoarch = []string{
-       // same order as gochars
-       "arm",
+       "386",
        "amd64",
        "amd64p32",
+       "arm",
        "arm64",
-       "386",
        "ppc64",
        "ppc64le",
 }
                gohostarch = b
        }
 
-       i := find(gohostarch, okgoarch)
-       if i < 0 {
+       if find(gohostarch, okgoarch) < 0 {
                fatal("unknown $GOHOSTARCH %s", gohostarch)
        }
-       gohostchar = gochars[i : i+1]
 
        b = os.Getenv("GOARCH")
        if b == "" {
                b = gohostarch
        }
        goarch = b
-       i = find(goarch, okgoarch)
-       if i < 0 {
+       if find(goarch, okgoarch) < 0 {
                fatal("unknown $GOARCH %s", goarch)
        }
-       gochar = gochars[i : i+1]
 
        b = os.Getenv("GO_EXTLINK_ENABLED")
        if b != "" {
        }
 
        // If $GOBIN is set and has a Go compiler, it must be cleaned.
-       for _, char := range gochars {
+       for _, char := range "56789" {
                if isfile(pathf("%s%s%c%s", gobin, slash, char, "g")) {
                        for _, old := range oldtool {
                                xremove(pathf("%s/%s", gobin, old))
                b := pathf("%s/%s", workdir, filepath.Base(p))
 
                // Change the last character of the output file (which was c or s).
-               if gohostos == "plan9" {
-                       b = b[:len(b)-1] + gohostchar
-               } else {
-                       b = b[:len(b)-1] + "o"
-               }
+               b = b[:len(b)-1] + "o"
                compile = append(compile, "-o", b, p)
                bgrun(path, compile...)
 
        xprintf(format, "GOHOSTARCH", gohostarch)
        xprintf(format, "GOHOSTOS", gohostos)
        xprintf(format, "GOTOOLDIR", tooldir)
-       xprintf(format, "GOCHAR", gochar)
        if goarch == "arm" {
                xprintf(format, "GOARM", goarm)
        }
        // For the main bootstrap, building for host os/arch.
        oldgoos = goos
        oldgoarch = goarch
-       oldgochar = gochar
        goos = gohostos
        goarch = gohostarch
-       gochar = gohostchar
        os.Setenv("GOHOSTARCH", gohostarch)
        os.Setenv("GOHOSTOS", gohostos)
        os.Setenv("GOARCH", goarch)
        // than in a standard release like Go 1.4, so don't do this rebuild by default.
        if false {
                xprintf("##### Building Go toolchain using itself.\n")
-               for _, pattern := range buildorder {
-                       if pattern == "cmd/go" {
+               for _, dir := range buildorder {
+                       if dir == "cmd/go" {
                                break
                        }
-                       dir := pattern
-                       if strings.Contains(pattern, "%s") {
-                               dir = fmt.Sprintf(pattern, gohostchar)
-                       }
                        install(dir)
-                       if oldgochar != gohostchar && strings.Contains(pattern, "%s") {
-                               install(fmt.Sprintf(pattern, oldgochar))
-                       }
                }
                xprintf("\n")
        }
 
        xprintf("##### Building compilers and go_bootstrap for host, %s/%s.\n", gohostos, gohostarch)
-       for _, pattern := range buildorder {
-               dir := pattern
-               if strings.Contains(pattern, "%s") {
-                       dir = fmt.Sprintf(pattern, gohostchar)
-               }
+       for _, dir := range buildorder {
                install(dir)
-               if oldgochar != gohostchar && strings.Contains(pattern, "%s") {
-                       install(fmt.Sprintf(pattern, oldgochar))
-               }
        }
 
        goos = oldgoos
        goarch = oldgoarch
-       gochar = oldgochar
        os.Setenv("GOARCH", goarch)
        os.Setenv("GOOS", goos)
 
 
        goarch    string
        goos      string
        exeSuffix string
-
-       archCharVal string
-       archCharErr error
 )
 
 func init() {
        if goos == "windows" {
                exeSuffix = ".exe"
        }
-       archCharVal, archCharErr = build.ArchChar(goarch)
-}
-
-// archChar returns the architecture character.  This is only needed
-// for the gc toolchain, so only fail if we actually need it.
-func archChar() string {
-       if archCharErr != nil {
-               fatalf("%s", archCharErr)
-       }
-       return archCharVal
 }
 
 // A builder holds global state about a build.
                fmt.Fprintf(os.Stderr, "%s\n", a.p.ImportPath)
        }
 
-       if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" && archChar() != "" &&
+       if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" &&
                (!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())
                }
        }
 
-       var objExt string
-       if _, ok := buildToolchain.(gccgoToolchain); ok {
-               objExt = "o"
-       } else {
-               objExt = archChar()
-       }
-
        for _, file := range cfiles {
-               out := file[:len(file)-len(".c")] + "." + objExt
+               out := file[:len(file)-len(".c")] + ".o"
                if err := buildToolchain.cc(b, a.p, obj, obj+out, file); err != nil {
                        return err
                }
 
        // Assemble .s files.
        for _, file := range sfiles {
-               out := file[:len(file)-len(".s")] + "." + objExt
+               out := file[:len(file)-len(".s")] + ".o"
                if err := buildToolchain.asm(b, a.p, obj, obj+out, file); err != nil {
                        return err
                }
        if archive != "" {
                ofile = archive
        } else {
-               out := "_go_." + archChar()
+               out := "_go_.o"
                ofile = obj + out
        }
 
        }
        // Disable checks when additional flags are passed, as the old assemblers
        // don't implement some of them (e.g., -shared).
-       if verifyAsm && goarch != "arm64" && len(buildAsmflags) == 0 {
-               if err := toolVerify(b, p, "old"+archChar()+"a", ofile, args); err != nil {
-                       return err
+       if verifyAsm && len(buildAsmflags) == 0 {
+               old := ""
+               switch goarch {
+               case "arm":
+                       old = "old5a"
+               case "amd64", "amd64p32":
+                       old = "old6a"
+               case "386":
+                       old = "old8a"
+               case "ppc64", "ppc64le":
+                       old = "old9a"
+               }
+               if old != "" {
+                       if err := toolVerify(b, p, old, ofile, args); err != nil {
+                               return err
+                       }
                }
        }
        return nil
        cgoflags := []string{}
        // TODO: make cgo not depend on $GOARCH?
 
-       var objExt string
-       if _, ok := buildToolchain.(gccgoToolchain); ok {
-               objExt = "o"
-       } else {
-               objExt = archChar()
-       }
-
        if p.Standard && p.ImportPath == "runtime/cgo" {
                cgoflags = append(cgoflags, "-import_runtime_cgo=false")
        }
        // cc _cgo_defun.c
        _, gccgo := buildToolchain.(gccgoToolchain)
        if gccgo {
-               defunObj := obj + "_cgo_defun." + objExt
+               defunObj := obj + "_cgo_defun.o"
                if err := buildToolchain.cc(b, p, obj, defunObj, defunC); err != nil {
                        return nil, nil, err
                }
 
                {"TERM", "dumb"},
        }
 
-       if archCharErr == nil {
-               env = append(env, envVar{"GOCHAR", archChar()})
-       }
-
        if goos != "plan9" {
                cmd := b.gccCmd(".")
                env = append(env, envVar{"CC", cmd[0]})
 
 }
 
 func usage() {
-       fmt.Fprintf(os.Stderr, "usage: %cl [options] obj.%c\n", Thearch.Thechar, Thearch.Thechar)
+       fmt.Fprintf(os.Stderr, "usage: link [options] main.o\n")
        obj.Flagprint(2)
        Exit(2)
 }
 
        }
 
        if outfile == "" {
+               outfile = "a.out"
                if HEADTYPE == obj.Hwindows {
-                       outfile = fmt.Sprintf("%c.out.exe", Thearch.Thechar)
-               } else {
-                       outfile = fmt.Sprintf("%c.out", Thearch.Thechar)
+                       outfile += ".exe"
                }
        }
 
 
        "os"
        "os/exec"
        "path/filepath"
-       "regexp"
        "runtime"
        "testing"
        "time"
                t.Fatal(err)
        }
 
-       char := findChar(t, dir)
-
        run := func(args ...string) string {
                return doRun(t, dir, args...)
        }
 
        run("go", "build", "cmd/pack") // writes pack binary to dir
        run("go", "tool", "compile", "hello.go")
-       run("./pack", "grc", "hello.a", "hello."+char)
+       run("./pack", "grc", "hello.a", "hello.o")
        run("go", "tool", "link", "-o", "a.out", "hello.a")
        out := run("./a.out")
        if out != "hello world\n" {
                t.Fatal(err)
        }
 
-       char := findChar(t, dir)
-
        run := func(args ...string) string {
                return doRun(t, dir, args...)
        }
 
        run("go", "build", "cmd/pack") // writes pack binary to dir
        run("go", "tool", "compile", "large.go")
-       run("./pack", "grc", "large.a", "large."+char)
+       run("./pack", "grc", "large.a", "large.o")
        run("go", "tool", "compile", "-I", ".", "main.go")
-       run("go", "tool", "link", "-L", ".", "-o", "a.out", "main."+char)
+       run("go", "tool", "link", "-L", ".", "-o", "a.out", "main.o")
        out := run("./a.out")
        if out != "ok\n" {
                t.Fatalf("incorrect output: %q, want %q", out, "ok\n")
        return string(out)
 }
 
-// findChar returns the architecture character for the go command.
-func findChar(t *testing.T, dir string) string {
-       out := doRun(t, dir, "go", "env")
-       re, err := regexp.Compile(`\s*GOCHAR=['"]?(\w)['"]?`)
-       if err != nil {
-               t.Fatal(err)
-       }
-       fields := re.FindStringSubmatch(out)
-       if fields == nil {
-               t.Fatal("cannot find GOCHAR in 'go env' output:\n", out)
-       }
-       return fields[1]
-}
-
 // Fake implementation of files.
 
 var helloFile = &FakeFile{
 
                strings.HasPrefix(path, "./") || strings.HasPrefix(path, "../")
 }
 
-// ArchChar returns the architecture character for the given goarch.
-// For example, ArchChar("amd64") returns "6".
+// ArchChar returns "?" and an error.
+// In earlier versions of Go, the returned string was used to derive
+// the compiler and linker tool names, the default object file suffix,
+// and the default linker output name. As of Go 1.5, those strings
+// no longer vary by architecture; they are compile, link, .o, and a.out, respectively.
 func ArchChar(goarch string) (string, error) {
-       switch goarch {
-       case "386":
-               return "8", nil
-       case "amd64", "amd64p32":
-               return "6", nil
-       case "arm":
-               return "5", nil
-       case "arm64":
-               return "7", nil
-       case "ppc64", "ppc64le":
-               return "9", nil
-       }
-       return "", errors.New("unsupported GOARCH " + goarch)
+       return "", errors.New("architecture letter no longer used")
 }
 
 // debugging/development support
 const debug = false
 
-var pkgExts = [...]string{".a", ".5", ".6", ".7", ".8", ".9"}
+var pkgExts = [...]string{".a", ".o"}
 
 // FindPkg returns the filename and unique package id for an import
 // path based on package information provided by build.Import (using
 
                t.Logf("%s", out)
                t.Fatalf("%s %s failed: %s", gcPath, filename, err)
        }
-       archCh, _ := build.ArchChar(runtime.GOARCH)
        // filename should end with ".go"
-       return filepath.Join(dirname, filename[:len(filename)-2]+archCh)
+       return filepath.Join(dirname, filename[:len(filename)-2]+"o")
 }
 
 // Use the same global imports map for all tests. The effect is
 
 set -e
 
 eval $(go tool dist env)
-O=$GOCHAR
 GC="go tool compile"
 LD="go tool link"
 
 esac
 
 gc() {
-       $GC $1.go; $LD -o $O.$EXE $1.$O
+       $GC $1.go; $LD -o a.$EXE $1.o
 }
 
 gc_B() {
-       $GC -B $1.go; $LD -o $O.$EXE $1.$O
+       $GC -B $1.go; $LD -o a.$EXE $1.o
 }
 
 runonly() {
        runonly echo 'fasta -n 25000000'
        run "gcc $gccm -O2 fasta.c" a.$EXE 25000000
        run 'gccgo -O2 fasta.go' a.$EXE -n 25000000     #commented out until WriteString is in bufio
-       run 'gc fasta' $O.$EXE -n 25000000
-       run 'gc_B fasta' $O.$EXE -n 25000000
+       run 'gc fasta' a.$EXE -n 25000000
+       run 'gc_B fasta' a.$EXE -n 25000000
 }
 
 revcomp() {
        runonly echo 'reverse-complement < output-of-fasta-25000000'
        run "gcc $gccm -O2 reverse-complement.c" a.$EXE < x
        run 'gccgo -O2 reverse-complement.go' a.$EXE < x
-       run 'gc reverse-complement' $O.$EXE < x
-       run 'gc_B reverse-complement' $O.$EXE < x
+       run 'gc reverse-complement' a.$EXE < x
+       run 'gc_B reverse-complement' a.$EXE < x
        rm x
 }
 
        runonly echo 'nbody -n 50000000'
        run "gcc $gccm -O2 nbody.c -lm" a.$EXE 50000000
        run 'gccgo -O2 nbody.go' a.$EXE -n 50000000
-       run 'gc nbody' $O.$EXE -n 50000000
-       run 'gc_B nbody' $O.$EXE -n 50000000
+       run 'gc nbody' a.$EXE -n 50000000
+       run 'gc_B nbody' a.$EXE -n 50000000
 }
 
 binarytree() {
        run "gcc $gccm -O2 binary-tree.c -lm" a.$EXE 15
        run 'gccgo -O2 binary-tree.go' a.$EXE -n 15
        run 'gccgo -O2 binary-tree-freelist.go' a.$EXE -n 15
-       run 'gc binary-tree' $O.$EXE -n 15
-       run 'gc binary-tree-freelist' $O.$EXE -n 15
+       run 'gc binary-tree' a.$EXE -n 15
+       run 'gc binary-tree-freelist' a.$EXE -n 15
 }
 
 fannkuch() {
        run "gcc $gccm -O2 fannkuch.c" a.$EXE 12
        run 'gccgo -O2 fannkuch.go' a.$EXE -n 12
        run 'gccgo -O2 fannkuch-parallel.go' a.$EXE -n 12
-       run 'gc fannkuch' $O.$EXE -n 12
-       run 'gc fannkuch-parallel' $O.$EXE -n 12
-       run 'gc_B fannkuch' $O.$EXE -n 12
+       run 'gc fannkuch' a.$EXE -n 12
+       run 'gc fannkuch-parallel' a.$EXE -n 12
+       run 'gc_B fannkuch' a.$EXE -n 12
 }
 
 regexdna() {
        fi
        run 'gccgo -O2 regex-dna.go' a.$EXE <x
        run 'gccgo -O2 regex-dna-parallel.go' a.$EXE <x
-       run 'gc regex-dna' $O.$EXE <x
-       run 'gc regex-dna-parallel' $O.$EXE <x
-       run 'gc_B regex-dna' $O.$EXE <x
+       run 'gc regex-dna' a.$EXE <x
+       run 'gc regex-dna-parallel' a.$EXE <x
+       run 'gc_B regex-dna' a.$EXE <x
        rm x
 }
 
        runonly echo 'spectral-norm 5500'
        run "gcc $gccm -O2 spectral-norm.c -lm" a.$EXE 5500
        run 'gccgo -O2 spectral-norm.go' a.$EXE -n 5500
-       run 'gc spectral-norm' $O.$EXE -n 5500
-       run 'gc_B spectral-norm' $O.$EXE -n 5500
+       run 'gc spectral-norm' a.$EXE -n 5500
+       run 'gc_B spectral-norm' a.$EXE -n 5500
 }
 
 knucleotide() {
        fi
        run 'gccgo -O2 k-nucleotide.go' a.$EXE <x
        run 'gccgo -O2 k-nucleotide-parallel.go' a.$EXE <x
-       run 'gc k-nucleotide' $O.$EXE <x
-       run 'gc k-nucleotide-parallel' $O.$EXE <x
-       run 'gc_B k-nucleotide' $O.$EXE <x
+       run 'gc k-nucleotide' a.$EXE <x
+       run 'gc k-nucleotide-parallel' a.$EXE <x
+       run 'gc_B k-nucleotide' a.$EXE <x
        rm x
 }
 
        runonly echo 'mandelbrot 16000'
        run "gcc $gccm -O2 mandelbrot.c" a.$EXE 16000
        run 'gccgo -O2 mandelbrot.go' a.$EXE -n 16000
-       run 'gc mandelbrot' $O.$EXE -n 16000
-       run 'gc_B mandelbrot' $O.$EXE -n 16000
+       run 'gc mandelbrot' a.$EXE -n 16000
+       run 'gc_B mandelbrot' a.$EXE -n 16000
 }
 
 meteor() {
        runonly echo 'meteor 2098'
        run "gcc $gccm -O2 meteor-contest.c" a.$EXE 2098
        run 'gccgo -O2 meteor-contest.go' a.$EXE -n 2098
-       run 'gc meteor-contest' $O.$EXE -n 2098
-       run 'gc_B  meteor-contest' $O.$EXE -n 2098
+       run 'gc meteor-contest' a.$EXE -n 2098
+       run 'gc_B  meteor-contest' a.$EXE -n 2098
 }
 
 pidigits() {
                run "gcc $gccm -O2 pidigits.c -lgmp" a.$EXE 10000
        fi
        run 'gccgo -O2 pidigits.go' a.$EXE -n 10000
-       run 'gc pidigits' $O.$EXE -n 10000
-       run 'gc_B  pidigits' $O.$EXE -n 10000
+       run 'gc pidigits' a.$EXE -n 10000
+       run 'gc_B  pidigits' a.$EXE -n 10000
 }
 
 threadring() {
        runonly echo 'threadring 50000000'
        run "gcc $gccm -O2 threadring.c -lpthread" a.$EXE 50000000
        run 'gccgo -O2 threadring.go' a.$EXE -n 50000000
-       run 'gc threadring' $O.$EXE -n 50000000
+       run 'gc threadring' a.$EXE -n 50000000
 }
 
 chameneos() {
        runonly echo 'chameneos 6000000'
        run "gcc $gccm -O2 chameneosredux.c -lpthread" a.$EXE 6000000
        run 'gccgo -O2 chameneosredux.go' a.$EXE 6000000
-       run 'gc chameneosredux' $O.$EXE 6000000
+       run 'gc chameneosredux' a.$EXE 6000000
 }
 
 case $# in
 
 
 import (
        "fmt"
-       "go/build"
        "os"
        "os/exec"
        "path/filepath"
 )
 
 func main() {
-       a, err := build.ArchChar(build.Default.GOARCH)
-       check(err)
-
        // TODO: If we get rid of errchk, re-enable this test on Windows.
        errchk, err := filepath.Abs("errchk")
        check(err)
        run("go", "tool", "compile", "bug1.go")
        run("go", "tool", "compile", "bug2.go")
        run(errchk, "go", "tool", "compile", "-e", "bug3.go")
-       run("go", "tool", "link", "bug2."+a)
-       run(fmt.Sprintf(".%c%s.out", filepath.Separator, a))
+       run("go", "tool", "link", "bug2.o")
+       run(fmt.Sprintf(".%ca.out", filepath.Separator))
 
-       os.Remove("bug0." + a)
-       os.Remove("bug1." + a)
-       os.Remove("bug2." + a)
-       os.Remove(a + ".out")
+       os.Remove("bug0.o")
+       os.Remove("bug1.o")
+       os.Remove("bug2.o")
+       os.Remove("a.out")
 }
 
 func run(name string, args ...string) {
 
 
 import (
        "fmt"
-       "go/build"
        "os"
        "os/exec"
        "path/filepath"
-       "runtime"
 )
 
 func main() {
-       a, err := build.ArchChar(runtime.GOARCH)
-       if err != nil {
-               fmt.Println("BUG:", err)
-               os.Exit(1)
-       }
-
        run("go", "tool", "compile", filepath.Join("fixedbugs", "bug302.dir", "p.go"))
-       run("go", "tool", "pack", "grc", "pp.a", "p."+a)
+       run("go", "tool", "pack", "grc", "pp.a", "p.o")
        run("go", "tool", "compile", "-I", ".", filepath.Join("fixedbugs", "bug302.dir", "main.go"))
-       os.Remove("p."+a)
+       os.Remove("p.o")
        os.Remove("pp.a")
-       os.Remove("main."+a)
+       os.Remove("main.o")
 }
 
 func run(cmd string, args ...string) {
 
 
 import (
        "fmt"
-       "go/build"
        "os"
        "os/exec"
        "path/filepath"
 )
 
 func main() {
-       a, err := build.ArchChar(build.Default.GOARCH)
-       check(err)
-
        // TODO: If we get rid of errchk, re-enable this test on Plan 9 and Windows.
        errchk, err := filepath.Abs("errchk")
        check(err)
 
        run("go", "tool", "compile", "io.go")
        run(errchk, "go", "tool", "compile", "-e", "main.go")
-       os.Remove("io." + a)
+       os.Remove("io.o")
 }
 
 func run(name string, args ...string) {
 
 
 import (
        "fmt"
-       "go/build"
        "os"
        "os/exec"
        "path/filepath"
 )
 
 func main() {
-       a, err := build.ArchChar(build.Default.GOARCH)
+       err := os.Chdir(filepath.Join(".", "fixedbugs", "bug369.dir"))
        check(err)
 
-       err = os.Chdir(filepath.Join(".", "fixedbugs", "bug369.dir"))
-       check(err)
-
-       run("go", "tool", "compile", "-N", "-o", "slow."+a, "pkg.go")
-       run("go", "tool", "compile", "-o", "fast."+a, "pkg.go")
-       run("go", "tool", "compile", "-o", "main."+a, "main.go")
-       run("go", "tool", "link", "-o", "a.exe", "main."+a)
+       run("go", "tool", "compile", "-N", "-o", "slow.o", "pkg.go")
+       run("go", "tool", "compile", "-o", "fast.o", "pkg.go")
+       run("go", "tool", "compile", "-o", "main.o", "main.go")
+       run("go", "tool", "link", "-o", "a.exe", "main.o")
        run("." + string(filepath.Separator) + "a.exe")
 
-       os.Remove("slow." + a)
-       os.Remove("fast." + a)
-       os.Remove("main." + a)
+       os.Remove("slow.o")
+       os.Remove("fast.o")
+       os.Remove("main.o")
        os.Remove("a.exe")
 }
 
 
 
 import (
        "fmt"
-       "go/build"
        "os"
        "os/exec"
        "path/filepath"
        if runtime.Compiler != "gc" || runtime.GOOS == "nacl" {
                return
        }
-       a, err := build.ArchChar(runtime.GOARCH)
-       check(err)
 
-       err = os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
+       err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
        check(err)
 
        out := run("go", "tool", "compile", "-S", "a.go")
-       os.Remove("a." + a)
+       os.Remove("a.o")
 
        // 6g/8g print the offset as dec, but 5g/9g print the offset as hex.
        patterns := []string{
 
        "errors"
        "flag"
        "fmt"
-       "go/build"
        "io/ioutil"
        "log"
        "os"
 )
 
 var (
-       // letter is the build.ArchChar
-       letter string
-
        goos, goarch string
 
        // dirs are the directories to look for *.go files in.
 
        ratec = make(chan bool, *numParallel)
        rungatec = make(chan bool, *runoutputLimit)
-       var err error
-       letter, err = build.ArchChar(build.Default.GOARCH)
-       check(err)
 
        var tests []*test
        if flag.NArg() > 0 {
 }
 
 func linkFile(runcmd runCmd, goname string) (err error) {
-       pfile := strings.Replace(goname, ".go", "."+letter, -1)
+       pfile := strings.Replace(goname, ".go", ".o", -1)
        _, err = runcmd("go", "tool", "link", "-w", "-o", "a.exe", "-L", ".", pfile)
        return
 }
                t.err = fmt.Errorf("unimplemented action %q", action)
 
        case "errorcheck":
-               cmdline := []string{"go", "tool", "compile", "-e", "-o", "a." + letter}
+               cmdline := []string{"go", "tool", "compile", "-e", "-o", "a.o"}
                cmdline = append(cmdline, flags...)
                cmdline = append(cmdline, long)
                out, err := runcmd(cmdline...)
                        t.err = fmt.Errorf("write tempfile:%s", err)
                        return
                }
-               cmdline := []string{"go", "tool", "compile", "-e", "-o", "a." + letter}
+               cmdline := []string{"go", "tool", "compile", "-e", "-o", "a.o"}
                cmdline = append(cmdline, flags...)
                cmdline = append(cmdline, tfile)
                out, err = runcmd(cmdline...)
 
 import (
        "bytes"
        "fmt"
-       "go/build"
        "os"
        "os/exec"
 )
 
 func main() {
-       letter, err := build.ArchChar(build.Default.GOARCH)
-       if err != nil {
-               fmt.Println(err)
-               os.Exit(1)
-       }
-
        cmd := exec.Command("go", "tool", "compile", "-S", "sinit.go")
        out, err := cmd.CombinedOutput()
        if err != nil {
                fmt.Println(err)
                os.Exit(1)
        }
-       os.Remove("sinit." + letter)
+       os.Remove("sinit.o")
 
        if bytes.Contains(out, []byte("initdone")) {
                fmt.Println("sinit generated an init function")