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: RawSockaddr struct field Data should be uint8 instead of int8 for ppc64le #11469

Closed
laboger opened this issue Jun 29, 2015 · 3 comments
Assignees
Milestone

Comments

@laboger
Copy link
Contributor

@laboger laboger commented Jun 29, 2015

The declaration for the struct RawSockaddr in gccgo from gcc5 branch when used on ppc64le does not match what is provided in golang for go 1.5. Since they should be using the same syscalls on the ppc64le platform, the data structures should be the same. Having different declarations in the two compilers is preventing some source code from building successfully with both compilers.

From gccgo in libgo/go/syscall/socket_linux.go:

type RawSockaddr struct {
Family uint16
Data [14]int8
}

In golang for go 1.5 on ppc64le, the generated ztypes_linux_ppc64le.go contains this:

type RawSockaddr struct {
Family uint16
Data [14]uint8
}

My understanding is that the original C header file that these are generated from is sys/socket.h and has Data declared as a char, which on ppc64le should be an unsigned 8 bit integer. Based on that, the declaration provided in golang for go 1.5 on ppc64le is correct but incorrect for gccgo from gcc 5.0 using go 1.4.2.

I suspect we don't want to just change the declaration in socket_linux.go in gccgo because it is not the same for all platforms.

@bradfitz bradfitz added this to the Go1.5 milestone Jun 29, 2015
@bradfitz bradfitz assigned ianlancetaylor and rsc and unassigned ianlancetaylor Jun 29, 2015
@laboger
Copy link
Contributor Author

@laboger laboger commented Jul 8, 2015

I created a fix for this, bootstrap built and tested on ppc64le with gccgo from the gcc5 branch.

https://go-review.googlesource.com/11946

@laboger
Copy link
Contributor Author

@laboger laboger commented Jul 8, 2015

As I explain above, I don't think this is a bug in go 1.5 for ppc64le, but a bug in gccgo for ppc64le.

@bradfitz bradfitz assigned ianlancetaylor and unassigned rsc Jul 8, 2015
@ianlancetaylor ianlancetaylor modified the milestones: Gccgo, Go1.5 Jul 10, 2015
@gopherbot
Copy link

@gopherbot gopherbot commented Jul 22, 2015

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

vries pushed a commit to vries/gcc that referenced this issue Aug 3, 2015
    
    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/trunk@226533 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
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
5 participants
You can’t perform that action at this time.