SIGILL / LLVM ERROR from rustc when compiling to a x86_64 target that lacks SSE2 instructions
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- rust
調査の方向性
x86_64-unknown-none ターゲットを使用して rustc 1.73.0 上で poly1305 0.8.0 の失敗を再現し、rustc が表示するターゲット機能を調査します。まず auto_detect モジュールと既存の soft 実装から始めてください。SSE2 を持たないターゲットについて、soft 実装を選択するか、ターゲットがサポートされていないことを報告するかにかかわらず、明確でテスト済みの動作になっていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Steps to reproduce
$ cargo new --lib repro
$ cd repro
$ echo '#![no_std]' > src/lib.rs
$ cargo add [email protected]
$ rustup default 1.73.0
$ rustup target add x86_64-unknown-none
$ cargo b --target x86_64-unknown-none
error: could not compile `poly1305` (lib)
Caused by:
process didn't exit successfully: `$RUSTUP_TOOLCHAIN/bin/rustc (..)` (signal: 4, SIGILL: illegal instruction)
at some point I was able to get a "LLVM ERROR" message but I can't no longer reproduce that
after some digging it seems that the lack of SSE2 instructions in the x86_64-unknown-none is the problem:
$ rustup default nightly-2023-11-15
$ rustc -Z unstable-options --print target-spec-json --target x86_64-unknown-none | grep features
"features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float",
creating a custom target that adds back the sse2 feature makes the crate compile
$ rustc -Z unstable-options --print target-spec-json --target x86_64-unknown-none > x86_64.json
patch the JSON like this
--- before.json 2023-11-15 14:35:19.565448966 +0100
+++ x86_64.json 2023-11-15 14:35:10.115355396 +0100
@@ -5,8 +5,7 @@
"crt-objects-fallback": "false",
"data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"disable-redzone": true,
- "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float",
- "is-builtin": true,
+ "features": "-mmx,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2",
"linker": "rust-lld",
"linker-flavor": "gnu-lld",
"llvm-target": "x86_64-unknown-none-elf",
$ rustup component add rust-src
$ cargo b -j1 -Z build-std=core --target ./x86_64.json && echo OK
OK
keeping the -sse2 produces "LLVM ERROR: Access past stack top!"
perhaps the auto_detect module could use #[cfg(not(target_feature = "sse2"))] to skip the auto-detection and directly use the soft implementation? or you could add something like this:
#[cfg(not(target_feature = "sse2"))]
compile_error!("compilation targets without SSE2 instructions are not supported");
which is nicer than the SIGILL
for additional context ("why are you even using this target?"): I was looking for a built-in "OS agnostic" / no-std target for a no-std rustls demo (rustls/rustls PR1534) and tried x86_64-unknown-none and run into this and other problems. I ended up using a custom target for the demo but I figured I should still report what I found.
by the way, the sha2 has a similar problem with this target. Let me know if you think I should report a similar issue in the hashes repo.
- 主要言語
- Rust
- スター
- 39
- フォーク
- 23
- 平均マージ
- 1時間 57分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RustCrypto/universal-hashes のほかの issue
-
enhancement good first issue help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
RustCrypto/universal-hashes#320 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
RustCrypto/universal-hashes#133 · コメント 3 件 ·
RustCrypto/universal-hashes の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Docs: "Work with Codex from anywhere" page still claims Windows mobile support is "coming soon"オープンapp documentation remote windows-os
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
oxidecomputer/dendrite#380 ·
メンテナーはふだん 5 日以内に返信
-
area:cli bug good first issue priority:high
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信