mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go, cmd/compile: always optimize when building runtime
When optimizations are disabled, the compiler cannot eliminate enough write barriers to satisfy the runtime's nowritebarrier and nowritebarrierrec annotations. Enforce that requirement, and for convenience, have cmd/go elide -N when compiling the runtime. This came up in practice for me when running toolstash -cmp. When toolstash -cmp detected mismatches, it recompiled with -N, which caused runtime compilation failures. Change-Id: Ifcdef22c725baf2c59a09470f00124361508a8f3 Reviewed-on: https://go-review.googlesource.com/38380 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
a955ece6cd
commit
f8b0231639
2 changed files with 21 additions and 2 deletions
|
|
@ -268,6 +268,9 @@ func Main(archInit func(*Arch)) {
|
|||
} else if flag_race || flag_msan {
|
||||
instrumenting = true
|
||||
}
|
||||
if compiling_runtime && Debug['N'] != 0 {
|
||||
log.Fatal("cannot disable optimizations while compiling runtime")
|
||||
}
|
||||
|
||||
// parse -d argument
|
||||
if debugstr != "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue