mirror of
https://github.com/golang/go
synced 2024-11-23 06:20:07 -07:00
cmd/go: add missing gccgo checks for buildmodeInit
Some recent failures in gccgo on linux/ppc64 identified an error in buildmodeInit when buildmode=c-archive. A fix went into gofrontend, and this is the corresponding change for master. This change also includes two other updates related to gccgo in this function that were in the file from gofrontend but missing from master. Updates #29046 Change-Id: I9a894e7d728e31fb9e9344cd61d50408df7faf4a Reviewed-on: https://go-review.googlesource.com/c/152160 Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
ea509c95e9
commit
ffac3d5a88
@ -82,19 +82,23 @@ func buildModeInit() {
|
||||
pkgsFilter = pkgsNotMain
|
||||
case "c-archive":
|
||||
pkgsFilter = oneMainPkg
|
||||
switch platform {
|
||||
case "darwin/arm", "darwin/arm64":
|
||||
codegenArg = "-shared"
|
||||
default:
|
||||
switch cfg.Goos {
|
||||
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
|
||||
if platform == "linux/ppc64" {
|
||||
base.Fatalf("-buildmode=c-archive not supported on %s\n", platform)
|
||||
}
|
||||
// Use -shared so that the result is
|
||||
// suitable for inclusion in a PIE or
|
||||
// shared library.
|
||||
if gccgo {
|
||||
codegenArg = "-fPIC"
|
||||
} else {
|
||||
switch platform {
|
||||
case "darwin/arm", "darwin/arm64":
|
||||
codegenArg = "-shared"
|
||||
default:
|
||||
switch cfg.Goos {
|
||||
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
|
||||
if platform == "linux/ppc64" {
|
||||
base.Fatalf("-buildmode=c-archive not supported on %s\n", platform)
|
||||
}
|
||||
// Use -shared so that the result is
|
||||
// suitable for inclusion in a PIE or
|
||||
// shared library.
|
||||
codegenArg = "-shared"
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg.ExeSuffix = ".a"
|
||||
@ -129,6 +133,9 @@ func buildModeInit() {
|
||||
default:
|
||||
ldBuildmode = "exe"
|
||||
}
|
||||
if gccgo {
|
||||
codegenArg = ""
|
||||
}
|
||||
case "exe":
|
||||
pkgsFilter = pkgsMain
|
||||
ldBuildmode = "exe"
|
||||
@ -143,7 +150,7 @@ func buildModeInit() {
|
||||
base.Fatalf("-buildmode=pie not supported when -race is enabled")
|
||||
}
|
||||
if gccgo {
|
||||
base.Fatalf("-buildmode=pie not supported by gccgo")
|
||||
codegenArg = "-fPIE"
|
||||
} else {
|
||||
switch platform {
|
||||
case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x",
|
||||
|
Loading…
Reference in New Issue
Block a user