Commit ee0aa396 authored by Ian Lance Taylor's avatar Ian Lance Taylor

cmd/go: compile packages imported by runtime with -+

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarKeith Randall <khr@golang.org>
parent 188e2bf8
......@@ -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, "-+")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment