]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: pass explicit -O0 to the compiler
authorOryan Moshe <iamoryanmoshe@gmail.com>
Fri, 3 Aug 2018 11:52:39 +0000 (14:52 +0300)
committerIan Lance Taylor <iant@golang.org>
Wed, 22 Aug 2018 23:32:23 +0000 (23:32 +0000)
The current implementation removes all of the optimization flags from
the compiler.
Added the -O0 optimization flag after the removal loop, so go can
compile cgo on every OS consistently.

Fixes #26487

Change-Id: Ia98bca90def186dfe10f50b1787c2f40d85533da
Reviewed-on: https://go-review.googlesource.com/127755
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/cgo/gcc.go

index 20e794b4bea791472f54cb248d0f47a6354f9e11..019ee64c8e0202a8698d98594c8e40614dea389d 100644 (file)
@@ -1693,6 +1693,9 @@ func (p *Package) gccErrors(stdin []byte) string {
                }
        }
 
+       // Force -O0 optimization
+       nargs = append(nargs, "-O0")
+
        if *debugGcc {
                fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(nargs, " "))
                os.Stderr.Write(stdin)