Skip to content

cmd/go/internal/load,cmd/link/internal/ld: use objabi.LookupPkgSpecial(pkg).Runtime #72806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cmd/go/internal/load/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package load

import (
"bytes"
"cmd/internal/objabi"
"context"
"encoding/json"
"errors"
Expand Down Expand Up @@ -3561,7 +3562,7 @@ func SelectCoverPackages(roots []*Package, match []func(*Package) bool, op strin
// $GOROOT/src/internal/coverage/pkid.go dealing with
// hard-coding of runtime package IDs.
cmode := cfg.BuildCoverMode
if cfg.BuildRace && p.Standard && p.ImportPath == "runtime" {
if cfg.BuildRace && p.Standard && objabi.LookupPkgSpecial(p.ImportPath).Runtime {
cmode = "regonly"
}

Expand Down
24 changes: 1 addition & 23 deletions src/cmd/link/internal/ld/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,8 @@ import (
)

// isRuntimeDepPkg reports whether pkg is the runtime package or its dependency.
// TODO: just compute from the runtime package, and remove this hardcoded list.
func isRuntimeDepPkg(pkg string) bool {
switch pkg {
case "runtime",
"sync/atomic", // runtime may call to sync/atomic, due to go:linkname // TODO: this is not true?
"internal/abi", // used by reflectcall (and maybe more)
"internal/asan",
"internal/bytealg", // for IndexByte
"internal/byteorder",
"internal/chacha8rand", // for rand
"internal/coverage/rtcov",
"internal/cpu", // for cpu features
"internal/goarch",
"internal/godebugs",
"internal/goexperiment",
"internal/goos",
"internal/msan",
"internal/profilerecord",
"internal/race",
"internal/stringslite",
"unsafe":
return true
}
return strings.HasPrefix(pkg, "internal/runtime/") && !strings.HasSuffix(pkg, "_test")
return objabi.LookupPkgSpecial(pkg).Runtime
}

// Estimate the max size needed to hold any new trampolines created for this function. This
Expand Down