From: Mikio Hara Date: Thu, 22 Dec 2011 14:18:34 +0000 (+0900) Subject: cmd/gc: make sure use of pthread for gcc-4.5 and beyond X-Git-Tag: weekly.2011-12-22~32 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e636f6f51c073b7539b01fc2fcc7c17e25e29294;p=gostls13.git cmd/gc: make sure use of pthread for gcc-4.5 and beyond R=golang-dev, rsc, n13m3y3r, rogpeppe CC=golang-dev https://golang.org/cl/5501060 --- diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index b79a522dc9..62c8d90d30 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -912,6 +912,16 @@ func (b *builder) gccCmd(objdir string, flags []string, args ...string) []string case "6": a = append(a, "-m64") } + // gcc-4.5 and beyond require explicit "-pthread" flag + // for multithreading with pthread library. + if build.DefaultContext.CgoEnabled { + switch b.goos { + case "windows": + a = append(a, "-mthread") + default: + a = append(a, "-pthread") + } + } a = append(a, flags...) return append(a, args...) }