`global_asm!` issues LLVM error "undefined temporary symbol" for non-existent numerical labels
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I've found that if I place undefined local numeric labels in a global_asm! block, that rustc will yield an LLVM (?) error error: Undefined temporary symbol .Ltmp0, presumably as the numeric label is replaced with a temporary symbol .Ltmp0.
Here's a minimum viable example:
use std::arch::global_asm;
fn main () {}
global_asm!(
"jmp 100f"
);
(Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ddb9a35af1ac6a0c4d3a145253605252)
Notably, changing the label to a (global) text label as in the following doesn't cause any error to be issued.
use std::arch::global_asm;
fn main () {}
global_asm!(
"jmp .label"
);
I wasn't sure if this is something that would fall into the purview of Rust to handle with a more direct error message, but wanted to raise it as a potential issue since I'd expect either (a) no error message as in the case of the global label or (b) a typical rustc error message indicating where in the code the issue lies.
Meta
rustc --version --verbose:
rustc 1.85.1 (4eb161250 2025-03-15)
binary: rustc
commit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181
commit-date: 2025-03-15
host: x86_64-unknown-linux-gnu
release: 1.85.1
LLVM version: 19.1.7
Also verified with nightly:
rustc 1.88.0-nightly (d6c1e454a 2025-04-21)
binary: rustc
commit-hash: d6c1e454aa8af5e7e59fbf5c4e7d3128d2f99582
commit-date: 2025-04-21
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal global_asm! example using jmp 100f, then compare its undefined temporary symbol diagnostic with the .label case. Trace how undefined numeric labels are handled during compilation and make the failure report the source location through a normal rustc diagnostic, or otherwise match the stated expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100