Skip to content

openssl: add riscv64 support with perlasm assembly generation#2375

Open
monkey-jsun wants to merge 5 commits intogoogle:mainfrom
monkey-jsun:pr/openssl-riscv64
Open

openssl: add riscv64 support with perlasm assembly generation#2375
monkey-jsun wants to merge 5 commits intogoogle:mainfrom
monkey-jsun:pr/openssl-riscv64

Conversation

@monkey-jsun
Copy link
Copy Markdown

Add riscv64 to openssl build using a patched overlay tarball with
constants-linux-riscv64.bzl. Enable perlasm assembly generation
for riscv64 (same approach as x86_64/aarch64) using a relocatable
perl toolchain. Post-process perlasm output to fix non-PIC JAL
instructions for shared library linking.

Note this PR depends on #2374

Patch rules_rust 0.68.1 to support riscv64 as a host architecture:
- Add riscv64gc to supported linux architectures in triple.bzl
- Add riscv64gc-unknown-linux-gnu to SUPPORTED_PLATFORM_TRIPLES
  in crate_universe for generated BUILD files
- Register riscv64gc Rust toolchain with Rust 1.86.0
toolchains_llvm 1.6.0 does not support riscv64 as a host architecture.
Patch three files to add linux-riscv64:
- toolchain/internal/common.bzl: add (linux, riscv64) to SUPPORTED_TARGETS
- toolchain/internal/configure.bzl: add riscv64-unknown-linux-gnu target
  system name mapping
- toolchain/cc_toolchain_config.bzl: add linux-riscv64 toolchain config
  entry mirroring linux-aarch64

Also configure llvm.MODULE.bazel to use the system-installed clang-19
at /usr/lib/llvm-19 as the toolchain root for riscv64, since no
prebuilt LLVM distribution exists for riscv64 Linux host.
  _is_hermetic_or_exists needs to strip the %workspace% prefix before
checking path existence, so include dirs like lib64/ or arch-specific
c++/v1 are filtered out when they don't exist on the host. This
is a generic bug affecting any toolchain_root usage with absolute paths.
Patch aspect_bazel_lib to add linux_riscv64 platform support for the
expand_template toolchain.  Download prebuilt expand_template binary
from GitHub releases instead of requiring a local host build.
Add riscv64 to openssl build using a patched overlay tarball with
constants-linux-riscv64.bzl.  Enable perlasm assembly generation
for riscv64 (same approach as x86_64/aarch64) using a relocatable
perl toolchain.  Post-process perlasm output to fix non-PIC JAL
instructions for shared library linking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant