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 TUNSETIFF IOCTL const and others #11707

Closed
laboger opened this issue Jul 14, 2015 · 3 comments
Closed

gccgo, syscall: unknowndefine TUNSETIFF IOCTL const and others #11707

laboger opened this issue Jul 14, 2015 · 3 comments
Milestone

Comments

@laboger
Copy link
Contributor

laboger commented Jul 14, 2015

This problem was reported in gccgo from gcc 5 (latest branch) when built on ppc64le because the IOCTL constant value TUNSETIFF is not defined in gccgo, but is available in gc from golang 1.5 in the generated files zerrors_linux_ppc64.go and zerrors_linu_ppc64le.go.

In the gccgo build, I can see that HAVE_LINUX_IF_TUN_H is defined, which allows the correct include file for these defines to be found, but mksysinfo.sh does not appear to handle them correctly. Instead the gen-sysinfo.go file contains:

// unknowndefine TUNSETIFF _IOW('T', 202, int)

for this define and all the other TUNSET* constants.

Possibly because it is a macro defined in terms of another macro and mksysinfo.sh doesn't handle that case?

This same problem occurred months ago with other IOCTL constants TIOCS* and the fix was to add some lines to mksysinfo.sh to enable them to be generated. I don't know if this is the same kind of problem and could be solved the same way.

The request would be to add all the TUNSET* constants to gccgo in the gcc5 branch if possible.

@laboger
Copy link
Contributor Author

laboger commented Jul 14, 2015

My earlier comment about the define of HAVE_LINUX_IF_TUN_H was referring to powerpc64le-linux/libgo/config.h which is generated during the gccgo build.

@ianlancetaylor
Copy link
Contributor

mksysinfo.sh can handle macros defined in terms of macros. What it can't handle are macros that are defined as expressions more complex than the code in gcc/godump.c can parse. At least on my system the issue is that the TUNSET macros are defined using sizeof. Something like the earlier TIOCS* fix is what is required here.

@ianlancetaylor ianlancetaylor added this to the Gccgo milestone Jul 14, 2015
@gopherbot
Copy link

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

emsr pushed a commit to emsr/gcc that referenced this issue Jul 26, 2015
    
    During the gccgo build define constants from
    some header files are processed by mksysinfo.sh and
    added to syscall.go.  In some cases the constants
    are based on macros which are not processed
    correctly by mksysinfo.sh.  This adds the support
    to generate the correct values for the TUN* constants
    from linux/if_tun.h.
    
    Fixes golang/go#11707
    
    Reviewed-on: https://go-review.googlesource.com/12491


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226196 138bc75d-0d04-0410-961f-82ee72b054a4
pbeeler pushed a commit to SaberMod/GCC_SaberMod that referenced this issue Aug 4, 2015
    syscall:  Add ioctl consts from if_tun.h
    
    During the gccgo build define constants from
    some header files are processed by mksysinfo.sh and
    added to syscall.go.  In some cases the constants
    are based on macros which are not processed
    correctly by mksysinfo.sh.  This adds the support
    to generate the correct values for the TUN* constants
    from linux/if_tun.h.
    
    Fixes golang/go#11707
    
    Reviewed-on: https://go-review.googlesource.com/12491

    syscall:  Fix to libgo/mksysinfo.sh
    
    In a recent change to mksysinfo.sh, a space was missing on
    some lines which caused the libgo build to hang on some
    systems.  This corrects that problem.
    
    Fixes golang/go#11924
    
    Reviewed-on: https://go-review.googlesource.com/12835

    syscall:  RawSockaddr fix for ppc64, ppc64le
    
    The struct RawSockaddr contains a field Data which
    should be uint8 on ppc64 and ppc64le, but is declared
    as int8 in gccgo.  This change adds a two new files
    which contain the structure declaration for
    RawSockaddr, one with the correct types for for ppc64
    and ppc64le, and the other for non-ppc64 platforms.
    
    Fixes golang/go#11469
    
    Reviewed-on: https://go-review.googlesource.com/11946


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@226595 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Aug 5, 2016
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
    
    During the gccgo build define constants from
    some header files are processed by mksysinfo.sh and
    added to syscall.go.  In some cases the constants
    are based on macros which are not processed
    correctly by mksysinfo.sh.  This adds the support
    to generate the correct values for the TUN* constants
    from linux/if_tun.h.
    
    Fixes golang/go#11707
    
    Reviewed-on: https://go-review.googlesource.com/12491

From-SVN: r226196
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants