diff options
| author | Ian Lance Taylor <iant@golang.org> | 2025-11-02 20:04:57 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-11-04 16:38:08 -0800 |
| commit | 0e1bd8b5f17e337df0ffb57af03419b96c695fe4 (patch) | |
| tree | b21d1077f48a9ad29f8d59380777962bbac66a1a /src/runtime | |
| parent | 7347b54727519eecf693e9c10c504dc28611cbbf (diff) | |
| download | go-0e1bd8b5f17e337df0ffb57af03419b96c695fe4.tar.xz | |
cmd/link, runtime: don't store text start in pcHeader
The textStart field requires a relocation, the only relocation in pclntab.
And nothing uses it. So remove it. Replace it with a zero,
which can itself be removed at some point in coordination with Delve.
For #76038
Change-Id: I35675c0868c5d957bb375e40b804c516ae0300ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/717240
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/runtime2.go | 2 | ||||
| -rw-r--r-- | src/runtime/symtab.go | 25 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 3672b19f76..1deeb1244c 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -1009,7 +1009,7 @@ const ( type _func struct { sys.NotInHeap // Only in static data - entryOff uint32 // start pc, as offset from moduledata.text/pcHeader.textStart + entryOff uint32 // start pc, as offset from moduledata.text nameOff int32 // function name, as index into moduledata.funcnametab. args int32 // in/out args size diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go index 62ad8d1361..3a814cd203 100644 --- a/src/runtime/symtab.go +++ b/src/runtime/symtab.go @@ -374,13 +374,19 @@ func (f *_func) funcInfo() funcInfo { // pcHeader holds data used by the pclntab lookups. type pcHeader struct { - magic uint32 // 0xFFFFFFF1 - pad1, pad2 uint8 // 0,0 - minLC uint8 // min instruction size - ptrSize uint8 // size of a ptr in bytes - nfunc int // number of functions in the module - nfiles uint // number of entries in the file tab - textStart uintptr // base for function entry PC offsets in this module, equal to moduledata.text + magic uint32 // 0xFFFFFFF1 + pad1, pad2 uint8 // 0,0 + minLC uint8 // min instruction size + ptrSize uint8 // size of a ptr in bytes + nfunc int // number of functions in the module + nfiles uint // number of entries in the file tab + + // The next field used to be textStart. This is no longer stored + // as it requires a relocation. Code should use the moduledata text + // field instead. This unused field can be removed in coordination + // with Delve. + _ uintptr + funcnameOffset uintptr // offset to the funcnametab variable from pcHeader cuOffset uintptr // offset to the cutab variable from pcHeader filetabOffset uintptr // offset to the filetab variable from pcHeader @@ -618,10 +624,9 @@ func moduledataverify1(datap *moduledata) { // Check that the pclntab's format is valid. hdr := datap.pcHeader if hdr.magic != 0xfffffff1 || hdr.pad1 != 0 || hdr.pad2 != 0 || - hdr.minLC != sys.PCQuantum || hdr.ptrSize != goarch.PtrSize || hdr.textStart != datap.text { + hdr.minLC != sys.PCQuantum || hdr.ptrSize != goarch.PtrSize { println("runtime: pcHeader: magic=", hex(hdr.magic), "pad1=", hdr.pad1, "pad2=", hdr.pad2, - "minLC=", hdr.minLC, "ptrSize=", hdr.ptrSize, "pcHeader.textStart=", hex(hdr.textStart), - "text=", hex(datap.text), "pluginpath=", datap.pluginpath) + "minLC=", hdr.minLC, "ptrSize=", hdr.ptrSize, "pluginpath=", datap.pluginpath) throw("invalid function symbol table") } |
