]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: update runtime dependency list
authorCherry Mui <cherryyz@google.com>
Mon, 16 Dec 2024 22:06:35 +0000 (17:06 -0500)
committerCherry Mui <cherryyz@google.com>
Tue, 17 Dec 2024 02:19:39 +0000 (18:19 -0800)
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>
src/cmd/link/internal/ld/data.go

index b6eaf69ca48a95796c1b18c2627d854dfd5b1a45..5c4497cdd75b0f7172bfc4505be30514f90f3c1a 100644 (file)
@@ -55,17 +55,31 @@ 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
-               "internal/abi",         // used by reflectcall (and maybe more)
-               "internal/bytealg",     // for IndexByte
+               "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/cpu":         // for cpu features
+               "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, "runtime/internal/") && !strings.HasSuffix(pkg, "_test")
+       return (strings.HasPrefix(pkg, "runtime/internal/") || strings.HasPrefix(pkg, "internal/runtime/")) &&
+               !strings.HasSuffix(pkg, "_test")
 }
 
 // Estimate the max size needed to hold any new trampolines created for this function. This