]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: compile packages imported by runtime with -+
authorIan Lance Taylor <iant@golang.org>
Tue, 10 Apr 2018 03:01:36 +0000 (20:01 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 10 Apr 2018 13:27:50 +0000 (13:27 +0000)
Packages imported by the runtime should follow the same memory
allocation rules as the runtime package.

Change-Id: Id3fadb05605acbd6ac61d7fe6068a2add8bb2308
Reviewed-on: https://go-review.googlesource.com/105995
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/go/internal/work/gc.go

index 3ccc2c1d147f78ef341967e4e0bb442e1db307e1..2d61e54333f402abcb6f341b348951753d281576 100644 (file)
@@ -57,9 +57,14 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg []byte, a
                gcargs = append(gcargs, "-std")
        }
        compilingRuntime := p.Standard && (p.ImportPath == "runtime" || strings.HasPrefix(p.ImportPath, "runtime/internal"))
+       // The runtime package imports a couple of general internal packages.
+       if p.Standard && (p.ImportPath == "internal/cpu" || p.ImportPath == "internal/bytealg") {
+               compilingRuntime = true
+       }
        if compilingRuntime {
-               // runtime compiles with a special gc flag to emit
-               // additional reflect type data.
+               // runtime compiles with a special gc flag to check for
+               // memory allocations that are invalid in the runtime package,
+               // and to implement some special compiler pragmas.
                gcargs = append(gcargs, "-+")
        }