Navigation Menu

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

cmd/link: implement external linking for riscv64 #36739

Closed
4a6f656c opened this issue Jan 24, 2020 · 10 comments
Closed

cmd/link: implement external linking for riscv64 #36739

4a6f656c opened this issue Jan 24, 2020 · 10 comments
Labels
arch-riscv Issues solely affecting the riscv64 architecture. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@4a6f656c
Copy link
Contributor

There is currently no support for external linking on riscv64 - this is a tracking bug for adding support.

@gopherbot
Copy link

Change https://golang.org/cl/216258 mentions this issue: cmd/objdump: disable unsupported tests on riscv64

@gopherbot
Copy link

Change https://golang.org/cl/216259 mentions this issue: cmd/go: disable link syso test on linux/riscv64

@toothrot toothrot added the NeedsFix The path to resolution is known, but the work has not been done. label Jan 24, 2020
@toothrot toothrot added this to the Backlog milestone Jan 24, 2020
gopherbot pushed a commit that referenced this issue Jan 25, 2020
Updates #27532, #36738 and #36739.

Change-Id: If10031c6fd2c8ec2aa8c37f7edb148d8f26f8697
Reviewed-on: https://go-review.googlesource.com/c/go/+/216258
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
gopherbot pushed a commit that referenced this issue Jan 25, 2020
This test requires support for external linking, which does not currently
exist on linux/riscv64.

Updates #27532 and #36739

Change-Id: Ia0cdf69f1830b995f2882b47d1bc0be82c4b3039
Reviewed-on: https://go-review.googlesource.com/c/go/+/216259
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

Change https://golang.org/cl/216263 mentions this issue: test: adjust tests for riscv64

gopherbot pushed a commit that referenced this issue Jan 25, 2020
This disables some tests that are unsupported on riscv64 and adds support
for risc64 to test/nosplit.

Updates #27532, #36739 and #36765

Change-Id: I0a57797a05bc80236709fc240c0a0efb0ee0d16b
Reviewed-on: https://go-review.googlesource.com/c/go/+/216263
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@tklauser tklauser added the arch-riscv Issues solely affecting the riscv64 architecture. label Jan 28, 2020
@4a6f656c
Copy link
Contributor Author

I have external linking support implemented for linux/riscv64 - I'll attempt to get this cleaned up for the next development cycle:

$ ~/src/go/bin/go build -ldflags=-linkmode=external hello.go
$ ldd hello
        linux-vdso.so.1 (0x0000001555571000)
        libpthread.so.0 => /lib/riscv64-linux-gnu/libpthread.so.0 (0x000000155557a000)
        libc.so.6 => /lib/riscv64-linux-gnu/libc.so.6 (0x0000001555595000)
        /lib/ld-linux-riscv64-lp64d.so.1 (0x0000001555556000)
$ ./hello
Hello, World!

@xnox
Copy link

xnox commented May 29, 2020

I have external linking support implemented for linux/riscv64 - I'll attempt to get this cleaned up for the next development cycle:

$ ~/src/go/bin/go build -ldflags=-linkmode=external hello.go
$ ldd hello
        linux-vdso.so.1 (0x0000001555571000)
        libpthread.so.0 => /lib/riscv64-linux-gnu/libpthread.so.0 (0x000000155557a000)
        libc.so.6 => /lib/riscv64-linux-gnu/libc.so.6 (0x0000001555595000)
        /lib/ld-linux-riscv64-lp64d.so.1 (0x0000001555556000)
$ ./hello
Hello, World!

Do you have code for this somehwere? even if not clean?

@4a6f656c
Copy link
Contributor Author

@xnox - there is a commit on top of Go 1.14.2 here. This will need reworking somewhat for upstreaming, given the linker changes during the current development cycle (what is due to become Go 1.15).

@gopherbot
Copy link

Change https://golang.org/cl/243517 mentions this issue: cmd/link: add support for external linking on linux/riscv64

@gopherbot
Copy link

Change https://golang.org/cl/263797 mentions this issue: cmd/go: enable link syso test on linux/riscv64

gopherbot pushed a commit that referenced this issue Oct 21, 2020
Now that external linking is supported on linux/riscv64 (CL 243517),
re-enable the test previously disabled by CL 216259.

Updates #36739

Change-Id: I611548c587ca50f8bfab72c903ab0432e2b54198
Reviewed-on: https://go-review.googlesource.com/c/go/+/263797
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
@gopherbot
Copy link

Change https://golang.org/cl/274478 mentions this issue: doc/go1.16: document riscv64 port changes

nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

The existing filter [!exec:cc] skip is not sufficient in the case when
CC is deliberately set to a file not meant to be executed while building
the non cgo variant of Go
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

The existing filter [!exec:cc] skip is not sufficient in the case when
CC is deliberately set to a file not meant to be executed while building
the non cgo variant of Go
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

The existing filter [!exec:cc] skip is not sufficient in the case when
CC is deliberately set to a file not meant to be executed while building
the non cgo variant of Go
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in PATH
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in PATH
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 26, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in $PATH
nehaljwani added a commit to nehaljwani/go that referenced this issue Jan 27, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: golang#8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: golang#36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in $PATH
gopherbot pushed a commit that referenced this issue Jan 27, 2021
With CGO disabled, the test suite tries to run the following and fail:

CGO_ENABLED=0 go test -run=TestScript/link_syso_issue33139 cmd/go
go test proxy running at GOPROXY=http://127.0.0.1:38829/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/link_syso_issue33139 (0.01s)
        script_test.go:215:
            # Test that we can use the external linker with a host syso file that is
            # embedded in a package, that is referenced by a Go assembly function.
            # See issue 33139. (0.000s)
            # External linking is not supported on linux/ppc64.
            # See: #8912 (0.000s)
            # External linking is not supported on linux/riscv64.
            # See: #36739 (0.001s)
            > [linux] [riscv64] skip
            > cc -c -o syso/objTestImpl.syso syso/src/objTestImpl.c
            FAIL: testdata/script/link_syso_issue33139.txt:15:
                unexpected error starting command:
                        fork/exec /dev/null: permission denied

CC was set to /dev/null (during build) in the scenario mentioned above

This patch replaces [!exec:cc] with [!cgo] because we care about the
availability of the 'cc' builtin and not the 'cc' executable in $PATH

Change-Id: Ifbd2441f5f8e903ca3da213aba76f44c2e2eebab
GitHub-Last-Rev: 3b74378
GitHub-Pull-Request: #43912
Reviewed-on: https://go-review.googlesource.com/c/go/+/286633
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/321449 mentions this issue: test: re-enable test on riscv64 now that it supports external linking

gopherbot pushed a commit that referenced this issue May 20, 2021
Update #36739

Change-Id: I14ab2cd0e29966b9a2f992e8c3bcb415203e63e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/321449
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators May 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-riscv Issues solely affecting the riscv64 architecture. FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants