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

gccgo, syscall: unknowndefine NLA_HDRLEN #13629

Closed
laboger opened this issue Dec 15, 2015 · 7 comments
Closed

gccgo, syscall: unknowndefine NLA_HDRLEN #13629

laboger opened this issue Dec 15, 2015 · 7 comments
Milestone

Comments

@laboger
Copy link
Contributor

@laboger laboger commented Dec 15, 2015

The definition for syscall NLA_HDRLEN is missing from gccgo in both trunk and the release 5 branch. This is the only one of the NLA_* syscall defines missing from gccgo. All of these syscall are correctly defined in golang master and go 1.5.x branch.

Testcase:

package main

import (
"fmt"
"syscall"
)

func main() {
fmt.Printf("NLA_HDRLEN: %x\n", syscall.NLA_HDRLEN)
fmt.Printf("NLA_F_NESTED: %x\n", syscall.NLA_F_NESTED)
fmt.Printf("NLA_F_NET_BYTEORDER: %x\n", syscall.NLA_F_NET_BYTEORDER)
fmt.Printf("NLA_ALIGNTO: %x\n", syscall.NLA_ALIGNTO)
}

With gccgo this error occurs:

error: reference to undefined identifier 'syscall.NLA_HDRLEN'
fmt.Printf("NLA_HDRLEN: %x\n", syscall.NLA_HDRLEN)

Testcase compiles correctly with golang.
Comment out the line with NLA_HDRLEN and the testcase compiles correctly with gccgo.

@ianlancetaylor ianlancetaylor added this to the Gccgo milestone Dec 15, 2015
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Dec 15, 2015

This needs the "Constants that may only be defined as expressions on some systems" treatment in libgo/mksysinfo.sh.

@laboger
Copy link
Contributor Author

@laboger laboger commented Dec 16, 2015

Thanks for the pointer, I'll try it.

@laboger
Copy link
Contributor Author

@laboger laboger commented Dec 16, 2015

https://go-review.googlesource.com/#/c/17893
I have done a test build to verify it fixes the problem, I am currently doing a bootstrap build and will update this when it is finished.

@laboger
Copy link
Contributor Author

@laboger laboger commented Dec 16, 2015

Testing complete.

clnperez added a commit to clnperez/runc that referenced this issue Dec 17, 2015
NLA_HDRLEN is not in gccgo (as of 5.3), so use a C library header
for now.

See golang/go#13629

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
clnperez added a commit to clnperez/runc that referenced this issue Dec 17, 2015
NLA_HDRLEN is not in gccgo (as of 5.3), so use a C library header
for now.

See golang/go#13629

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
clnperez added a commit to clnperez/runc that referenced this issue Dec 17, 2015
NLA_HDRLEN is not in gccgo (as of 5.3), so use a C library header
for now.

See golang/go#13629

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
@laboger
Copy link
Contributor Author

@laboger laboger commented Dec 17, 2015

I've uploaded the changes to mksysinfo.sh.

I was looking in the file sysinfo.go and I see there is also a constant named SizeofNlAttr. Shouldn't this always be the same value as NLA_HDRLEN? If so then I think the Docker folks could use syscall.SizeofNlAttr instead of syscall.NLA_HDRLEN and it should work for both gccgo and gc.

@laboger
Copy link
Contributor Author

@laboger laboger commented Dec 17, 2015

Never mind, I missed the alignment difference.

clnperez added a commit to clnperez/runc that referenced this issue Dec 17, 2015
syscall.NLA_HDRLEN is not in gccgo (as of 5.3), so in the meantime
use the #defines taken from linux/netlink.h.

See golang/go#13629

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Dec 18, 2015

CL was committed. Not sure why it didn't auto-close.

@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.