1
0
mirror of https://github.com/golang/go synced 2024-11-25 01:08:02 -07:00

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
This commit is contained in:
Mikio Hara 2011-12-22 23:18:34 +09:00
parent 43bc8a9b53
commit e636f6f51c

View File

@ -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...)
}