diff options
author | Erik Westrup <erik.westrup@gmail.com> | 2014-03-26 15:23:31 -0700 |
---|---|---|
committer | Erik Westrup <erik.westrup@gmail.com> | 2014-03-26 15:23:31 -0700 |
commit | 9adde271d16cf7d4f0817a9ab390c30b13a7e809 (patch) | |
tree | 712f098b8d56d56ae21343a5f234cc5088656589 /src/cmd/go/build.go | |
parent | c5c81b939fd3c6645b4d4f376a7654dec24fe1d1 (diff) | |
download | go-9adde271d16cf7d4f0817a9ab390c30b13a7e809.tar.gz |
cmd/go: Use exported CgoLDFlags when compiler=gccgo
If you compile a program that has cgo LDFLAGS directives, those are exported to an environment variable to be used by subsequent compiler tool invocations. The linking phase when using the gccgo toolchain did not consider the envvar CGO_LDFLAGS's linking directives resulting in undefined references when using cgo+gccgo.
Fixes issue 7573
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/80780043
Committer: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/go/build.go')
-rw-r--r-- | src/cmd/go/build.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 6166410c6..a21c873c8 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -1905,6 +1905,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions [] ldflags = append(ldflags, afiles...) ldflags = append(ldflags, sfiles...) ldflags = append(ldflags, cgoldflags...) + ldflags = append(ldflags, p.CgoLDFLAGS...) if usesCgo && goos == "linux" { ldflags = append(ldflags, "-Wl,-E") } |