package asm
import (
- "os"
"testing"
"cmd/asm/internal/arch"
// A simple in-out test: Do we print what we parse?
func setArch(goarch string) (*arch.Arch, *obj.Link) {
- os.Setenv("GOOS", "linux") // obj can handle this OS for all architectures.
- os.Setenv("GOARCH", goarch)
+ obj.GOOS = "linux" // obj can handle this OS for all architectures.
+ obj.GOARCH = goarch
architecture := arch.Set(goarch)
if architecture == nil {
panic("asm: unrecognized architecture " + goarch)
log.SetFlags(0)
log.SetPrefix("asm: ")
- GOARCH := obj.Getgoarch()
+ GOARCH := obj.GOARCH
architecture := arch.Set(GOARCH)
if architecture == nil {
defer bio.MustClose(out)
buf := bufio.NewWriter(bio.MustWriter(out))
- fmt.Fprintf(buf, "go object %s %s %s\n", obj.Getgoos(), obj.Getgoarch(), obj.Getgoversion())
+ fmt.Fprintf(buf, "go object %s %s %s\n", obj.GOOS, obj.GOARCH, obj.Version)
fmt.Fprintf(buf, "!\n")
var ok, diag bool
gins(x86.ACLD, nil, nil)
} else {
// normal direction
- if q > 128 || (gc.Nacl && q >= 4) || (obj.Getgoos() == "plan9" && q >= 4) {
+ if q > 128 || (gc.Nacl && q >= 4) || (obj.GOOS == "plan9" && q >= 4) {
gconreg(movptr, q, x86.REG_CX)
gins(x86.AREP, nil, nil) // repeat
gins(x86.AMOVSQ, nil, nil) // MOVQ *(SI)+,*(DI)+
)
func betypeinit() {
- if obj.Getgoarch() == "amd64p32" {
+ if obj.GOARCH == "amd64p32" {
addptr = x86.AADDL
movptr = x86.AMOVL
leaptr = x86.ALEAL
cmpptr = x86.ACMPL
}
- if gc.Ctxt.Flag_dynlink || obj.Getgoos() == "nacl" {
+ if gc.Ctxt.Flag_dynlink || obj.GOOS == "nacl" {
resvd = append(resvd, x86.REG_R15)
}
- if gc.Ctxt.Framepointer_enabled || obj.Getgoos() == "nacl" {
+ if gc.Ctxt.Framepointer_enabled || obj.GOOS == "nacl" {
resvd = append(resvd, x86.REG_BP)
}
gc.Thearch.ReservedRegs = resvd
func Main() {
gc.Thearch.LinkArch = &x86.Linkamd64
- if obj.Getgoarch() == "amd64p32" {
+ if obj.GOARCH == "amd64p32" {
gc.Thearch.LinkArch = &x86.Linkamd64p32
}
gc.Thearch.REGSP = x86.REGSP
)
// no floating point in note handlers on Plan 9
-var isPlan9 = obj.Getgoos() == "plan9"
+var isPlan9 = obj.GOOS == "plan9"
func defframe(ptxt *obj.Prog) {
// fill in argument size, stack size
zerorange(p, int64(frame), lo, hi)
}
-var darwin = obj.Getgoos() == "darwin"
+var darwin = obj.GOOS == "darwin"
func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog {
cnt := hi - lo
var imported_unsafe bool
var (
- goos string
- goarch string
- goroot string
buildid string
flag_newparser bool
if p != "" {
sep = " "
}
- fmt.Printf("compile version %s%s%s\n", obj.Getgoversion(), sep, p)
+ fmt.Printf("compile version %s%s%s\n", obj.Version, sep, p)
os.Exit(0)
}
defer hidePanic()
- goarch = obj.Getgoarch()
-
Ctxt = obj.Linknew(Thearch.LinkArch)
Ctxt.DiagFunc = Yyerror
bstdout = bufio.NewWriter(os.Stdout)
mappkg.Name = "go.map"
mappkg.Prefix = "go.map"
- goroot = obj.Getgoroot()
- goos = obj.Getgoos()
-
- Nacl = goos == "nacl"
+ Nacl = obj.GOOS == "nacl"
if Nacl {
flag_largemodel = true
}
}
var buf bytes.Buffer
- fmt.Fprintln(&buf, "commit:", obj.Getgoversion())
+ fmt.Fprintln(&buf, "commit:", obj.Version)
fmt.Fprintln(&buf, "goos:", runtime.GOOS)
fmt.Fprintln(&buf, "goarch:", runtime.GOARCH)
timings.Write(&buf, "BenchmarkCompile:"+myimportpath+":")
}
}
- if goroot != "" {
+ if obj.GOROOT != "" {
suffix := ""
suffixsep := ""
if flag_installsuffix != "" {
suffix = "msan"
}
- file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.a", goroot, goos, goarch, suffixsep, suffix, name)
+ file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.a", obj.GOROOT, obj.GOOS, obj.GOARCH, suffixsep, suffix, name)
if _, err := os.Stat(file); err == nil {
return file, true
}
- file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.o", goroot, goos, goarch, suffixsep, suffix, name)
+ file = fmt.Sprintf("%s/pkg/%s_%s%s%s/%s.o", obj.GOROOT, obj.GOOS, obj.GOARCH, suffixsep, suffix, name)
if _, err := os.Stat(file); err == nil {
return file, true
}
errorexit()
}
- q := fmt.Sprintf("%s %s %s %s", obj.Getgoos(), obj.Getgoarch(), obj.Getgoversion(), obj.Expstring())
+ q := fmt.Sprintf("%s %s %s %s", obj.GOOS, obj.GOARCH, obj.Version, obj.Expstring())
if p[10:] != q {
Yyerror("import %s: object is [%s] expected [%s]", file, p[10:], q)
errorexit()
}
printheader := func() {
- fmt.Fprintf(bout, "go object %s %s %s %s\n", obj.Getgoos(), obj.Getgoarch(), obj.Getgoversion(), obj.Expstring())
+ fmt.Fprintf(bout, "go object %s %s %s %s\n", obj.GOOS, obj.GOARCH, obj.Version, obj.Expstring())
if buildid != "" {
fmt.Fprintf(bout, "build id %q\n", buildid)
}
fmt.Printf("\n")
// If this is a released compiler version, ask for a bug report.
- if strings.HasPrefix(obj.Getgoversion(), "release") {
+ if strings.HasPrefix(obj.Version, "release") {
fmt.Printf("\n")
fmt.Printf("Please file a bug report including a short program that triggers the error.\n")
fmt.Printf("https://golang.org/issue/new\n")
func Main() {
gc.Thearch.LinkArch = &mips.Linkmips64
- if obj.Getgoarch() == "mips64le" {
+ if obj.GOARCH == "mips64le" {
gc.Thearch.LinkArch = &mips.Linkmips64le
}
gc.Thearch.REGSP = mips.REGSP
func Main() {
gc.Thearch.LinkArch = &ppc64.Linkppc64
- if obj.Getgoarch() == "ppc64le" {
+ if obj.GOARCH == "ppc64le" {
gc.Thearch.LinkArch = &ppc64.Linkppc64le
}
gc.Thearch.REGSP = ppc64.REGSP
c.fpRegMask = fpRegMaskARM64
c.FPReg = framepointerRegARM64
c.hasGReg = true
- c.noDuffDevice = obj.Getgoos() == "darwin" // darwin linker cannot handle BR26 reloc with non-zero addend
+ c.noDuffDevice = obj.GOOS == "darwin" // darwin linker cannot handle BR26 reloc with non-zero addend
case "ppc64le":
c.IntSize = 8
c.PtrSize = 8
}
c.ctxt = ctxt
c.optimize = optimize
- c.nacl = obj.Getgoos() == "nacl"
+ c.nacl = obj.GOOS == "nacl"
// Don't use Duff's device on Plan 9 AMD64, because floating
// point operations are not allowed in note handler.
- if obj.Getgoos() == "plan9" && arch == "amd64" {
+ if obj.GOOS == "plan9" && arch == "amd64" {
c.noDuffDevice = true
}
gc.Thearch.REGRETURN = x86.REG_AX
gc.Thearch.REGMIN = x86.REG_AX
gc.Thearch.REGMAX = x86.REG_DI
- switch v := obj.Getgo386(); v {
+ switch v := obj.GO386; v {
case "387":
gc.Thearch.FREGMIN = x86.REG_F0
gc.Thearch.FREGMAX = x86.REG_F7
log.SetFlags(0)
log.SetPrefix("compile: ")
- switch obj.Getgoarch() {
+ switch obj.GOARCH {
default:
- fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", obj.Getgoarch())
+ fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", obj.GOARCH)
os.Exit(2)
case "386":
x86.Main()
func chipzero5(ctxt *obj.Link, e float64) int {
// We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions.
- if ctxt.Goarm < 7 || e != 0 {
+ if obj.GOARM < 7 || e != 0 {
return -1
}
return 0
func chipfloat5(ctxt *obj.Link, e float64) int {
// We use GOARM=7 to gate the use of VFPv3 vmov (imm) instructions.
- if ctxt.Goarm < 7 {
+ if obj.GOARM < 7 {
return -1
}
ctxt.Diag("%v: TLS MRC instruction must write to R0 as it might get translated into a BL instruction", p.Line())
}
- if ctxt.Goarm < 7 {
+ if obj.GOARM < 7 {
// Replace it with BL runtime.read_tls_fallback(SB) for ARM CPUs that lack the tls extension.
if progedit_tlsfallback == nil {
progedit_tlsfallback = obj.Linklookup(ctxt, "runtime.read_tls_fallback", 0)
}
func softfloat(ctxt *obj.Link, cursym *obj.LSym) {
- if ctxt.Goarm > 5 {
+ if obj.GOARM > 5 {
return
}
// Link holds the context for writing object code from a compiler
// to be linker input or for reading that input into the linker.
type Link struct {
- Goarm int32
Headtype HeadType
Arch *LinkArch
Debugasm int32
if ctxt.FixedFrameSize() == 0 {
offs -= int32(ctxt.Arch.PtrSize)
}
- if Framepointer_enabled(Getgoos(), Getgoarch()) {
+ if Framepointer_enabled(GOOS, GOARCH) {
offs -= int32(ctxt.Arch.PtrSize)
}
package obj
import (
- "cmd/internal/sys"
"log"
"os"
"path/filepath"
ctxt.Hash = make(map[SymVer]*LSym)
ctxt.Arch = arch
ctxt.Version = HistVersion
- ctxt.Goroot = Getgoroot()
+ ctxt.Goroot = GOROOT
ctxt.Goroot_final = os.Getenv("GOROOT_FINAL")
var buf string
buf = filepath.ToSlash(buf)
ctxt.Pathname = buf
- ctxt.LineHist.GOROOT = ctxt.Goroot
+ ctxt.LineHist.GOROOT = GOROOT
ctxt.LineHist.GOROOT_FINAL = ctxt.Goroot_final
ctxt.LineHist.Dir = ctxt.Pathname
- ctxt.Headtype.Set(Getgoos())
+ ctxt.Headtype.Set(GOOS)
if ctxt.Headtype < 0 {
- log.Fatalf("unknown goos %s", Getgoos())
- }
-
- // On arm, record goarm.
- if ctxt.Arch.Family == sys.ARM {
- ctxt.Goarm = Getgoarm()
+ log.Fatalf("unknown goos %s", GOOS)
}
ctxt.Flag_optimize = true
- ctxt.Framepointer_enabled = Framepointer_enabled(Getgoos(), arch.Name)
+ ctxt.Framepointer_enabled = Framepointer_enabled(GOOS, arch.Name)
return ctxt
}
return value
}
-func Getgoroot() string {
- return envOr("GOROOT", defaultGOROOT)
-}
-
-func Getgoarch() string {
- return envOr("GOARCH", defaultGOARCH)
-}
-
-func Getgoos() string {
- return envOr("GOOS", defaultGOOS)
-}
+var (
+ GOROOT = envOr("GOROOT", defaultGOROOT)
+ GOARCH = envOr("GOARCH", defaultGOARCH)
+ GOOS = envOr("GOOS", defaultGOOS)
+ GO386 = envOr("GO386", defaultGO386)
+ GOARM = goarm()
+ Version = version
+)
-func Getgoarm() int32 {
+func goarm() int {
switch v := envOr("GOARM", defaultGOARM); v {
case "5":
return 5
panic("unreachable")
}
-func Getgo386() string {
- // Validated by cmd/compile.
- return envOr("GO386", defaultGO386)
-}
-
func Getgoextlinkenabled() string {
return envOr("GO_EXTLINK_ENABLED", defaultGO_EXTLINK_ENABLED)
}
-func Getgoversion() string {
- return version
-}
-
func (p *Prog) Line() string {
return p.Ctxt.LineHist.LineString(int(p.Lineno))
}
case TYPE_SHIFT:
v := int(a.Offset)
ops := "<<>>->@>"
- switch goarch := Getgoarch(); goarch {
+ switch GOARCH {
case "arm":
op := ops[((v>>5)&3)<<1:]
if v&(1<<4) != 0 {
op := ops[((v>>22)&3)<<1:]
str = fmt.Sprintf("R%d%c%c%d", (v>>16)&31, op[0], op[1], (v>>10)&63)
default:
- panic("TYPE_SHIFT is not supported on " + goarch)
+ panic("TYPE_SHIFT is not supported on " + GOARCH)
}
case TYPE_REGREG:
}
}
-var isAndroid = (obj.Getgoos() == "android")
+var isAndroid = (obj.GOOS == "android")
func prefixof(ctxt *obj.Link, p *obj.Prog, a *obj.Addr) int {
if a.Reg < REG_CS && a.Index < REG_CS { // fast path
func linkarchinit() {
ld.SysArch = sys.ArchAMD64
- if obj.Getgoarch() == "amd64p32" {
+ if obj.GOARCH == "amd64p32" {
ld.SysArch = sys.ArchAMD64P32
}
// For Mach-O and PE/386 files we strip a leading
// underscore from the symbol name.
- if goos == "darwin" || (goos == "windows" && goarch == "386") {
+ if obj.GOOS == "darwin" || (obj.GOOS == "windows" && obj.GOARCH == "386") {
if name[0] == '_' && len(name) > 1 {
name = name[1:]
}
}
case obj.R_TLS_LE:
- isAndroidX86 := goos == "android" && (SysArch.InFamily(sys.AMD64, sys.I386))
+ isAndroidX86 := obj.GOOS == "android" && (SysArch.InFamily(sys.AMD64, sys.I386))
if Linkmode == LinkExternal && Iself && Headtype != obj.Hopenbsd && !isAndroidX86 {
r.Done = 0
}
case obj.R_TLS_IE:
- isAndroidX86 := goos == "android" && (SysArch.InFamily(sys.AMD64, sys.I386))
+ isAndroidX86 := obj.GOOS == "android" && (SysArch.InFamily(sys.AMD64, sys.I386))
if Linkmode == LinkExternal && Iself && Headtype != obj.Hopenbsd && !isAndroidX86 {
r.Done = 0
if SysArch.Family == sys.ARM {
// mark some functions that are only referenced after linker code editing
- if d.ctxt.Goarm == 5 {
+ if obj.GOARM == 5 {
names = append(names, "_sfloat")
}
names = append(names, "runtime.read_tls_fallback")
Segdwarf Segment
)
-/* set by call to mywhatsys() */
-
/* whence for ldpkg */
const (
FileObj = 0 + iota
// Set if we see an object compiled by the host compiler that is not
// from a package that is known to support internal linking mode.
externalobj = false
- goroot string
- goarch string
- goos string
theline string
)
func libinit(ctxt *Link) {
Funcalign = Thearch.Funcalign
- mywhatsys() // get goroot, goarch, goos
// add goroot to the end of the libdir list.
suffix := ""
suffix = "msan"
}
- Lflag(ctxt, filepath.Join(goroot, "pkg", fmt.Sprintf("%s_%s%s%s", goos, goarch, suffixsep, suffix)))
+ Lflag(ctxt, filepath.Join(obj.GOROOT, "pkg", fmt.Sprintf("%s_%s%s%s", obj.GOOS, obj.GOARCH, suffixsep, suffix)))
mayberemoveoutfile()
f, err := os.OpenFile(*flagOutfile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0775)
if *flagEntrySymbol == "" {
switch Buildmode {
case BuildmodeCShared, BuildmodeCArchive:
- *flagEntrySymbol = fmt.Sprintf("_rt0_%s_%s_lib", goarch, goos)
+ *flagEntrySymbol = fmt.Sprintf("_rt0_%s_%s_lib", obj.GOARCH, obj.GOOS)
case BuildmodeExe, BuildmodePIE:
- *flagEntrySymbol = fmt.Sprintf("_rt0_%s_%s", goarch, goos)
+ *flagEntrySymbol = fmt.Sprintf("_rt0_%s_%s", obj.GOARCH, obj.GOOS)
case BuildmodeShared:
// No *flagEntrySymbol for -buildmode=shared
default:
}
// Force external linking for android.
- if goos == "android" {
+ if obj.GOOS == "android" {
Linkmode = LinkExternal
}
// cmd/7l doesn't support cgo internal linking
// This is https://golang.org/issue/10373.
// mips64x doesn't support cgo internal linking either (golang.org/issue/14449)
- if iscgo && (goarch == "arm64" || goarch == "mips64" || goarch == "mips64le") {
+ if iscgo && (obj.GOARCH == "arm64" || obj.GOARCH == "mips64" || obj.GOARCH == "mips64le") {
Linkmode = LinkExternal
}
s := Linklookup(ctxt, "runtime.goarm", 0)
s.Type = obj.SRODATA
s.Size = 0
- Adduint8(ctxt, s, uint8(ctxt.Goarm))
+ Adduint8(ctxt, s, uint8(obj.GOARM))
}
- if obj.Framepointer_enabled(obj.Getgoos(), obj.Getgoarch()) {
+ if obj.Framepointer_enabled(obj.GOOS, obj.GOARCH) {
s := Linklookup(ctxt, "runtime.framepointer_enabled", 0)
s.Type = obj.SRODATA
s.Size = 0
// only want to do this when producing a Windows output file
// on a Windows host.
outopt := *flagOutfile
- if goos == "windows" && runtime.GOOS == "windows" && filepath.Ext(outopt) == "" {
+ if obj.GOOS == "windows" && runtime.GOOS == "windows" && filepath.Ext(outopt) == "" {
outopt += "."
}
argv = append(argv, "-o")
return nil
}
- // First, check that the basic goos, goarch, and version match.
- t := fmt.Sprintf("%s %s %s ", goos, obj.Getgoarch(), obj.Getgoversion())
+ // First, check that the basic GOOS, GOARCH, and Version match.
+ t := fmt.Sprintf("%s %s %s ", obj.GOOS, obj.GOARCH, obj.Version)
line = strings.TrimRight(line, "\n")
if !strings.HasPrefix(line[10:]+" ", t) && !*flagF {
ctxt.Shlibs = append(ctxt.Shlibs, Shlib{Path: libpath, Hash: hash, Deps: deps, File: f, gcdataAddresses: gcdataAddresses})
}
-func mywhatsys() {
- goroot = obj.Getgoroot()
- goos = obj.Getgoos()
- goarch = obj.Getgoarch()
-}
-
// Copied from ../gc/subr.c:/^pathtoprefix; must stay in sync.
/*
* Convert raw string to the prefix that will be used in the symbol table.
}
func doversion() {
- Exitf("version %s", obj.Getgoversion())
+ Exitf("version %s", obj.Version)
}
func genasmsym(ctxt *Link, put func(*Link, *Symbol, string, int, int64, int64, int, *Symbol)) {
}
type Link struct {
- Goarm int32
Arch *sys.Arch
Debugvlog int
Bso *bufio.Writer
Windows int32
- Goroot string
// Symbol lookup based on name and indexed by version.
Hash []map[string]*Symbol
}
// TODO(matloob): define these above and then check flag values here
- if SysArch.Family == sys.AMD64 && obj.Getgoos() == "plan9" {
+ if SysArch.Family == sys.AMD64 && obj.GOOS == "plan9" {
flag.BoolVar(&Flag8, "8", false, "use 64-bit addresses in symbol table")
}
obj.Flagfn1("B", "add an ELF NT_GNU_BUILD_ID `note` when using ELF", addbuildinfo)
libinit(ctxt) // creates outfile
if Headtype == obj.Hunknown {
- Headtype.Set(obj.Getgoos())
+ Headtype.Set(obj.GOOS)
}
ctxt.computeTLSOffset()
func expandGoroot(s string) string {
const n = len("$GOROOT")
if len(s) >= n+1 && s[:n] == "$GOROOT" && (s[n] == '/' || s[n] == '\\') {
- root := goroot
+ root := obj.GOROOT
if final := os.Getenv("GOROOT_FINAL"); final != "" {
root = final
}
sectoff := ctors.VirtualAddress
Lputl(sectoff)
Lputl(uint32(dottext.Dynid))
- switch obj.Getgoarch() {
+ switch obj.GOARCH {
default:
- fmt.Fprintf(os.Stderr, "link: unknown architecture for PE: %q\n", obj.Getgoarch())
+ fmt.Fprintf(os.Stderr, "link: unknown architecture for PE: %q\n", obj.GOARCH)
os.Exit(2)
case "386":
Wputl(IMAGE_REL_I386_DIR32)
// However, the entire Go runtime is initialized from just one function, so it is unlikely
// that this will need to grow in the future.
var size int
- switch obj.Getgoarch() {
+ switch obj.GOARCH {
default:
- fmt.Fprintf(os.Stderr, "link: unknown architecture for PE: %q\n", obj.Getgoarch())
+ fmt.Fprintf(os.Stderr, "link: unknown architecture for PE: %q\n", obj.GOARCH)
os.Exit(2)
case "386":
size = 4
init_entry := Linklookup(ctxt, *flagEntrySymbol, 0)
addr := uint64(init_entry.Value) - init_entry.Sect.Vaddr
- switch obj.Getgoarch() {
+ switch obj.GOARCH {
case "386":
Lputl(uint32(addr))
case "amd64":
},
Allsym: make([]*Symbol, 0, 100000),
Arch: arch,
- Goroot: obj.Getgoroot(),
}
- p := obj.Getgoarch()
- if p != arch.Name {
- log.Fatalf("invalid goarch %s (want %s)", p, arch.Name)
- }
-
- // On arm, record goarm.
- if ctxt.Arch.Family == sys.ARM {
- ctxt.Goarm = obj.Getgoarm()
+ if obj.GOARCH != arch.Name {
+ log.Fatalf("invalid obj.GOARCH %s (want %s)", obj.GOARCH, arch.Name)
}
return ctxt
obj.Hopenbsd,
obj.Hdragonfly,
obj.Hsolaris:
- if obj.Getgoos() == "android" {
+ if obj.GOOS == "android" {
switch ctxt.Arch.Family {
case sys.AMD64:
// Android/amd64 constant - offset from 0(FS) to our TLS slot.
)
func (mode *BuildMode) Set(s string) error {
- goos := obj.Getgoos()
- goarch := obj.Getgoarch()
badmode := func() error {
- return fmt.Errorf("buildmode %s not supported on %s/%s", s, goos, goarch)
+ return fmt.Errorf("buildmode %s not supported on %s/%s", s, obj.GOOS, obj.GOARCH)
}
switch s {
default:
case "exe":
*mode = BuildmodeExe
case "pie":
- switch goos {
+ switch obj.GOOS {
case "android", "linux":
default:
return badmode()
}
*mode = BuildmodePIE
case "c-archive":
- switch goos {
+ switch obj.GOOS {
case "darwin", "linux":
case "windows":
- switch goarch {
+ switch obj.GOARCH {
case "amd64", "386":
default:
return badmode()
}
*mode = BuildmodeCArchive
case "c-shared":
- switch goarch {
+ switch obj.GOARCH {
case "386", "amd64", "arm", "arm64":
default:
return badmode()
}
*mode = BuildmodeCShared
case "shared":
- switch goos {
+ switch obj.GOOS {
case "linux":
- switch goarch {
+ switch obj.GOARCH {
case "386", "amd64", "arm", "arm64", "ppc64le", "s390x":
default:
return badmode()
}
func linkarchinit() {
- if obj.Getgoarch() == "mips64le" {
+ if obj.GOARCH == "mips64le" {
ld.SysArch = sys.ArchMIPS64LE
} else {
ld.SysArch = sys.ArchMIPS64
}
func linkarchinit() {
- if obj.Getgoarch() == "ppc64le" {
+ if obj.GOARCH == "ppc64le" {
ld.SysArch = sys.ArchPPC64LE
} else {
ld.SysArch = sys.ArchPPC64
)
func main() {
- switch obj.Getgoarch() {
+ switch obj.GOARCH {
default:
- fmt.Fprintf(os.Stderr, "link: unknown architecture %q\n", obj.Getgoarch())
+ fmt.Fprintf(os.Stderr, "link: unknown architecture %q\n", obj.GOARCH)
os.Exit(2)
case "386":
x86.Main()