Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
grantseltzer opened this issue Nov 17, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@grantseltzer
Copy link
Contributor

grantseltzer commented Nov 17, 2023

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.

@bcmills bcmills added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 17, 2023
@seankhliao seankhliao changed the title DWARF info for pointer types in go binaries don't have DW_AT_GOKIND populated correctly. cmd/compile: DWARF info for pointer types in go binaries don't have DW_AT_GOKIND populated correctly. Nov 17, 2023
@mknyszek
Copy link
Contributor

CC @golang/compiler

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 20, 2023
@mknyszek mknyszek added this to the Backlog milestone Nov 20, 2023
@thanm thanm self-assigned this Nov 20, 2023
@thanm
Copy link
Contributor

thanm commented Nov 20, 2023

I'll take a look at this later in the week.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/544315 mentions this issue: cmd/link/internal/ld: fix DWARF type DIE "go kind" bug for synthetic ptr types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants