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

Aperta
#166,578 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Rust
Stelle
123k
Fork
16.6k
Merge medio
2g 17h
PR unite (30g)
532

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rust

Tutte le issue di rust-lang/rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.