-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
all: add cgo support to the riscv port #36641
Comments
Change https://golang.org/cl/215838 mentions this issue: |
cgo is not currently supported on this platform. Updates #27532 and #36641 Change-Id: I4b35f887e869ebc5c156dd754b1c79897a8c5800 Reviewed-on: https://go-review.googlesource.com/c/go/+/215838 Reviewed-by: Cherry Zhang <[email protected]>
Is anyone actively working on this? We (Canonical) want it and may be able to spend some time on it (but maybe not very much). |
@mwhudson - I'm not aware of anyone currently working on this. The bigger issue/blocker is the lack of external (or internal cgo) linking support. Once that is implemented cgo should be reasonably straight forward. |
As this plugin needs cgo and riscv64 doesn't support. These changes are based on this Debian commit: https://salsa.debian.org/go-team/packages/containerd/-/commit/e3c6a7bb This is the upstream bug report: golang/go#36641
I have cgo working on linux/riscv64 - I'll attempt to get this cleaned up and ready for the next development cycle:
|
There is a branch here that adds cgo support for linux/riscv64 on Go 1.14.2. |
I've been testing it on some projects for a while and both runc (Container Runtime) and SQLite module for Go build and work fine. Runc only needed an adjust in the Makefile since it also uses buildmode=pie. I removed it and it built and worked perfectly. Amazing work @4a6f656c :) |
I think buildmode=pie support is just a matter of marking it as enabled in a few places: https://git.launchpad.net/~usd-import-team/ubuntu/+source/golang-1.14/commit/?h=applied/ubuntu/groovy-proposed&id=05db5462189beacd08bb3ac6bd2be2cf7e7fd9dd |
@carlosedp - thanks, glad to hear it. FWIW there is a commit on the top of https://github.com/4a6f656c/go/tree/riscv64-cgo that enables |
I've tested it by building |
Hi @4a6f656c , any news on upstreaming CGO/PIE support for the next Go release? I believe the 1.16 freeze starts in november. Thanks! |
The first step is to get external linking support - a review for that is currently pending: |
Change https://golang.org/cl/263477 mentions this issue: |
Change https://golang.org/cl/263478 mentions this issue: |
Change https://golang.org/cl/263598 mentions this issue: |
Change https://golang.org/cl/263601 mentions this issue: |
Backport patches from https://github.com/4a6f656c/go/commits/riscv64-cgo-1.15 for risc-v support for cgo. Upstreaming is also in progress via golang/go#36641. Signed-off-by: Ricardo Salveti <[email protected]>
The original riscv64 port used the thread pointer (TP aka X4) register for the g pointer, however this register is also used when TLS support is required, resulting in a conflict (for example, when a signal is received we have no way of readily knowing if X4 contains a pointer to the TCB or a pointer to a g). In order to support cgo, free up the X4 register by moving g to X27. This unfortunately means that the X4 register is unused in non-cgo mode, however the alternative is to not support cgo on this platform. Update #36641 Change-Id: Idcaf3e8ccbe42972a1b8943aeefde7149d9c960a Reviewed-on: https://go-review.googlesource.com/c/go/+/263477 Trust: Joel Sing <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Add support for Thread Local Storage (TLS) for linux/riscv64 with external linking, using the initial-exec model. Update #36641 Change-Id: I3106ef9a29cde73215830b00deff43dbec1c76e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/263478 Trust: Joel Sing <[email protected]> Run-TryBot: Joel Sing <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
Update #36641 Change-Id: I8618da30d8940a56d6cc86a37a2f54b31ee029e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/263601 Trust: Joel Sing <[email protected]> Reviewed-by: Cherry Zhang <[email protected]> Run-TryBot: Joel Sing <[email protected]> TryBot-Result: Go Bot <[email protected]>
Just a note to thank you for completing and closing this issue. It wouldn't compile in
which was the same error message I could repro with @4a6f656c sample I pulled the golang source, built master, and can confirm that cgo works fine on RISC-V and I was able to successfully compile the project. Thanks heaps for your hard work resolving this. |
Change https://golang.org/cl/274478 mentions this issue: |
For #36641 For #40700 Change-Id: Ib268559a2ce7839372dbf273d95876d8d4521a45 Reviewed-on: https://go-review.googlesource.com/c/go/+/274478 Trust: Tobias Klauser <[email protected]> Reviewed-by: Joel Sing <[email protected]> Reviewed-by: Austin Clements <[email protected]> Reviewed-by: Cherry Zhang <[email protected]>
The riscv port does not have support for cgo - this should be added at some point in the future (hence this tracking bug).
The text was updated successfully, but these errors were encountered: