diff mbox series

rust: handle softfp fpu

Message ID 20250821122655.14029-1-peter.marko@siemens.com
State New
Headers show
Series rust: handle softfp fpu | expand

Commit Message

Marko, Peter Aug. 21, 2025, 12:26 p.m. UTC
From: Peter Marko <peter.marko@siemens.com>

With TARGET_FPU set to "softfp" stdlib-rs fails with:
error: Error loading target specification: ARM targets must specify their float ABI. Run `rustc --print target-list` for a list of built-in targets

This fpu type is set for example for arm in file
meta/conf/machine/include/arm/feature-arm-vfp.inc
when TUNE_FEATURES do not contain "callconvention-hard",
e.g. when using tune
DEFAULTTUNE = "cortexa8"

Signed-off-by: Peter Marko <peter.marko@siemens.com>
---
 meta/classes-recipe/rust-target-config.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Jansa Aug. 21, 2025, 12:51 p.m. UTC | #1
On Thu, Aug 21, 2025 at 2:27 PM Peter Marko via lists.openembedded.org
<peter.marko=siemens.com@lists.openembedded.org> wrote:
>
> From: Peter Marko <peter.marko@siemens.com>
>
> With TARGET_FPU set to "softfp" stdlib-rs fails with:
> error: Error loading target specification: ARM targets must specify their float ABI. Run `rustc --print target-list` for a list of built-in targets
>
> This fpu type is set for example for arm in file
> meta/conf/machine/include/arm/feature-arm-vfp.inc
> when TUNE_FEATURES do not contain "callconvention-hard",
> e.g. when using tune
> DEFAULTTUNE = "cortexa8"
>
> Signed-off-by: Peter Marko <peter.marko@siemens.com>
> ---
>  meta/classes-recipe/rust-target-config.bbclass | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
> index cac6e90a9e..fc926fe778 100644
> --- a/meta/classes-recipe/rust-target-config.bbclass
> +++ b/meta/classes-recipe/rust-target-config.bbclass
> @@ -409,7 +409,7 @@ def rust_gen_target(d, thing, wd, arch):
>      if features != "":
>          tspec['features'] = features
>      fpu = d.getVar('TARGET_FPU')
> -    if fpu == "soft":
> +    if fpu in ["soft", "softfp"]:
>          tspec['llvm-floatabi'] = "soft"
>      elif fpu == "hard":
>          tspec['llvm-floatabi'] = "hard"

Does it really work now? Last time I've tried as mentioned in
https://lists.openembedded.org/g/openembedded-core/message/214843 it
was segfaulting a bit later as shown in:
https://git.openembedded.org/openembedded-core-contrib/commit/?h=jansa/master&id=36a4154e0dd28b6a7be53d622cea0254bfeeb4b5

"rust-target-config: handle softfp TARGET_FPU as soft" in jansa/master
branch https://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/master

rust was updated couple times since that 1.84.1, so maybe it was fixed
since then.

Regards,

>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#222233): https://lists.openembedded.org/g/openembedded-core/message/222233
> Mute This Topic: https://lists.openembedded.org/mt/114816317/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Marko, Peter Aug. 21, 2025, 1:13 p.m. UTC | #2
> -----Original Message-----
> From: Martin Jansa <martin.jansa@gmail.com>
> Sent: Thursday, August 21, 2025 14:51
> To: Marko, Peter (FT D EU SK BFS1) <Peter.Marko@siemens.com>
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core][PATCH] rust: handle softfp fpu
> 
> On Thu, Aug 21, 2025 at 2:27 PM Peter Marko via lists.openembedded.org
> <peter.marko=siemens.com@lists.openembedded.org> wrote:
> >
> > From: Peter Marko <peter.marko@siemens.com>
> >
> > With TARGET_FPU set to "softfp" stdlib-rs fails with:
> > error: Error loading target specification: ARM targets must specify their float
> ABI. Run `rustc --print target-list` for a list of built-in targets
> >
> > This fpu type is set for example for arm in file
> > meta/conf/machine/include/arm/feature-arm-vfp.inc
> > when TUNE_FEATURES do not contain "callconvention-hard",
> > e.g. when using tune
> > DEFAULTTUNE = "cortexa8"
> >
> > Signed-off-by: Peter Marko <peter.marko@siemens.com>
> > ---
> >  meta/classes-recipe/rust-target-config.bbclass | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-
> recipe/rust-target-config.bbclass
> > index cac6e90a9e..fc926fe778 100644
> > --- a/meta/classes-recipe/rust-target-config.bbclass
> > +++ b/meta/classes-recipe/rust-target-config.bbclass
> > @@ -409,7 +409,7 @@ def rust_gen_target(d, thing, wd, arch):
> >      if features != "":
> >          tspec['features'] = features
> >      fpu = d.getVar('TARGET_FPU')
> > -    if fpu == "soft":
> > +    if fpu in ["soft", "softfp"]:
> >          tspec['llvm-floatabi'] = "soft"
> >      elif fpu == "hard":
> >          tspec['llvm-floatabi'] = "hard"
> 
> Does it really work now? Last time I've tried as mentioned in
> https://lists.openembedded.org/g/openembedded-core/message/214843 it
> was segfaulting a bit later as shown in:
> https://git.openembedded.org/openembedded-core-
> contrib/commit/?h=jansa/master&id=36a4154e0dd28b6a7be53d622cea0254bfeeb4
> b5

Yes, we have tested this with a quick test in our machine's qemu and it did work with our rust application.
But we're just starting to migrate first rust app to this machine, so maybe there are some corner cases around we didn't get to yet.

Your references mention armv5 or marv7+neon+multilib, maybe there are some problems with those?
Especially the neon part may be problematic, we had to do some vfp tunes magic in llvm to solve segfaults with iwasm (on a different machine).

Peter

> 
> "rust-target-config: handle softfp TARGET_FPU as soft" in jansa/master
> branch https://git.openembedded.org/openembedded-core-
> contrib/log/?h=jansa/master
> 
> rust was updated couple times since that 1.84.1, so maybe it was fixed
> since then.
> 
> Regards,
> 
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#222233): https://lists.openembedded.org/g/openembedded-
> core/message/222233
> > Mute This Topic: https://lists.openembedded.org/mt/114816317/3617156
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> [martin.jansa@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
diff mbox series

Patch

diff --git a/meta/classes-recipe/rust-target-config.bbclass b/meta/classes-recipe/rust-target-config.bbclass
index cac6e90a9e..fc926fe778 100644
--- a/meta/classes-recipe/rust-target-config.bbclass
+++ b/meta/classes-recipe/rust-target-config.bbclass
@@ -409,7 +409,7 @@  def rust_gen_target(d, thing, wd, arch):
     if features != "":
         tspec['features'] = features
     fpu = d.getVar('TARGET_FPU')
-    if fpu == "soft":
+    if fpu in ["soft", "softfp"]:
         tspec['llvm-floatabi'] = "soft"
     elif fpu == "hard":
         tspec['llvm-floatabi'] = "hard"