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 · 9 comments
Closed

cmd/link: implement external linking for riscv64 #36739

4a6f656c opened this issue Jan 24, 2020 · 9 comments

Comments

@4a6f656c
Copy link
Contributor

@4a6f656c 4a6f656c commented Jan 24, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 24, 2020

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

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 24, 2020

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

@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

@gopherbot gopherbot commented Jan 25, 2020

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>
@4a6f656c
Copy link
Contributor Author

@4a6f656c 4a6f656c commented May 18, 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!
@xnox
Copy link

@xnox 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

@4a6f656c 4a6f656c commented May 30, 2020

@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

@gopherbot gopherbot commented Jul 19, 2020

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

@gopherbot gopherbot closed this in 15eaa87 Oct 18, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Oct 20, 2020

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

@gopherbot gopherbot commented Dec 3, 2020

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants