Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
all: add cgo support to the riscv port #36641
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:
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
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 <firstname.lastname@example.org>
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@example.com> Reviewed-by: Cherry Zhang <firstname.lastname@example.org>