Skip to content
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

Add thumbv6m-none-eabi and thumbv7em-none-eabihf support #2350

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions rust/platform/triple_mappings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ SUPPORTED_T2_PLATFORM_TRIPLES = [
"riscv32imc-unknown-none-elf",
"riscv64gc-unknown-none-elf",
"s390x-unknown-linux-gnu",
"thumbv6m-none-eabi",
"thumbv7em-none-eabi",
"thumbv7em-none-eabihf",
"thumbv8m.main-none-eabi",
"wasm32-unknown-unknown",
"wasm32-wasi",
Expand Down Expand Up @@ -213,7 +215,7 @@ _SYSTEM_TO_STDLIB_LINKFLAGS = {
"windows": ["advapi32.lib", "ws2_32.lib", "userenv.lib", "Bcrypt.lib"],
}

def cpu_arch_to_constraints(cpu_arch, *, system = None):
def cpu_arch_to_constraints(cpu_arch, *, system = None, abi = None):
"""Returns a list of contraint values which represents a triple's CPU.

Args:
Expand All @@ -229,7 +231,7 @@ def cpu_arch_to_constraints(cpu_arch, *, system = None):
plat_suffix = _CPU_ARCH_TO_BUILTIN_PLAT_SUFFIX[cpu_arch]

# Patch armv7e-m to mf if hardfloat abi is selected
if plat_suffix == "armv7e-m" and system == "eabihf":
if plat_suffix == "armv7e-m" and (system == "eabihf" or abi == "eabihf"):
plat_suffix = "armv7e-mf"

return ["@platforms//cpu:{}".format(plat_suffix)]
Expand Down Expand Up @@ -357,6 +359,7 @@ def triple_to_constraint_set(target_triple):
constraint_set += cpu_arch_to_constraints(
triple_struct.arch,
system = triple_struct.system,
abi = triple_struct.abi,
)
constraint_set += vendor_to_constraints(triple_struct.vendor)
constraint_set += system_to_constraints(triple_struct.system)
Expand Down
Loading