diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 3246b02f35d..67b682ecb77 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -1403,6 +1403,14 @@ func (b *builder) gccCmd(objdir string) []string { a = append(a, "-pthread") } } + + // On OS X, some of the compilers behave as if -fno-common + // is always set, and the Mach-O linker in 6l/8l assumes this. + // See http://golang.org/issue/3253. + if goos == "darwin" { + a = append(a, "-fno-common") + } + return a }