rustup: llvm-tools: please package `llvm-extract`

オープン
#166,578 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
tooling

調査の方向性

Start by reading the llvm-tools component packaging and distribution configuration, then trace how its bundled LLVM utilities are selected and built. The issue asks to include upstream llvm-extract in that component; done means users receive a version-matched tool there. The issue names no specific files or tests, so first locate the component's packaging entry points and existing tool list.

索引モデルが issue の本文から書いたものです。

説明

A-dist-components C-enhancement T-bootstrap T-compiler

It is sometimes useful to inspect how particular Rust code looks after compilation.
However, there is a caveat: usually, one wants to focus on some specific function,
and not just view the entire resulting .s/.ll with all the functions that happen to be there.

There's https://crates.io/crates/cargo-show-asm that provides a nice user interface for that,
but currently this filtering is entirely textual.

While this works fine for visual observation,
the result is non-actionable, in so that it is not self-contained,
especially for LLVM IR (which is what this issue is specifically about),
since it contains only a single raw function,
with 'dangling' references to other functions, and attributes.
This snippet can not be copied as-is and e.g. put into godbolt.

There's llvm-extract upstream tool that solves this problem, takes an LLVM IR module,
and produces a valid LLVM IR with other functions definitions turned into declarations.

Requiring that tool to be user-provided is not optimal, because it is not hermetic and
there might be LLVM IR version mismatch between it and the rust-internal LLVM version.

There's a potential alternatice approach to use rustc-dev component + rustc_llvm crate,
but that would be nightly-only and again might break silently once LLVM version is changed.
(And i'm not sure if needed functionality is even exposed there).

Third option would be to use llvm-sys. Same concerns about version mismatch.
And it's a very heavy dependency...

So it would be quite convient if that tool could just be provided in llvm-tools component.

Thank you!

Refs. https://github.com/rust-lang/rust/issues/85658
Refs. https://github.com/pacak/cargo-show-asm/issues/509

主要言語
Rust
スター
123k
フォーク
16.6k
平均マージ
2日 17時間
マージ済み PR(30日)
532

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust のほかの issue

rust-lang/rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。