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

Abierto
#166,578 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Rust
Estrellas
123k
Forks
16.6k
Merge medio
2 d 17 h
PR fusionados (30 d)
532

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rust-lang/rust

Todos los issues de rust-lang/rust

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.