Summary
WebAssemblyAsmPrinter::EmitFunctionAttributes reads V->getOperand(0) on the llvm.global.annotations
global without checking that it has an initializer. When that global is a DECLARATION (no initializer) —
which happens in llvm-split output pieces (the annotations global lands in ONE partition and is a bare
declaration in the others) — getOperand(0) dereferences past the (empty) operand list and SIGSEGVs the
compiler.
Reproduce (no artifact needed)
Compile, for the wasm32 target, a module in which llvm.global.annotations is a declaration — e.g. any
piece produced by llvm-split of a module that carries annotations. Or by inspection:
EmitFunctionAttributes touches V->getOperand(0) unconditionally.
Fix
A declaration-only annotations global carries no annotations to emit, so early-return before touching the operand list:
// llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp — EmitFunctionAttributes
+ if (!V->hasInitializer())
+ return;
const ConstantArray *CA = cast<ConstantArray>(V->getOperand(0));
(We also added dyn_cast guards on the downstream casts for robustness.)
Proposed fix targets brintos/llvm-project only — no distro submodule pins moved. All distros share one
lineage, so pin bumps are coordinated on merge, not per-engineer.