diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-23 00:41:03 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-04-23 00:41:03 +0000 |
commit | 6baae25622af1c981cfa2c9058a0bbc6e0ea4aac (patch) | |
tree | 9b4b729a487dd97f86d07f6cf705b202eb5d07a5 /libgo/go | |
parent | b3446c2fe27b198ec08a1a15817f99b7fbf340e4 (diff) |
cmd/go: bring in final version of gccgo pkg-config support
This updates gccgo to the final version of https://golang.org/cl/18790,
by Michael Hudson-Doyle.
Update golang/go#11739.
Reviewed-on: https://go-review.googlesource.com/22400
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go')
-rw-r--r-- | libgo/go/cmd/go/build.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libgo/go/cmd/go/build.go b/libgo/go/cmd/go/build.go index 4382cf72ed7..d7a4a43093d 100644 --- a/libgo/go/cmd/go/build.go +++ b/libgo/go/cmd/go/build.go @@ -2647,9 +2647,18 @@ func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions if err != nil { return err } + const ldflagsPrefix = "_CGO_LDFLAGS=" for _, line := range strings.Split(string(flags), "\n") { - if strings.HasPrefix(line, "_CGO_LDFLAGS=") { - cgoldflags = append(cgoldflags, strings.Fields(line[13:])...) + if strings.HasPrefix(line, ldflagsPrefix) { + newFlags := strings.Fields(line[len(ldflagsPrefix):]) + for _, flag := range newFlags { + // Every _cgo_flags file has -g and -O2 in _CGO_LDFLAGS + // but they don't mean anything to the linker so filter + // them out. + if flag != "-g" && !strings.HasPrefix(flag, "-O") { + cgoldflags = append(cgoldflags, flag) + } + } } } return nil |