aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2026-01-27 17:34:46 -0800
committerCherry Mui <cherryyz@google.com>2026-01-29 08:14:53 -0800
commit11722941452d04aa0364a5c6b60acffaa2776b1c (patch)
tree5832bb8f46f2d47c768c209a9947ff2dcd8aee64 /src/runtime
parent2bd7f15dd7423b6817939b199cd2c8032e3b79cc (diff)
downloadgo-11722941452d04aa0364a5c6b60acffaa2776b1c.tar.xz
runtime, cmd/link: store type descriptor length, not end
Storing the type descriptor length lets us save a relocation. It also avoids a problem for Darwin dynamic linking. For #6853 Fixes #77350 Change-Id: If5c94330fe10d75690325f3d0b0658060ef3eb2d Reviewed-on: https://go-review.googlesource.com/c/go/+/739681 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/symtab.go22
-rw-r--r--src/runtime/type.go5
2 files changed, 14 insertions, 13 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 5dbf7a9d31..1bd9a0c188 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -412,17 +412,17 @@ type moduledata struct {
findfunctab uintptr
minpc, maxpc uintptr
- text, etext uintptr
- noptrdata, enoptrdata uintptr
- data, edata uintptr
- bss, ebss uintptr
- noptrbss, enoptrbss uintptr
- covctrs, ecovctrs uintptr
- end, gcdata, gcbss uintptr
- types, etypedesc, etypes uintptr
- rodata uintptr
- gofunc uintptr // go.func.*
- epclntab uintptr
+ text, etext uintptr
+ noptrdata, enoptrdata uintptr
+ data, edata uintptr
+ bss, ebss uintptr
+ noptrbss, enoptrbss uintptr
+ covctrs, ecovctrs uintptr
+ end, gcdata, gcbss uintptr
+ types, typedesclen, etypes uintptr
+ rodata uintptr
+ gofunc uintptr // go.func.*
+ epclntab uintptr
textsectmap []textsect
itablinks []*itab
diff --git a/src/runtime/type.go b/src/runtime/type.go
index 893c79404e..c5262ccd0f 100644
--- a/src/runtime/type.go
+++ b/src/runtime/type.go
@@ -514,7 +514,7 @@ func moduleTypelinks(md *moduledata) []*_type {
}
// Allocate a very rough estimate of the number of types.
- ret := make([]*_type, 0, (md.etypedesc-md.types)/(2*unsafe.Sizeof(_type{})))
+ ret := make([]*_type, 0, md.typedesclen/(2*unsafe.Sizeof(_type{})))
td := md.types
@@ -522,7 +522,8 @@ func moduleTypelinks(md *moduledata) []*_type {
// cmd/link/internal/data.go createRelroSect in allocateDataSections.
td++
- for td < md.etypedesc {
+ etypedesc := md.types + md.typedesclen
+ for td < etypedesc {
// TODO: The fact that type descriptors are aligned to
// 0x20 does not make sense.
td = alignUp(td, 0x20)