Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] rust-target-config: fix target_features for vfpv3d16
@ 2023-08-02 20:07 Benjamin Bara
  2023-08-07 10:27 ` [OE-core] " Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Bara @ 2023-08-02 20:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Benjamin Bara

From: Benjamin Bara <benjamin.bara@skidata.com>

A build with vfpv3d16 (armv7at2hf-vfpv3d16) tune currently warns:
'+d16' is not a recognized feature for this target (ignoring feature)

This correlates with the supported target_features for arm[1].

With the now enabled features, rustc might use vdiv.f64 with register
d17, which leads to an illegal instruction on the given platform.

Therefore, adapt the features s.t. they correspond to the
armv7_unknown_linux_gnueabihf target[2].

[1] https://github.com/rust-lang/rust/blob/1.70.0/compiler/rustc_codegen_ssa/src/target_features.rs#L32
[2] https://github.com/rust-lang/rust/blob/1.70.0/compiler/rustc_target/src/spec/armv7_unknown_linux_gnueabihf.rs#L15

Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
---
 meta/classes-recipe/rust-target-config.bbclass | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index 21a56ede3e..7d3965ed2e 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -19,18 +19,22 @@ def llvm_features_from_tune(d):
     mach_overrides = d.getVar('MACHINEOVERRIDES')
     mach_overrides = frozenset(mach_overrides.split(':'))
 
+    if target_is_armv7(d):
+        f.append('+v7')
+
     if 'vfpv4' in feat:
         f.append("+vfp4")
-    if 'vfpv3' in feat:
+    if 'vfpv3' in feat or 'vfpv3d16' in feat:
         f.append("+vfp3")
-    if 'vfpv3d16' in feat:
-        f.append("+d16")
-
     if 'vfpv2' in feat or 'vfp' in feat:
         f.append("+vfp2")
+    if 'vfpv3d16' in feat:
+        f.append("-d32")
 
     if 'neon' in feat:
         f.append("+neon")
+    else:
+        f.append("-neon")
 
     if 'mips32' in feat:
         f.append("+mips32")
@@ -38,9 +42,6 @@ def llvm_features_from_tune(d):
     if 'mips32r2' in feat:
         f.append("+mips32r2")
 
-    if target_is_armv7(d):
-        f.append('+v7')
-
     if ('armv6' in mach_overrides) or ('armv6' in feat):
         f.append("+v6")
     if 'armv5te' in feat:

---
base-commit: b2594471209fafd45ea907371b5bd26df95ab2ac
change-id: 20230801-rust-vfpv3d16-a65080a9bcfa

Best regards,
-- 
Benjamin Bara <benjamin.bara@skidata.com>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-07 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02 20:07 [PATCH] rust-target-config: fix target_features for vfpv3d16 Benjamin Bara
2023-08-07 10:27 ` [OE-core] " Alexandre Belloni
2023-08-07 16:50   ` Benjamin Bara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox