Skip to content

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

Closed

Description

@chripell

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!

Activity

  1. modified the milestones: Unreleased, Gccgo on Jan 7, 2018
  2. tklauser commented on Jan 8, 2018

    @tklauser
    Member
  3. gopherbot commented on Jan 8, 2018

    @gopherbot
    Contributor

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

  4. ianlancetaylor commented on Jan 9, 2018

    @ianlancetaylor
    Contributor

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

  5. ianlancetaylor commented on Feb 2, 2018

    @ianlancetaylor
    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.

  6. added
    NeedsFixThe path to resolution is known, but the work has not been done.
    on Feb 2, 2018
  7. gopherbot commented on Mar 11, 2018

    @gopherbot
    Contributor

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

  8. locked and limited conversation to collaborators on Mar 12, 2019
  9. added 2 commits that reference this issue on Jun 7, 2024
    d38bf78
    c28acc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions