diff options
author | Dave Cheney <dave@cheney.net> | 2014-10-20 23:28:39 +0000 |
---|---|---|
committer | Dave Cheney <dave@cheney.net> | 2014-10-20 23:28:39 +0000 |
commit | 2d4e74c499551f930b0144a85f0d6e239782e3ca (patch) | |
tree | b16483a5dd781b180b64fb4122e43050a1622938 /src/cmd/cgo | |
parent | 27a521f0744ec4be238adff5d2383d6a9ec4b3a1 (diff) | |
download | go-2d4e74c499551f930b0144a85f0d6e239782e3ca.tar.gz |
cmd/cgo: disable clang's integrated assembler
Fixes issue 8348.
Clang's internal assembler (introduced by default in clang 3.4) understands the .arch directive, but doesn't change the default value of -march. This causes the build to fail when we use BLX (armv5 and above) when clang is compiled for the default armv4t architecture (which appears to be the default on all the distros I've used).
This is probably a clang bug, so work around it for the time being by disabling the integrated assembler when compiling the cgo assembly shim.
This CL also includes a small change to ldelf.c which was required as clang 3.4 and above generate more weird symtab entries.
LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews
https://codereview.appspot.com/156430044
Diffstat (limited to 'src/cmd/cgo')
-rw-r--r-- | src/cmd/cgo/gcc.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index d77d56c22..e45839e8a 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -745,7 +745,13 @@ func (p *Package) gccMachine() []string { case "386": return []string{"-m32"} case "arm": - return []string{"-marm"} // not thumb + args := []string{"-marm"} // not thumb + if strings.Contains(p.gccBaseCmd()[0], "clang") { + // The clang integrated assembler understands the .arch directive + // but does not appear to honor it, so disable it. Issue 8348. + args = append(args, "-no-integrated-as") + } + return args } return nil } |