diff options
author | Dmitriy Vyukov <dvyukov@google.com> | 2014-09-25 01:49:04 +0400 |
---|---|---|
committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-09-25 01:49:04 +0400 |
commit | 922c63ff4444252d7d69a7778e2088a06d26f566 (patch) | |
tree | 91e26084f39442cabd32eb6eaa45348d7dec9c5a /src/cmd/go | |
parent | a7a96c8cd6ef6146bf57eb419c0744c4ca8fc1e2 (diff) | |
download | go-922c63ff4444252d7d69a7778e2088a06d26f566.tar.gz |
cmd/go: strip -fsanitize= flags when building cgo object
Fixes issue 8788.
LGTM=iant
R=iant
CC=golang-codereviews
https://codereview.appspot.com/142470043
Diffstat (limited to 'src/cmd/go')
-rw-r--r-- | src/cmd/go/build.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 2e5273152..27bd30737 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -2228,6 +2228,14 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, gccfi strings.HasSuffix(f, ".so"), strings.HasSuffix(f, ".dll"): continue + // Remove any -fsanitize=foo flags. + // Otherwise the compiler driver thinks that we are doing final link + // and links sanitizer runtime into the object file. But we are not doing + // the final link, we will link the resulting object file again. And + // so the program ends up with two copies of sanitizer runtime. + // See issue 8788 for details. + case strings.HasPrefix(f, "-fsanitize="): + continue default: bareLDFLAGS = append(bareLDFLAGS, f) } |