Skip to content

Commit

Permalink
cmd/go: bring in final version of gccgo pkg-config support
Browse files Browse the repository at this point in the history
This updates gccgo to the final version of https://golang.org/cl/18790,
by Michael Hudson-Doyle.

Update golang/go#11739.

Change-Id: I66b42d6dbe6ed2ea8b0e7cbdd1ff211704811614
Reviewed-on: https://go-review.googlesource.com/22400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
ianlancetaylor committed Apr 23, 2016
1 parent ff29ea8 commit 97b358f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions libgo/go/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 97b358f

Please sign in to comment.