From 9b70c70ffb3f42d6f413bbff894621f8f1e4de05 Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 16 Mar 2012 12:05:09 -0400 Subject: [PATCH] cmd/go: add -fno-common by default on Darwin 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 3246b02f35..67b682ecb7 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 } -- 2.50.0