[1.1] Backport riscv64 support into 1.1.x#3905
Merged
AkihiroSuda merged 9 commits intoopencontainers:release-1.1from Jun 28, 2023
CARV-ICS-FORTH:release-1.1-riscv64
Merged
[1.1] Backport riscv64 support into 1.1.x#3905AkihiroSuda merged 9 commits intoopencontainers:release-1.1from CARV-ICS-FORTH:release-1.1-riscv64
AkihiroSuda merged 9 commits intoopencontainers:release-1.1from
CARV-ICS-FORTH:release-1.1-riscv64
Conversation
AkihiroSuda
requested changes
Jun 16, 2023
Member
AkihiroSuda
left a comment
There was a problem hiding this comment.
Please use git cherry-pick -x
Author
Done. |
AkihiroSuda
approved these changes
Jun 17, 2023
Contributor
|
CI failure is being fixed in #3909. Once that one is merged, we need to rebase this PR. |
Member
|
Please rebase |
We do not use all the files from scripts, only seccomp.sh and lib.sh. This prevents unneeded rebuild of the image if e.g. scripts/release_build.sh has changed. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit d542ad6)
Dockerfile used to install libseccomp-dev packages for different architectures. This is no longer true since commit f30244e, which changed to cross-compiling libseccomp (so we can get a static library to link against). Thus, adding extra architectures is no longer needed. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 476aa18)
All we need is gcc, libc-dev, and binutils. In addition to that, crossbuild-essential installs g++, libstdc++-dev, and a bunch of perl packages and libraries which we do not need. This should speed up image building, as well as make it smaller. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit f0f1b5f)
LDFLAGS_COMMON are used from two places, so it makes sense to dedup. LDFLAGS_STATIC is a preparation for the next commit. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit f2f6e59)
1. Set to empty value by default. 2. Assume Linux (remove GOOS check, since we do not support other OSes). 3. Instead of using a "not-supported" list, use a "supported" list (as Go release notes usually say which platforms are supported). As of today, -buildmode=pie is supported for: * linux/386, linux/amd64, linux/arm, linux/arm64, and linux/ppc64le (since Go 1.6, see https://tip.golang.org/doc/go1.6#compiler) * linux/s390x (since Go 1.7, which adds the initial port) * linux/riscv64 (since Go 1.16, see https://tip.golang.org/doc/go1.16#riscv) NOTE this does not mean we support these architectures; it is merely a way to see if -buildmode=pie can be used. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit ab5c60d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 21e32d4)
It doesn't matter whether static or dynamic linking is used, runc always needs libcontainer/nsenter, which is written in C and thus requires cgo. Same is true for libcontainer/integration. In addition, contrib/pkg/seccompagent also needs cgo (if seccomp build tag is set), as it need to be linked against libseccomp C library. By default, cgo is disabled when cross-compiling, meaning that CGO_ENABLED=1 has to be set explicitly in such cases. In all other cases (e.g. other contrib binaries) we do not need cgo. Remove CGO_ENABLED=1 from GO_BUILD_STATIC (as it does not have anything to do with static linking), and add it to all targets that require it. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit dafcacb)
Co-authored-by: Kir Kolyshkin <kolyshkin@gmail.com> Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 1d7b297)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit a14cc40)
auto-merge was automatically disabled
June 28, 2023 19:35
Head branch was pushed to by a user without write access
Author
Done. |
AkihiroSuda
approved these changes
Jun 28, 2023
Member
|
Looks like this PR introduced a regression, and missed the follow-up fix from; - LDFLAGS_STATIC := -linkmode external -extldflags --static-pie
+ LDFLAGS_STATIC := -linkmode external -extldflags -static-pie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is necessary for running on RISC-V using K3s.
Many projects - including K3s - depend on runc 1.1.x, so waiting for a 2.0.x release and then porting to any changes introduced may probably be a much larger effort. This includes all changes done in #3446, which are really minimal but necessary to support the new architecture.
With this patch I have successfully compiled and run K3s on a RISC-V QEMU VM and have verified that I can create Pods.