diff mbox series

[21/29] rust-target-config: Make target workaround generic

Message ID 20220805131252.3706794-21-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit ec15882fbf396de8d3a5921a3028850ba3fccc48
Headers show
Series [01/29] nativesdk: Clear TUNE_FEATURES | expand

Commit Message

Richard Purdie Aug. 5, 2022, 1:12 p.m. UTC
Ensure the 'target' data is set for both HOST and TARGET queries
as appropriate to work correctly in cross configurations.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/classes/rust-target-config.bbclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Peter Kjellerstedt Aug. 5, 2022, 2:47 p.m. UTC | #1
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Richard Purdie
> Sent: den 5 augusti 2022 15:13
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH 21/29] rust-target-config: Make target workaround generic
> 
> Ensure the 'target' data is set for both HOST and TARGET queries
> as appropriate to work correctly in cross configurations.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/classes/rust-target-config.bbclass | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/rust-target-config.bbclass b/meta/classes/rust-target-config.bbclass
> index bc6bd77abbf..b3c738f02a4 100644
> --- a/meta/classes/rust-target-config.bbclass
> +++ b/meta/classes/rust-target-config.bbclass
> @@ -290,6 +290,10 @@ llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}"
> 
>  def rust_gen_target(d, thing, wd, arch):
>      import json
> +
> +    build_sys = d.getVar('BUILD_SYS')
> +    target_sys = d.getVar('TARGET_SYS')
> +
>      sys = d.getVar('{}_SYS'.format(thing))
>      prefix = d.getVar('{}_PREFIX'.format(thing))
>      rustsys = d.getVar('RUST_{}_SYS'.format(thing))
> @@ -298,7 +302,9 @@ def rust_gen_target(d, thing, wd, arch):
>      cpu = "generic"
>      features = ""
> 
> -    if thing == "TARGET":
> +    # Need to apply the target tuning conssitently, only if the triplet applies to the target

Typo: conssitently -> consistently

> +    # and not in the native case
> +    if sys == target_sys and sys != build_sys:
>          abi = d.getVar('ABIEXTENSION')
>          cpu = llvm_cpu(d)
>          if bb.data.inherits_class('native', d):
> --
> 2.34.1

//Peter
diff mbox series

Patch

diff --git a/meta/classes/rust-target-config.bbclass b/meta/classes/rust-target-config.bbclass
index bc6bd77abbf..b3c738f02a4 100644
--- a/meta/classes/rust-target-config.bbclass
+++ b/meta/classes/rust-target-config.bbclass
@@ -290,6 +290,10 @@  llvm_cpu[vardepvalue] = "${@llvm_cpu(d)}"
 
 def rust_gen_target(d, thing, wd, arch):
     import json
+
+    build_sys = d.getVar('BUILD_SYS')
+    target_sys = d.getVar('TARGET_SYS')
+
     sys = d.getVar('{}_SYS'.format(thing))
     prefix = d.getVar('{}_PREFIX'.format(thing))
     rustsys = d.getVar('RUST_{}_SYS'.format(thing))
@@ -298,7 +302,9 @@  def rust_gen_target(d, thing, wd, arch):
     cpu = "generic"
     features = ""
 
-    if thing == "TARGET":
+    # Need to apply the target tuning conssitently, only if the triplet applies to the target
+    # and not in the native case
+    if sys == target_sys and sys != build_sys:
         abi = d.getVar('ABIEXTENSION')
         cpu = llvm_cpu(d)
         if bb.data.inherits_class('native', d):