aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2025-11-25 22:44:11 -0800
committerGopher Robot <gobot@golang.org>2026-01-27 13:47:14 -0800
commit481ab86aafe0cac177df793c9946c5ef2126137c (patch)
treedbe3504b8dae8baaf51c933b57b62503db98d356 /src/cmd/compile/internal
parent251f3aa6ee6fc3925fe8e64cd4b403bfa73b93ab (diff)
downloadgo-481ab86aafe0cac177df793c9946c5ef2126137c.tar.xz
cmd/link, runtime: remove typelinks
Instead of adding a typelinks section to a Go binary, mark the start and end of the typelinked type descriptors. The runtime can then step through the descriptors to find them all, rather than relying on the extra linker-generated offset list. The runtime steps through the type descriptors lazily, as many Go programs don't need the typelinks list at all. This reduces the size of cmd/go by 15K bytes, which isn't much but it's not nothing. A future CL will change the reflect package to use the type pointers directly rather than converting to offsets and then back to type pointers. For #6853 Change-Id: Id0af4ce81c5b1cea899fc92b6ff9d2db8ce4c267 Reviewed-on: https://go-review.googlesource.com/c/go/+/724261 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/compile/internal')
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 324007ea79..8a2b15ab24 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -756,6 +756,9 @@ func writeType(t *types.Type) *obj.LSym {
// | method list, if any | dextratype
// +--------------------------------+ - E
+ // runtime.moduleTypelinks is aware of this type layout,
+ // and must be changed if the layout change.
+
// UncommonType section is included if we have a name or a method.
extra := t.Sym() != nil || len(methods(t)) != 0