Commit 28fb0d80 authored by Russ Cox's avatar Russ Cox

cmd/go: fix addition of "math" dependency for arm binaries

p.ImportPath is the directory-derived path (like cmd/go).
p.Name is the actual package name.

Fixes #12089.

Change-Id: Ief76d42a85f811b0dfe2218affb48551527a7d44
Reviewed-on: https://go-review.googlesource.com/13530Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
parent 8ce80ce8
......@@ -2352,3 +2352,23 @@ func TestGoBuildOutput(t *testing.T) {
tg.runFail("build", "-o", "whatever", "cmd/gofmt", "sync/atomic")
tg.grepStderr("multiple packages", "did not reject -o with multiple packages")
}
func TestGoBuildARM(t *testing.T) {
if testing.Short() {
t.Skip("skipping cross-compile in short mode")
}
tg := testgo(t)
defer tg.cleanup()
tg.makeTempdir()
tg.cd(tg.path("."))
tg.setenv("GOARCH", "arm")
tg.setenv("GOOS", "linux")
tg.setenv("GOARM", "5")
tg.tempFile("hello.go", `package main
func main() {}`)
tg.run("build", "hello.go")
tg.grepStderrNot("unable to find math.a", "did not build math.a correctly")
}
......@@ -836,7 +836,7 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
importPaths = append(importPaths, "runtime/race")
}
// On ARM with GOARM=5, everything depends on math for the link.
if p.ImportPath == "main" && goarch == "arm" {
if p.Name == "main" && goarch == "arm" {
importPaths = append(importPaths, "math")
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment