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

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

Hello,

This causes failures:

https://autobuilder.yoctoproject.org/typhoon/#/builders/151/builds/304/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/147/builds/301/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/148/builds/306/steps/13/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/145/builds/299/steps/12/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/154/builds/301/steps/13/logs/stdio

2023-08-04 17:28:45,215 - oe-selftest - INFO - ======================================================================
2023-08-04 17:28:45,215 - oe-selftest - INFO - FAIL: rust.RustSelfTestSystemEmulated.test_rust (subunit.RemotedTestCase)
2023-08-04 17:28:45,215 - oe-selftest - INFO - ----------------------------------------------------------------------
2023-08-04 17:28:45,215 - oe-selftest - INFO - testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/qemumips-tc/build/meta/lib/oeqa/selftest/cases/rust.py", line 293, in test_rust
    runCmd(cmd)
  File "/home/pokybuild/yocto-worker/qemumips-tc/build/meta/lib/oeqa/utils/commands.py", line 212, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, exc_output))
AssertionError: Command ' export PATH=/home/pokybuild/yocto-worker/qemumips-tc/build/build-st-3391980/tmp/work/mips32r2-poky-linux/rust/1.70.0-r0/recipe-sysroot-native/usr/bin:$PATH; export TARGET_VENDOR="-poky"; export PATH=/home/pokybuild/yocto-worker/qemumips-tc/build/build-st-3391980/tmp/work/mips32r2-poky-linux/rust/1.70.0-r0/recipe-sysroot-native/usr/bin/mips-poky-linux:/home/pokybuild/yocto-worker/qemumips-tc/build/build-st-3391980/tmp/hosttools:$PATH; export RUST_TARGET_PATH=/home/pokybuild/yocto-worker/qemumips-tc/build/build-st-3391980/tmp/work/mips32r2-poky-linux/rust/1.70.0-r0/rust-targets; export TEST_DEVICE_ADDR="192.168.7.2:12345"; cd /home/pokybuild/yocto-worker/qemumips-tc/build/build-st-3391980/tmp/work/mips32r2-poky-linux/rust/1.70.0-r0/rustc-1.70.0-src; python3 src/bootstrap/bootstrap.py test  --exclude compiler/rustc  --exclude compiler/rustc_interface/src/tests.rs  --exclude library/panic_abort  --exclude library/panic_unwind  --exclude library/test/src/stats/tests.rs  --exclude src/bootstrap/builder/tests.rs  --exclude src/doc/rustc  --exclude src/doc/rustdoc  --exclude src/doc/unstable-book  --exclude src/librustdoc  --exclude src/rustdoc-json-types  --exclude src/tools/compiletest/src/common.rs  --exclude src/tools/lint-docs  --exclude src/tools/rust-analyzer  --exclude src/tools/rustdoc-themes  --exclude src/tools/tidy  --exclude tests/assembly/asm/aarch64-outline-atomics.rs  --exclude tests/codegen/abi-main-signature-32bit-c-int.rs  --exclude tests/codegen/abi-repr-ext.rs  --exclude tests/codegen/abi-x86-interrupt.rs  --exclude tests/codegen/branch-protection.rs  --exclude tests/codegen/catch-unwind.rs  --exclude tests/codegen/cf-protection.rs  --exclude tests/codegen/enum-bounds-check-derived-idx.rs  --exclude tests/codegen/force-unwind-tables.rs  --exclude tests/codegen/intrinsic-no-unnamed-attr.rs  --exclude tests/codegen/issues/issue-103840.rs  --exclude tests/codegen/issues/issue-47278.rs  --exclude tests/codegen/issues/issue-73827-bounds-check-index-in-subexpr.rs  --exclude tests/codegen/lifetime_start_end.rs  --exclude tests/codegen/local-generics-in-exe-internalized.rs  --exclude tests/codegen/match-unoptimized.rs  --exclude tests/codegen/noalias-rwlockreadguard.rs  --exclude tests/codegen/non-terminate/nonempty-infinite-loop.rs  --exclude tests/codegen/noreturn-uninhabited.rs  --exclude tests/codegen/repr-transparent-aggregates-3.rs  --exclude tests/codegen/sse42-implies-crc32.rs  --exclude tests/codegen/thread-local.rs  --exclude tests/codegen/uninit-consts.rs  --exclude tests/pretty/raw-str-nonexpr.rs  --exclude tests/run-make  --exclude tests/run-make/cdylib-fewer-symbols/foo.rs  --exclude tests/run-make/doctests-keep-binaries/t.rs  --exclude tests/run-make-fulldeps  --exclude tests/run-make/issue-22131/foo.rs  --exclude tests/run-make/issue-36710/Makefile  --exclude tests/run-make/issue-47551  --exclude tests/run-make/pgo-branch-weights  --exclude tests/run-make/pgo-gen  --exclude tests/run-make/pgo-gen-lto  --exclude tests/run-make/pgo-indirect-call-promotion  --exclude tests/run-make/pgo-use  --exclude tests/run-make/pointer-auth-link-with-c/Makefile  --exclude tests/run-make/profile  --exclude tests/run-make/static-pie  --exclude tests/run-make/sysroot-crates-are-unstable  --exclude tests/run-make/target-specs  --exclude tests/rustdoc  --exclude tests/rustdoc/async-move-doctest.rs  --exclude tests/rustdoc/async-trait.rs  --exclude tests/rustdoc/auto-traits.rs  --exclude tests/rustdoc/check-source-code-urls-to-def.rs  --exclude tests/rustdoc/comment-in-doctest.rs  --exclude tests/rustdoc/const-generics/const-generics-docs.rs  --exclude tests/rustdoc/cross-crate-hidden-assoc-trait-items.rs  --exclude tests/rustdoc/cross-crate-hidden-impl-parameter.rs  --exclude tests/rustdoc/cross-crate-links.rs  --exclude tests/rustdoc/cross-crate-primitive-doc.rs  --exclude tests/rustdoc/doctest-manual-crate-name.rs  --exclude tests/rustdoc/edition-doctest.rs  --exclude tests/rustdoc/edition-flag.rs  --exclude tests/rustdoc/elided-lifetime.rs  --exclude tests/rustdoc/external-macro-src.rs  --ex
stdoc-ui/nocapture.rs  --exclude tests/rustdoc-ui/no-run-flag.rs  --exclude tests/rustdoc-ui/run-directory.rs  --exclude tests/rustdoc-ui/test-no_std.rs  --exclude tests/rustdoc-ui/test-type.rs  --exclude tests/rustdoc/unit-return.rs  --exclude tests/ui/abi/stack-probes-lto.rs  --exclude tests/ui/abi/stack-probes.rs  --exclude tests/ui/array-slice-vec/subslice-patterns-const-eval-match.rs  --exclude tests/ui/asm/x86_64/sym.rs  --exclude tests/ui/associated-type-bounds/fn-apit.rs  --exclude tests/ui/associated-type-bounds/fn-dyn-apit.rs  --exclude tests/ui/associated-type-bounds/fn-wrap-apit.rs  --exclude tests/ui/debuginfo/debuginfo-emit-llvm-ir-and-split-debuginfo.rs  --exclude tests/ui/drop/dynamic-drop.rs  --exclude tests/ui/empty_global_asm.rs  --exclude tests/ui-fulldeps/deriving-encodable-decodable-box.rs  --exclude tests/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs  --exclude tests/ui-fulldeps/deriving-global.rs  --exclude tests/ui-fulldeps/deriving-hygiene.rs  --exclude tests/ui-fulldeps/dropck_tarena_sound_drop.rs  --exclude tests/ui-fulldeps/empty-struct-braces-derive.rs  --exclude tests/ui-fulldeps/internal-lints/bad_opt_access.rs  --exclude tests/ui-fulldeps/internal-lints/bad_opt_access.stderr  --exclude tests/ui-fulldeps/internal-lints/default_hash_types.rs  --exclude tests/ui-fulldeps/internal-lints/diagnostics.rs  --exclude tests/ui-fulldeps/internal-lints/lint_pass_impl_without_macro.rs  --exclude tests/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs  --exclude tests/ui-fulldeps/internal-lints/query_stability.rs  --exclude tests/ui-fulldeps/internal-lints/rustc_pass_by_value.rs  --exclude tests/ui-fulldeps/internal-lints/ty_tykind_usage.rs  --exclude tests/ui-fulldeps/issue-14021.rs  --exclude tests/ui-fulldeps/lint-group-denied-lint-allowed.rs  --exclude tests/ui-fulldeps/lint-group-forbid-always-trumps-cli.rs  --exclude tests/ui-fulldeps/lint-pass-macros.rs  --exclude tests/ui-fulldeps/regions-mock-tcx.rs  --exclude tests/ui-fulldeps/rustc_encodable_hygiene.rs  --exclude tests/ui-fulldeps/session-diagnostic/enforce_slug_naming.rs  --exclude tests/ui/functions-closures/fn-help-with-err.rs  --exclude tests/ui/linkage-attr/issue-10755.rs  --exclude tests/ui/macros/restricted-shadowing-legacy.rs  --exclude tests/ui/process/nofile-limit.rs  --exclude tests/ui/process/process-panic-after-fork.rs  --exclude tests/ui/process/process-sigpipe.rs  --exclude tests/ui/simd/target-feature-mixup.rs  --exclude tests/ui/structs-enums/multiple-reprs.rs --doc --no-fail-fast --bless --target mips-poky-linux-gnu > summary.txt 2>&1;' returned non-zero exit status 1:


