diff options
| author | Austin Clements <austin@google.com> | 2021-03-24 10:32:13 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2021-03-29 18:46:30 +0000 |
| commit | 1e8fff0f7b4577dcb7192928e2db4af7a11e9c0e (patch) | |
| tree | 2d8d1ec7f21ef2f4056f140ca35cede2f84e1a29 /src/cmd/compile/internal/staticdata/data.go | |
| parent | 0d1423583b9106d398740862bca4ad5661fd67ad (diff) | |
| download | go-1e8fff0f7b4577dcb7192928e2db4af7a11e9c0e.tar.xz | |
cmd/compile: assert that function values reference ABIInternal
Function values must always point to the ABIInternal entry point of a
function. It wasn't entirely obvious to me we were getting this right,
so this CL adds checks for this.
Updates #40724.
Change-Id: Idd854e996d63d9151c28ec5c9251b690453b1024
Reviewed-on: https://go-review.googlesource.com/c/go/+/305272
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/staticdata/data.go')
| -rw-r--r-- | src/cmd/compile/internal/staticdata/data.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/staticdata/data.go b/src/cmd/compile/internal/staticdata/data.go index fca2a63eb4..cde4c50026 100644 --- a/src/cmd/compile/internal/staticdata/data.go +++ b/src/cmd/compile/internal/staticdata/data.go @@ -292,7 +292,13 @@ func WriteFuncSyms() { for _, nam := range funcsyms { s := nam.Sym() sf := s.Pkg.Lookup(ir.FuncSymName(s)).Linksym() - objw.SymPtr(sf, 0, s.Linksym(), 0) + // Function values must always reference ABIInternal + // entry points. + target := s.Linksym() + if target.ABI() != obj.ABIInternal { + base.Fatalf("expected ABIInternal: %v has %v", target, target.ABI()) + } + objw.SymPtr(sf, 0, target, 0) objw.Global(sf, int32(types.PtrSize), obj.DUPOK|obj.RODATA) } } |
