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/cgo: does not recognize DW_AT_specification generated by GCC 6 #13344

Closed
ianlancetaylor opened this issue Nov 20, 2015 · 1 comment

Comments

@ianlancetaylor
Copy link
Contributor

commented Nov 20, 2015

The future GCC 6 is making heavier use of DW_AT_specification, which cgo does not understand. This was reported against gccgo as https://gcc.gnu.org/PR68072, but it is a general Go problem. Filing this here to consider adding the patch (which I will send out momentarily) to Go 1.5.2.

The bug can occur in various ways, but the simplest is when there is both an external declaration for a variable and a real declaration, as in

// extern int i;
// int i;
import "C"

Of course in practice the extern int i; would be in a header file. GCC 6 now generates a DW_AT_specification pointing from one declaration to the other. (This is part of the early debug work described at https://gcc.gnu.org/wiki/early-debug .) The cgo tool sees a variable entry that uses DW_AT_specification, an entry that has no name or type, and issues a "malformed DWARF TagVariable entry" error.

@ianlancetaylor ianlancetaylor self-assigned this Nov 20, 2015

@ianlancetaylor ianlancetaylor added this to the Go1.5.2 milestone Nov 20, 2015

@gopherbot

This comment has been minimized.

Copy link

commented Nov 20, 2015

CL https://golang.org/cl/17151 mentions this issue.

ianlancetaylor added a commit that referenced this issue Nov 23, 2015
[release-branch.go1.5] cmd/cgo: ignore vars with no name or type if t…
…hey have a AttrSpecification

Fixes #13344.

Change-Id: I33c6721fd33d144c85c87840ddf27ce15aa72328
Reviewed-on: https://go-review.googlesource.com/17151
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/17145
Reviewed-by: Ian Lance Taylor <iant@golang.org>

@golang golang locked and limited conversation to collaborators Nov 27, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.