aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal
diff options
context:
space:
mode:
authorAlessandro Arzilli <alessandro.arzilli@gmail.com>2024-01-24 18:10:47 +0100
committerCherry Mui <cherryyz@google.com>2024-01-30 14:41:56 +0000
commitb89ad464510e643c23df28bc5c181ad0a16773bf (patch)
tree57a1d775fce14015851a209d4d1671d1ae4c612d /src/cmd/link/internal
parent923ab13f9bb6fccc362d5259e2f456abbeda0c51 (diff)
downloadgo-b89ad464510e643c23df28bc5c181ad0a16773bf.tar.xz
cmd/link: add DW_AT_go_runtime_type to unsafe.Pointer and fix it for
uintptr Adds the DW_AT_go_runtime_type attribute to the debug_info entry for unsafe.Pointer (which is special) and fixes the debug_info entry of uintptr so that its DW_AT_go_runtime_type attribute has the proper class (it was accidentally using DW_CLS_ADDRESS instead of DW_CLS_GO_TYPEREF) Change-Id: I52e18593935fbda9bc425e849f4c7f50e9144ad4 Reviewed-on: https://go-review.googlesource.com/c/go/+/558275 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/cmd/link/internal')
-rw-r--r--src/cmd/link/internal/ld/dwarf.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/cmd/link/internal/ld/dwarf.go b/src/cmd/link/internal/ld/dwarf.go
index ee7eb266bc..f3296e1728 100644
--- a/src/cmd/link/internal/ld/dwarf.go
+++ b/src/cmd/link/internal/ld/dwarf.go
@@ -1754,12 +1754,13 @@ func dwarfGenerateDebugInfo(ctxt *Link) {
// Some types that must exist to define other ones (uintptr in particular
// is needed for array size)
- d.mkBuiltinType(ctxt, dwarf.DW_ABRV_BARE_PTRTYPE, "unsafe.Pointer")
- die := d.mkBuiltinType(ctxt, dwarf.DW_ABRV_BASETYPE, "uintptr")
- newattr(die, dwarf.DW_AT_encoding, dwarf.DW_CLS_CONSTANT, dwarf.DW_ATE_unsigned, 0)
- newattr(die, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, int64(d.arch.PtrSize), 0)
- newattr(die, dwarf.DW_AT_go_kind, dwarf.DW_CLS_CONSTANT, objabi.KindUintptr, 0)
- newattr(die, dwarf.DW_AT_go_runtime_type, dwarf.DW_CLS_ADDRESS, 0, dwSym(d.lookupOrDiag("type:uintptr")))
+ unsafeptrDie := d.mkBuiltinType(ctxt, dwarf.DW_ABRV_BARE_PTRTYPE, "unsafe.Pointer")
+ newattr(unsafeptrDie, dwarf.DW_AT_go_runtime_type, dwarf.DW_CLS_GO_TYPEREF, 0, dwSym(d.lookupOrDiag("type:unsafe.Pointer")))
+ uintptrDie := d.mkBuiltinType(ctxt, dwarf.DW_ABRV_BASETYPE, "uintptr")
+ newattr(uintptrDie, dwarf.DW_AT_encoding, dwarf.DW_CLS_CONSTANT, dwarf.DW_ATE_unsigned, 0)
+ newattr(uintptrDie, dwarf.DW_AT_byte_size, dwarf.DW_CLS_CONSTANT, int64(d.arch.PtrSize), 0)
+ newattr(uintptrDie, dwarf.DW_AT_go_kind, dwarf.DW_CLS_CONSTANT, objabi.KindUintptr, 0)
+ newattr(uintptrDie, dwarf.DW_AT_go_runtime_type, dwarf.DW_CLS_GO_TYPEREF, 0, dwSym(d.lookupOrDiag("type:uintptr")))
d.uintptrInfoSym = d.mustFind("uintptr")