internal/buildcfg: move build configuration out of cmd/internal/objabi

The go/build package needs access to this configuration,
so move it into a new package available to the standard library.

Change-Id: I868a94148b52350c76116451f4ad9191246adcff
Reviewed-on: https://go-review.googlesource.com/c/go/+/310731
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
Russ Cox 2021-04-15 23:05:49 -04:00
parent 2fc0ebb623
commit 95ed5c3800
94 changed files with 674 additions and 549 deletions

View file

@ -8,6 +8,7 @@ import (
"bytes"
"cmd/internal/objabi"
"fmt"
"internal/buildcfg"
"io"
"strings"
)
@ -83,7 +84,7 @@ func CConv(s uint8) string {
}
for i := range opSuffixSpace {
sset := &opSuffixSpace[i]
if sset.arch == objabi.GOARCH {
if sset.arch == buildcfg.GOARCH {
return sset.cconv(s)
}
}
@ -330,7 +331,7 @@ func writeDconv(w io.Writer, p *Prog, a *Addr, abiDetail bool) {
case TYPE_SHIFT:
v := int(a.Offset)
ops := "<<>>->@>"
switch objabi.GOARCH {
switch buildcfg.GOARCH {
case "arm":
op := ops[((v>>5)&3)<<1:]
if v&(1<<4) != 0 {
@ -346,7 +347,7 @@ func writeDconv(w io.Writer, p *Prog, a *Addr, abiDetail bool) {
r := (v >> 16) & 31
fmt.Fprintf(w, "%s%c%c%d", Rconv(r+RBaseARM64), op[0], op[1], (v>>10)&63)
default:
panic("TYPE_SHIFT is not supported on " + objabi.GOARCH)
panic("TYPE_SHIFT is not supported on " + buildcfg.GOARCH)
}
case TYPE_REGREG: