mirror of
https://github.com/golang/go.git
synced 2025-05-06 08:03:03 +00:00
cmd/compile: make sure build works when intrinsics are disabled
Some runtime functions, like getcallerpc/sp, don't have Go or assembly implementations and have to be intrinsified. Make sure they are, even if intrinsics are disabled. This makes "go build -gcflags=all=-d=ssa/intrinsics/off hello.go" work. Change-Id: I77caaed7715d3ca7ffef68a3cdc9357f095c6b9f Reviewed-on: https://go-review.googlesource.com/c/go/+/179897 Run-TryBot: Cherry Zhang <cherryyz@google.com> Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
48a53d6eaf
commit
c10db03cbe
@ -3658,9 +3658,6 @@ func init() {
|
|||||||
// findIntrinsic returns a function which builds the SSA equivalent of the
|
// findIntrinsic returns a function which builds the SSA equivalent of the
|
||||||
// function identified by the symbol sym. If sym is not an intrinsic call, returns nil.
|
// function identified by the symbol sym. If sym is not an intrinsic call, returns nil.
|
||||||
func findIntrinsic(sym *types.Sym) intrinsicBuilder {
|
func findIntrinsic(sym *types.Sym) intrinsicBuilder {
|
||||||
if ssa.IntrinsicsDisable {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
if sym == nil || sym.Pkg == nil {
|
if sym == nil || sym.Pkg == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -3680,6 +3677,13 @@ func findIntrinsic(sym *types.Sym) intrinsicBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn := sym.Name
|
fn := sym.Name
|
||||||
|
if ssa.IntrinsicsDisable {
|
||||||
|
if pkg == "runtime" && (fn == "getcallerpc" || fn == "getcallersp" || fn == "getclosureptr") {
|
||||||
|
// These runtime functions don't have definitions, must be intrinsics.
|
||||||
|
} else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
return intrinsics[intrinsicKey{thearch.LinkArch.Arch, pkg, fn}]
|
return intrinsics[intrinsicKey{thearch.LinkArch.Arch, pkg, fn}]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user