You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
@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.
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!
The text was updated successfully, but these errors were encountered: