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

x/sys: x/sys/unix doesn't work with gccgo on arm #23361

Closed
chripell opened this issue Jan 7, 2018 · 5 comments
Closed

x/sys: x/sys/unix doesn't work with gccgo on arm #23361

chripell opened this issue Jan 7, 2018 · 5 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@chripell
Copy link

chripell commented Jan 7, 2018

syscall_linux_arm_gccgo.go.gz

What version of Go are you using (go version)?

go version go1.8.3 gccgo (GCC) 7.2.1 20171128 linux/arm

Does this issue reproduce with the latest release?

yes with git HEAD version

What operating system and processor architecture are you using (go env)?

GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/chri/go"
GORACE=""
GOROOT="/usr"
GOTOOLDIR="/usr/lib/gcc/armv5tel-unknown-linux-gnueabi/7.2.1"
GCCGO="/usr/bin/gccgo"
GOARM=""
CC="/usr/bin/gcc"
GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build749168280=/tmp/go-build -gno-record-gcc-switches"
CXX="/usr/bin/g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

Tried to use golang.org/x/sys/unix in a simple test program. go builded it.

What did you expect to see?

Nothing, because it should build

What did you see instead?

/tmp/go-build003625631/golang.org/x/sys/libunix.a(go.o): In function golang_org_x_sys_unix.Seek': /home/chri/go/src/golang.org/x/sys/unix/syscall_linux_arm.go:51: undefined reference to golang_org_x_sys_unix.seek'
collect2: error: ld returned 1 exit status

The problem is that seek syscall (and a bunch of others) are implemented through a function defined in asm_linux_arm.s which calls into the runtime. I think the problem is that the assembler code is not compatible with gccgo (i.e. binutils) and also I doubt the function is implemented in the gccgo runtime because of the strange name syscall·seek(SB)

A quick fix is attached, I reimplemented the syscall in a gccgo friendly way. I doubt the allocation is a big performance problem (as noted in syscall_linux_arm.go). But I didn't want to touch existing files, so I just prepared the drop-in file I am attaching. If you think this is the right way to fix the problem, I can prepare a patch for review.

Thanks!

@gopherbot gopherbot modified the milestones: Unreleased, Gccgo Jan 7, 2018
@tklauser
Copy link
Member

tklauser commented Jan 8, 2018

/cc @ianlancetaylor

@gopherbot
Copy link

Change https://golang.org/cl/86755 mentions this issue: unix: restore gccgo support

@ianlancetaylor
Copy link
Contributor

CL 86755 was a good change, but I don't actually think it fixed this specific problem.

@ianlancetaylor ianlancetaylor reopened this Jan 9, 2018
@ianlancetaylor
Copy link
Contributor

@chripell Would you be willing to send in your change through Gerrit, as described at https://golang.org/doc/contribute.html? Otherwise someone can produce a new change; in general we can't look at your change if you haven't signed the CLA. Thanks.

@ianlancetaylor ianlancetaylor added the NeedsFix The path to resolution is known, but the work has not been done. label Feb 2, 2018
@gopherbot
Copy link

Change https://golang.org/cl/100076 mentions this issue: x/sys/unix: fix seek while compiling with gccgo under ARM

@golang golang locked and limited conversation to collaborators Mar 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants