Skip to content

debug/dwarf: incorrect runtime.newproc DIE in .zdebug_info #53802

Description

@jschwinger233

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

$ go version
go version go1.18.3 linux/amd64

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="amd64"
GOBIN="/home/gray//bin"
GOCACHE="/home/gray/.cache/go-build"
GOENV="/home/gray/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/gray/pkg/mod"
GONOPROXY="git.insea.io"
GONOSUMDB="git.insea.io"
GOOS="linux"
GOPATH="/home/gray/"
GOPRIVATE="git.insea.io"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/gray/src/proving_grounds/go_hello_world/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2957214737=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Build a hello world:

package main

import "fmt"

func main() {
    fmt.Println("hello world")
}

Then check the runtime.newproc entry in .zdebug_info

$ objdump -Wi ./go_hello_world | grep 'runtime.newproc$' -A2
    <4196c>   DW_AT_name        : runtime.newproc
    <4197c>   DW_AT_low_pc      : 0x43a9a0
    <41984>   DW_AT_high_pc     : 0x43aa19
--
    <524a7>   DW_AT_name        : runtime.newproc
    <524b7>   DW_AT_low_pc      : 0x45cea0
    <524bf>   DW_AT_high_pc     : 0x45cecf

There are 2 different DIE for runtime.newproc, but only the first one is correct.

The second entry is actually for runtime.newproc.abi0, and we can tell it from the .symtab, but the dwarf emitter made mistakes:

$ nm ./go_hello_world | grep runtime.newproc
000000000043a9a0 T runtime.newproc
000000000043aaa0 T runtime.newproc1
000000000045cea0 T runtime.newproc.abi0
000000000043aa20 T runtime.newproc.func1
000000000054ef1c B runtime.newprocs

What did you expect to see?

I expected to see the only one entry for runtime.newproc.

What did you see instead?

I saw 2 different entries for runtime.newproc, in which one entry should have been runtime.newproc.abi0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone 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

    Status
    Triage Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions