• Russ Cox's avatar
    cmd/dist, cmd/cgo, cmd/go: allow per-goos/goarch default CC · 4739c0db
    Russ Cox authored
    Even though cmd/dist has historically distinguished "CC for gohostos/gohostarch"
    from "CC for target goos/goarch", it has not recorded that distinction
    for later use by cmd/cgo and cmd/go. Now that content-based staleness
    includes the CC setting in the decision about when to rebuild packages,
    the go command needs to know the details of which CC to use when.
    Otherwise lots of things look out of date and (worse) may be rebuilt with
    the wrong CC.
    
    A related issue is that users may want to be able to build a toolchain
    capable of cross-compiling for two different non-host targets, and
    to date we've required that CC_FOR_TARGET apply to both.
    This CL introduces CC_FOR_${GOOS}_${GOARCH}, so that you can
    (for example) set CC_FOR_linux_arm and CC_FOR_linux_arm64
    separately on a linux/ppc64 host and be able to cross-compile to
    either arm or arm64 with the right toolchain.
    
    Fixes #8161.
    Half of a fix for #22509.
    
    Change-Id: I7a43769f39d859f659d31bc96980918ba102fb83
    Reviewed-on: https://go-review.googlesource.com/76018
    Run-TryBot: Russ Cox <rsc@golang.org>
    Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
    4739c0db
buildgo.go 3.41 KB