diff mbox series

[meta-lts-mixins,scarthgap/rust,15/37] rust-target-config: set MIPS ABI in the target JSON

Message ID 8cce072b9d48e5171ac1b954f283dd5dda6f8f44.1789156653.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.98.1 | expand

Commit Message

Scott Murray Sept. 11, 2026, 8:13 p.m. UTC
From: WXbet <WXbet@proton.me>

rustc 1.96 (rust-lang/rust#153769) started rejecting MIPS target JSON
files that do not carry both an "abi" field and a matching "llvm-
abiname" field, aborting libstd-rs's do_compile with

  error: error loading target specification:
         invalid MIPS ABI name and `cfg(target_abi)` combination:
         ABI name: <empty>
         cfg(target_abi): <empty>

rust_gen_target() populates the target JSON from the DATA_LAYOUT /
TARGET_ENDIAN / ... varflags plus an arch-specific "abi" branch that
today only covers arm/armv7. On mips*/mipsel* neither "abi" nor
"llvm-abiname" is written, so rustc's stricter check fails.

Cover every MIPS tune shipped in meta/conf/machine/include/mips/
arch-mips.inc's AVAILTUNES:

  arch=mips / mipsel                      -> o32
  arch=mips64 / mips64el, ABIEXTENSION="" -> n64
  arch=mips64 / mips64el, ABIEXTENSION=n32 -> n32

Note that the mips64-o32 / mips64el-o32 tunes (o32 ABI on a 64-bit
MIPS CPU) get MIPSPKGSFX_BYTE="" from arch-mips.inc and therefore
TUNE_ARCH="mips[el]"; they fall into the 32-bit branch above.

Signed-off-by: WXbet <57314510+WXbet@users.noreply.github.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit 8042c1652f774434a0652ff28cd074ee7984d2b9)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/rust-target-config.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/classes-recipe/rust-target-config.bbclass b/classes-recipe/rust-target-config.bbclass
index 33280ed..351c2d5 100644
--- a/classes-recipe/rust-target-config.bbclass
+++ b/classes-recipe/rust-target-config.bbclass
@@ -421,6 +421,13 @@  def rust_gen_target(d, thing, wd, arch):
         elif fpu == "hard":
             tspec['abi'] = "eabihf"
             tspec['llvm-floatabi'] = "hard"
+    if arch in ["mips", "mipsel"]:
+        tspec['abi'] = "o32"
+        tspec['llvm-abiname'] = "o32"
+    elif arch in ["mips64", "mips64el"]:
+        mips_abi = "n32" if abi == "n32" else "n64"
+        tspec['abi'] = mips_abi
+        tspec['llvm-abiname'] = mips_abi
     tspec['default-uwtable'] = True
     tspec['dynamic-linking'] = True
     tspec['executables'] = True