Skip to content

cmd/compile: DWARF info for pointer types in go binaries don't have DW_AT_GOKIND populated correctly. #64231

@grantseltzer

Description

@grantseltzer

What version of Go are you using (go version)?

$ go version
1.21.4

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/home/vagrant/.cache/go-build'
GOENV='/home/vagrant/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/vagrant/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/vagrant/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build813777877=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Compiled a simple test program that has functions which take various parameter types. I then used llvm-dwarfdump ./simple-binary to read the DWARF output.

Some type's entries, such as *uint8 have the correct Go kind information:

0x00002ed2:   DW_TAG_pointer_type
                DW_AT_name      ("*uint8")
                DW_AT_type      (0x0000000000002e27 "uint8")
                DW_AT_GO_kind   (0x16)
                DW_AT_GO_runtime_type   (0x0000000000004bc0)

While others do not:

0x0001c46e:   DW_TAG_pointer_type
                DW_AT_name      ("*uint16")
                DW_AT_type      (0x00000000000030a2 "uint16")
                DW_AT_GO_kind   (0x00)
                DW_AT_GO_runtime_type   (0x0000000000004f40)

What did you expect to see?

The field with attribute DW_AT_GO_kind for every pointer type entry in DWARF to be populated with 0x16 (reflect.Pointer).

What did you see instead?

The field with attribute DW_AT_GO_kind for some pointer type entries in DWARF with the value 0.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions