mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: disable open-coded defers on riscv64
Open-coded defers are currently broken on riscv64 - disable them for the time being. All of the standard package tests now pass on linux/riscv64. Updates issue #27532 and #36786 Change-Id: I20fc25ce91dfad48be32409ba5c64ca9a6acef1d Reviewed-on: https://go-review.googlesource.com/c/go/+/216517 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
d8e052667f
commit
a858d15f11
2 changed files with 10 additions and 1 deletions
|
|
@ -340,12 +340,17 @@ func buildssa(fn *Node, worker int) *ssa.Func {
|
|||
s.startmem = s.entryNewValue0(ssa.OpInitMem, types.TypeMem)
|
||||
|
||||
s.hasOpenDefers = Debug['N'] == 0 && s.hasdefer && !s.curfn.Func.OpenCodedDeferDisallowed()
|
||||
if s.hasOpenDefers && (Ctxt.Flag_shared || Ctxt.Flag_dynlink) && thearch.LinkArch.Name == "386" {
|
||||
switch {
|
||||
case s.hasOpenDefers && (Ctxt.Flag_shared || Ctxt.Flag_dynlink) && thearch.LinkArch.Name == "386":
|
||||
// Don't support open-coded defers for 386 ONLY when using shared
|
||||
// libraries, because there is extra code (added by rewriteToUseGot())
|
||||
// preceding the deferreturn/ret code that is generated by gencallret()
|
||||
// that we don't track correctly.
|
||||
s.hasOpenDefers = false
|
||||
case thearch.LinkArch.Name == "riscv64":
|
||||
// The use of open-coded defers is currently broken on riscv64,
|
||||
// hence disable it for now - see issue golang.org/issue/36786
|
||||
s.hasOpenDefers = false
|
||||
}
|
||||
if s.hasOpenDefers && s.curfn.Func.Exit.Len() > 0 {
|
||||
// Skip doing open defers if there is any extra exit code (likely
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// errorcheck -0 -l -d=defer
|
||||
// +build !riscv64
|
||||
|
||||
// Copyright 2019 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
|
|
@ -6,6 +7,9 @@
|
|||
|
||||
// check that open-coded defers are used in expected situations
|
||||
|
||||
// TODO(jsing): Re-enable on riscv64 once open-coded defers are turned
|
||||
// back on - see golang.org/issue/36786
|
||||
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue