aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-05-17 12:07:15 -0400
committerGopher Robot <gobot@golang.org>2024-05-23 02:32:19 +0000
commitff2070d9398aff1c44691a90761eb35ea3cd4601 (patch)
tree77cb849fc27f0348ca652dd162ae3fbf9346ee33 /src/cmd
parentfd1363240ac22583125d43d8e15f130f02a7659b (diff)
downloadgo-ff2070d9398aff1c44691a90761eb35ea3cd4601.tar.xz
runtime: move exit hooks into internal/runtime/exithook
This removes a //go:linkname usage in the coverage implementation. For #67401. Change-Id: I0602172c7e372a84465160dbf46d9fa371582fff Reviewed-on: https://go-review.googlesource.com/c/go/+/586259 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/noder/reader.go5
-rw-r--r--src/cmd/internal/objabi/pkgspecial.go1
2 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go
index 042d81bbcd..97865bbfb1 100644
--- a/src/cmd/compile/internal/noder/reader.go
+++ b/src/cmd/compile/internal/noder/reader.go
@@ -3720,10 +3720,13 @@ func (r *reader) needWrapper(typ *types.Type) {
return
}
+ // Special case: runtime must define error even if imported packages mention it (#29304).
+ forceNeed := typ == types.ErrorType && base.Ctxt.Pkgpath == "runtime"
+
// If a type was found in an imported package, then we can assume
// that package (or one of its transitive dependencies) already
// generated method wrappers for it.
- if r.importedDef() {
+ if r.importedDef() && !forceNeed {
haveWrapperTypes = append(haveWrapperTypes, typ)
} else {
needWrapperTypes = append(needWrapperTypes, typ)
diff --git a/src/cmd/internal/objabi/pkgspecial.go b/src/cmd/internal/objabi/pkgspecial.go
index 2925896bd8..3e99ce9224 100644
--- a/src/cmd/internal/objabi/pkgspecial.go
+++ b/src/cmd/internal/objabi/pkgspecial.go
@@ -44,6 +44,7 @@ var runtimePkgs = []string{
"runtime",
"internal/runtime/atomic",
+ "internal/runtime/exithook",
"runtime/internal/math",
"runtime/internal/sys",
"internal/runtime/syscall",