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, debug/elf: godefs creates incorrect C.struct on openbsd #4378

Closed
mikioh opened this issue Nov 13, 2012 · 3 comments

Comments

@mikioh
Copy link
Contributor

commented Nov 13, 2012

What steps will reproduce the problem?
1. On OpenBSD 5.2, run mkall.sh at syscall
2. go build syscall
3.

What is the expected output? What do you see instead?
no fails

Please use labels and text to provide additional information.
./ztypes_openbsd_amd64.go:100: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:102: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:104: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:108: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:110: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:117: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:118: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:119: duplicate field Rmx_expire
./ztypes_openbsd_amd64.go:351: duplicate field Expire
./ztypes_openbsd_amd64.go:352: duplicate field Expire
./ztypes_openbsd_amd64.go:119: too many errors
@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2012

Comment 1:

Had a quick look;
struct timespec {
        time_t  tv_sec;         /* seconds */
        long    tv_nsec;        /* and nanoseconds */
};
1. run go tool cgo -godefs openbsd.go and got;
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs openbsd.go
package syscall
type Timespec struct {
        Rmx_expire      int32
        Pad_cgo_0       [4]byte
        Tv_nsec int64
}
2. When we remove "#include <net/bpf.h>" line from openbsd.go, got;
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs openbsd.go
package syscall
type Timespec struct {
        Sec     int32
        Pad_cgo_0       [4]byte
        Nsec    int64
}
Funny. Perhaps we should have a look at debug/elf package.
% uname -a
OpenBSD vm.localhost 5.2 GENERIC.MP #10 amd64
% hg id
9b31d3f52fff+ tip

Attachments:

  1. openbsd.go (1056 bytes)
  2. cgo-godefs-debug-gcc.txt (113793 bytes)
@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2012

Comment 2:

P.S. Original motivation to generate z-files on OpenBSD is,
just needed for Go 1.1 because OpenBSD 5.1? .2 changed their 
ABI especially if_data in net/if.h and that breaks net.Interfaces API.
@mikioh

This comment has been minimized.

Copy link
Contributor Author

commented Nov 13, 2012

Comment 4:

Status changed to Duplicate.

Merged into issue #4107.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

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