]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: add -fno-common by default on Darwin
authorShenghou Ma <minux.ma@gmail.com>
Fri, 16 Mar 2012 16:05:09 +0000 (12:05 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 16 Mar 2012 16:05:09 +0000 (12:05 -0400)
        Fixes part of issue 3253.
        We still need to support scattered relocations though.

R=golang-dev, bsiegert, rsc, iant
CC=golang-dev
https://golang.org/cl/5822050

src/cmd/go/build.go

index 3246b02f35d587ca856488e532ab01127c8526ff..67b682ecb7798293bf69ff080d65ebffc773fb20 100644 (file)
@@ -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
 }