Description
What version of Go are you using (go version
)?
$ go version go version go1.17.9 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="" GOCACHE="/usr/local/google/home/paulkirth/.cache/go-build" GOENV="/usr/local/google/home/paulkirth/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/usr/local/google/home/paulkirth/workspace/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/usr/local/google/home/paulkirth/workspace/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/google/home/paulkirth/fuchsia/prebuilt/third_party/go/linux-x64" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/google/home/paulkirth/fuchsia/prebuilt/third_party/go/linux-x64/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.9" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" 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-build2852963211=/tmp/go-build -gno-record-gcc-switches"
What did you do?
When building Fuchsia we ran into a build error from cgo
from malformed DWARF tags.
What did you expect to see?
I expected the build to complete without error
What did you see instead?
build failure
cgo: malformed DWARF TagVariable entry
Fuchsia compiles using ToT LLVM. Recently, LLVM has made some changes to some of the DWARF it emits. In particular, the new change emits debug info for variables it didn't previously, and cgo fails when it encounters a DW_TAG_variable
that doesn't have a name, which is allowed by the DWARF standard.
Since this is legal in DWARF, the compiler should be able to handle the change to debug info.
You can find our failed build at: https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.arm64-debug/b8813791771110373825/overview
Unfortunately, I don't have a smaller reproducer. But this should become more common as other consumers of LLVM update their toolchains.
There is an ongoing discussion on the original change on Phabricator you can find here: https://reviews.llvm.org/D123534