Skip to content

Commit 1218566

Browse files
committed
cmd/link: update runtime dependency list
There have been a number of internal packages that the runtime package depends on. Update the list. We should stop using a hard- coded list. Change-Id: I6f9338d6690d955b8200f3301addd0e133a1bfe2 Reviewed-on: https://go-review.googlesource.com/c/go/+/636478 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
1 parent d92c34a commit 1218566

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

‎src/cmd/link/internal/ld/data.go

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,31 @@ import (
5555
)
5656

5757
// isRuntimeDepPkg reports whether pkg is the runtime package or its dependency.
58+
// TODO: just compute from the runtime package, and remove this hardcoded list.
5859
func isRuntimeDepPkg(pkg string) bool {
5960
switch pkg {
6061
case "runtime",
61-
"sync/atomic", // runtime may call to sync/atomic, due to go:linkname
62-
"internal/abi", // used by reflectcall (and maybe more)
63-
"internal/bytealg", // for IndexByte
62+
"sync/atomic", // runtime may call to sync/atomic, due to go:linkname // TODO: this is not true?
63+
"internal/abi", // used by reflectcall (and maybe more)
64+
"internal/asan",
65+
"internal/bytealg", // for IndexByte
66+
"internal/byteorder",
6467
"internal/chacha8rand", // for rand
65-
"internal/cpu": // for cpu features
68+
"internal/coverage/rtcov",
69+
"internal/cpu", // for cpu features
70+
"internal/goarch",
71+
"internal/godebugs",
72+
"internal/goexperiment",
73+
"internal/goos",
74+
"internal/msan",
75+
"internal/profilerecord",
76+
"internal/race",
77+
"internal/stringslite",
78+
"unsafe":
6679
return true
6780
}
68-
return strings.HasPrefix(pkg, "runtime/internal/") && !strings.HasSuffix(pkg, "_test")
81+
return (strings.HasPrefix(pkg, "runtime/internal/") || strings.HasPrefix(pkg, "internal/runtime/")) &&
82+
!strings.HasSuffix(pkg, "_test")
6983
}
7084

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

0 commit comments

Comments
 (0)