On 02/08/2023 22:07:54+0200, Benjamin Bara wrote:
> 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>
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#185433): https://lists.openembedded.org/g/openembedded-core/message/185433
> Mute This Topic: https://lists.openembedded.org/mt/100513507/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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

* Re: [OE-core] [PATCH] rust-target-config: fix target_features for vfpv3d16
  2023-08-07 10:27 ` [OE-core] " Alexandre Belloni
@ 2023-08-07 16:50   ` Benjamin Bara
  0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Bara @ 2023-08-07 16:50 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: openembedded-core, Benjamin Bara

Hi!

On Mon, 7 Aug 2023 at 12:27, Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
> This causes failures:
> https://autobuilder.yoctoproject.org/typhoon/#/builders/151/builds/304/steps/12/logs/stdio
> https://autobuilder.yoctoproject.org/typhoon/#/builders/147/builds/301/steps/12/logs/stdio
> https://autobuilder.yoctoproject.org/typhoon/#/builders/148/builds/306/steps/13/logs/stdio
> https://autobuilder.yoctoproject.org/typhoon/#/builders/145/builds/299/steps/12/logs/stdio
> https://autobuilder.yoctoproject.org/typhoon/#/builders/154/builds/301/steps/13/logs/stdio

Thank you for the pointers! I guess it would be good to have the content
of summary.txt in case of a failure? Anyways, as the failure occurs for
different targets and the only added "common piece of code" is the
"else" for "-neon", I will add an elif instead which additionally
checks for armv7.
This should leave the other targets as-is.

Thanks and best regards,
Benjamin


^ permalink raw reply	[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