Skip to content

Add support for ppc64le architecture #3259

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

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rust/platform/triple.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def get_host_triple(repository_ctx, abi = None):
# Detect the host's cpu architecture

supported_architectures = {
"linux": ["aarch64", "x86_64", "s390x"],
"linux": ["aarch64", "x86_64", "s390x", "powerpc64le"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the host platform ever gonna be powerpc? I think the only changes you need are what was done in rust/platform/triple_mappings.bzl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the host platform is the platform the bazel binary is executed on. When attempting to utilize rules_rust and executing bazel on a ppc64le host, I did receive the failure message from _validate_cpu_architecture, causing the build to fail. Marking it as supported here seems necessary to avoid failure in that case.

"macos": ["aarch64", "x86_64"],
"windows": ["aarch64", "x86_64"],
}
Expand All @@ -129,6 +129,9 @@ def get_host_triple(repository_ctx, abi = None):
if arch == "amd64":
arch = "x86_64"

if arch == "ppc64le":
arch = "powerpc64le"

if "linux" in repository_ctx.os.name:
_validate_cpu_architecture(arch, supported_architectures["linux"])
return triple("{}-unknown-linux-{}".format(
Expand Down
2 changes: 1 addition & 1 deletion rust/platform/triple_mappings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX = {
"mipsel": None,
"powerpc": "ppc",
"powerpc64": None,
"powerpc64le": None,
"powerpc64le": "ppc64le",
"riscv32": "riscv32",
"riscv32imc": "riscv32",
"riscv64": "riscv64",
Expand Down
1 change: 1 addition & 0 deletions rust/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ DEFAULT_TOOLCHAIN_TRIPLES = {
"aarch64-apple-darwin": "rust_macos_aarch64",
"aarch64-pc-windows-msvc": "rust_windows_aarch64",
"aarch64-unknown-linux-gnu": "rust_linux_aarch64",
"powerpc64le-unknown-linux-gnu": "rust_linux_powerpc64le",
"s390x-unknown-linux-gnu": "rust_linux_s390x",
"x86_64-apple-darwin": "rust_macos_x86_64",
"x86_64-pc-windows-msvc": "rust_windows_x86_64",
Expand Down