diff mbox series

rust-target-config: Set elfv2 ABI for powerpc64 when using ppc64p9le tune

Message ID 20251023161522.994070-1-Deepesh.Varatharajan@windriver.com
State New
Headers show
Series rust-target-config: Set elfv2 ABI for powerpc64 when using ppc64p9le tune | expand

Commit Message

Deepesh Varatharajan Oct. 23, 2025, 4:15 p.m. UTC
From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>

For the powerpc64 machine with ppc64p9le tune, the supported ABI is elfv2
but the default elfv1 ABI is used and this causes link-time errors such as:

    ABI version 1 is not compatible with ABI version 2 output

To resolve this, the powerpc64 machine with ppc64p9le tune is updated
with elfv2 ABI otherwise, default to elfv1 ABI. This change ensures
consistent ABI behavior across LLVM and Rust builds.

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
---
 meta/classes-recipe/rust-target-config.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 0c7e3c0090..c462478dae 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -406,7 +406,11 @@  def rust_gen_target(d, thing, wd, arch):
     if "powerpc64le" in tspec['llvm-target']:
         tspec['llvm-abiname'] = "elfv2"
     if "powerpc64" in tspec['llvm-target']:
-        tspec['llvm-abiname'] = "elfv1"
+        defaulttune = d.getVar('DEFAULTTUNE') or ''
+        if 'ppc64p9le' in defaulttune:
+            tspec['llvm-abiname'] = "elfv2"
+        else:
+            tspec['llvm-abiname'] = "elfv1"
     tspec['vendor'] = "unknown"
     tspec['target-family'] = "unix"
     tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)