1
0
mirror of https://github.com/golang/go synced 2024-11-23 09:20:05 -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:
Lynn Boger 2018-12-03 17:02:20 -05:00
parent ea509c95e9
commit ffac3d5a88

View File

@ -82,6 +82,9 @@ func buildModeInit() {
pkgsFilter = pkgsNotMain
case "c-archive":
pkgsFilter = oneMainPkg
if gccgo {
codegenArg = "-fPIC"
} else {
switch platform {
case "darwin/arm", "darwin/arm64":
codegenArg = "-shared"
@ -97,6 +100,7 @@ func buildModeInit() {
codegenArg = "-shared"
}
}
}
cfg.ExeSuffix = ".a"
ldBuildmode = "c-archive"
case "c-shared":
@ -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",