summaryrefslogtreecommitdiffstats
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-04 19:59:59 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-08 20:08:09 -0800
commit3ab49b1c822cf8c5748fa4de0ac970c948de6f8a (patch)
tree0696141de5cddb0755c91ff21befd313bf0b9e29 /libgo
parentanalyzer: Fix tests for glibc 2.35 [PR101081] (diff)
downloadgcc-3ab49b1c822cf8c5748fa4de0ac970c948de6f8a.tar.gz
gcc-3ab49b1c822cf8c5748fa4de0ac970c948de6f8a.tar.bz2
gcc-3ab49b1c822cf8c5748fa4de0ac970c948de6f8a.tar.xz
compiler, internal/abi: implement FuncPCABI0, FuncPCABIInternal
The Go 1.18 standard library uses an internal/abi package with two functions that are implemented in the compiler. This patch implements them in the gofrontend, to support the upcoming update to 1.18. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/383514
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/internal/abi/abi.go35
-rw-r--r--libgo/go/runtime/proc.go11
-rw-r--r--libgo/libgo-packages.txt1
3 files changed, 42 insertions, 5 deletions
diff --git a/libgo/go/internal/abi/abi.go b/libgo/go/internal/abi/abi.go
new file mode 100644
index 00000000000..c4a108847ca
--- /dev/null
+++ b/libgo/go/internal/abi/abi.go
@@ -0,0 +1,35 @@
1// Copyright 2020 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package abi
6
7// FuncPC* intrinsics.
8//
9// CAREFUL: In programs with plugins, FuncPC* can return different values
10// for the same function (because there are actually multiple copies of
11// the same function in the address space). To be safe, don't use the
12// results of this function in any == expression. It is only safe to
13// use the result as an address at which to start executing code.
14
15// FuncPCABI0 returns the entry PC of the function f, which must be a
16// direct reference of a function defined as ABI0. Otherwise it is a
17// compile-time error.
18//
19// Implemented as a compile intrinsic.
20func FuncPCABI0(f any) uintptr {
21 // The compiler should remove all calls.
22 panic("FuncPCABI0")
23}
24
25// FuncPCABIInternal returns the entry PC of the function f. If f is a
26// direct reference of a function, it must be defined as ABIInternal.
27// Otherwise it is a compile-time error. If f is not a direct reference
28// of a defined function, it assumes that f is a func value. Otherwise
29// the behavior is undefined.
30//
31// Implemented as a compile intrinsic.
32func FuncPCABIInternal(f any) uintptr {
33 // The compiler should remove all calls.
34 panic("FuncPCABIInternal")
35}
diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go
index 05342905ff1..343f13b40f0 100644
--- a/libgo/go/runtime/proc.go
+++ b/libgo/go/runtime/proc.go
@@ -5,6 +5,7 @@
5package runtime 5package runtime
6 6
7import ( 7import (
8 "internal/abi"
8 "internal/cpu" 9 "internal/cpu"
9 "runtime/internal/atomic" 10 "runtime/internal/atomic"
10 "runtime/internal/sys" 11 "runtime/internal/sys"
@@ -4243,11 +4244,11 @@ func _GC() { _GC() }
4243func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } 4244func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() }
4244func _VDSO() { _VDSO() } 4245func _VDSO() { _VDSO() }
4245 4246
4246var _SystemPC = funcPC(_System) 4247var _SystemPC = abi.FuncPCABIInternal(_System)
4247var _ExternalCodePC = funcPC(_ExternalCode) 4248var _ExternalCodePC = abi.FuncPCABIInternal(_ExternalCode)
4248var _LostExternalCodePC = funcPC(_LostExternalCode) 4249var _LostExternalCodePC = abi.FuncPCABIInternal(_LostExternalCode)
4249var _GCPC = funcPC(_GC) 4250var _GCPC = abi.FuncPCABIInternal(_GC)
4250var _LostSIGPROFDuringAtomic64PC = funcPC(_LostSIGPROFDuringAtomic64) 4251var _LostSIGPROFDuringAtomic64PC = abi.FuncPCABIInternal(_LostSIGPROFDuringAtomic64)
4251 4252
4252// Called if we receive a SIGPROF signal. 4253// Called if we receive a SIGPROF signal.
4253// Called by the signal handler, may run during STW. 4254// Called by the signal handler, may run during STW.
diff --git a/libgo/libgo-packages.txt b/libgo/libgo-packages.txt
index 4fc8c843f02..f3097dc0a6a 100644
--- a/libgo/libgo-packages.txt
+++ b/libgo/libgo-packages.txt
@@ -113,6 +113,7 @@ image/internal/imageutil
113image/jpeg 113image/jpeg
114image/png 114image/png
115index/suffixarray 115index/suffixarray
116internal/abi
116internal/buildcfg 117internal/buildcfg
117internal/bytealg 118internal/bytealg
118internal/cfg 119internal/cfg