diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-02-04 19:59:59 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-02-08 20:08:09 -0800 |
commit | 3ab49b1c822cf8c5748fa4de0ac970c948de6f8a (patch) | |
tree | 0696141de5cddb0755c91ff21befd313bf0b9e29 /libgo | |
parent | analyzer: Fix tests for glibc 2.35 [PR101081] (diff) | |
download | gcc-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.go | 35 | ||||
-rw-r--r-- | libgo/go/runtime/proc.go | 11 | ||||
-rw-r--r-- | libgo/libgo-packages.txt | 1 |
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 | |||
5 | package 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. | ||
20 | func 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. | ||
32 | func 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 @@ | |||
5 | package runtime | 5 | package runtime |
6 | 6 | ||
7 | import ( | 7 | import ( |
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() } | |||
4243 | func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } | 4244 | func _LostSIGPROFDuringAtomic64() { _LostSIGPROFDuringAtomic64() } |
4244 | func _VDSO() { _VDSO() } | 4245 | func _VDSO() { _VDSO() } |
4245 | 4246 | ||
4246 | var _SystemPC = funcPC(_System) | 4247 | var _SystemPC = abi.FuncPCABIInternal(_System) |
4247 | var _ExternalCodePC = funcPC(_ExternalCode) | 4248 | var _ExternalCodePC = abi.FuncPCABIInternal(_ExternalCode) |
4248 | var _LostExternalCodePC = funcPC(_LostExternalCode) | 4249 | var _LostExternalCodePC = abi.FuncPCABIInternal(_LostExternalCode) |
4249 | var _GCPC = funcPC(_GC) | 4250 | var _GCPC = abi.FuncPCABIInternal(_GC) |
4250 | var _LostSIGPROFDuringAtomic64PC = funcPC(_LostSIGPROFDuringAtomic64) | 4251 | var _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 | |||
113 | image/jpeg | 113 | image/jpeg |
114 | image/png | 114 | image/png |
115 | index/suffixarray | 115 | index/suffixarray |
116 | internal/abi | ||
116 | internal/buildcfg | 117 | internal/buildcfg |
117 | internal/bytealg | 118 | internal/bytealg |
118 | internal/cfg | 119 | internal/cfg |