[all-commits] [llvm/llvm-project] 410c7e: [RISCV] Do not re-validate target ABI in AsmParser...
Alexander Richardson via All-commits
all-commits at lists.llvm.org
Wed Sep 16 23:01:25 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 410c7e42b81f4bcde4723a97014eaa4c0d21adb8
https://github.com/llvm/llvm-project/commit/410c7e42b81f4bcde4723a97014eaa4c0d21adb8
Author: Alexander Richardson <alexrichardson at google.com>
Date: 2026-09-17 (Thu, 17 Sep 2026)
Changed paths:
M lld/test/ELF/lto/riscv-target-abi.ll
M llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
M llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
M llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.h
M llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
Log Message:
-----------
[RISCV] Do not re-validate target ABI in AsmParser if already resolved by streamer (#223606)
Commit 105ff16f816f (https://github.com/llvm/llvm-project/pull/213410)
changed RISCVABI::computeTargetABI() to return Expected<ABI> and added
validation to RISCVAsmParser::onBeginOfFile() to report invalid
-target-abi flags with real source location in llvm-mc.
However, this broke LTO builds containing inline assembly (e.g. Android
riscv64 builds and downstream Rust in
https://github.com/rust-lang/rust/pull/162783). During LTO, LLD sets
TargetOptions.MCOptions.ABIName from the module's target-abi metadata
("lp64d"), while the linker's default TargetMachine subtarget lacks
"+d" (individual functions specify "+d" in target-features).
RISCVSubtarget handles this gracefully by emitting a diagnostic note
and falling back to lp64 for code generation. When inline assembly was
subsequently parsed, AsmPrinter::emitInlineAsm instantiated
RISCVAsmParser with a subtarget lacking "+d", causing onBeginOfFile() to
re-validate TargetOptions.ABIName and fail with a fatal error.
To fix this, skip the parser validation whenever the streamer has
already resolved an ABI. This preserves llvm-mc diagnostics on invalid
command-line flags while avoiding conflicting validation when assembling
inline asm during code generation.
This commit was created with the help of AI tools
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list