mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
When ABI wrappers are used, there are cases where in Go code we need the PC of the defined function instead of the ABI wrapper. Currently we work around this by define such functions as ABIInternal, even if they do not actually follow the internal ABI. This CL introduces internal/abi.FuncPCABIxxx functions as compiler intrinsics, which return the underlying defined function's entry PC if the argument is a direct reference of a function of the expected ABI, and reject it if it is of a different ABI. As a proof of concept, change runtime.goexit back to ABI0 and use internal/abi.FuncPCABI0 to retrieve its PC. Updates #44065. Change-Id: I02286f0f9d99e6a3090f9e8169dbafc6804a2da6 Reviewed-on: https://go-review.googlesource.com/c/go/+/304232 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
27 lines
603 B
ArmAsm
27 lines
603 B
ArmAsm
// Copyright 2021 The Go Authors. All rights reserved.
|
||
// Use of this source code is governed by a BSD-style
|
||
// license that can be found in the LICENSE file.
|
||
|
||
#include "textflag.h"
|
||
|
||
#ifdef GOARCH_386
|
||
#define PTRSIZE 4
|
||
#endif
|
||
#ifdef GOARCH_arm
|
||
#define PTRSIZE 4
|
||
#endif
|
||
#ifdef GOARCH_mips
|
||
#define PTRSIZE 4
|
||
#endif
|
||
#ifdef GOARCH_mipsle
|
||
#define PTRSIZE 4
|
||
#endif
|
||
#ifndef PTRSIZE
|
||
#define PTRSIZE 8
|
||
#endif
|
||
|
||
TEXT internal∕abi·FuncPCTestFn(SB),NOSPLIT,$0-0
|
||
RET
|
||
|
||
GLOBL internal∕abi·FuncPCTestFnAddr(SB), NOPTR, $PTRSIZE
|
||
DATA internal∕abi·FuncPCTestFnAddr(SB)/PTRSIZE, $internal∕abi·FuncPCTestFn(SB)
|