[llvm] [ms] [llvm-ml] Add support for `@CatStr` built-in function symbol (PR #130781)

Antonin Décimo via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 19 12:45:55 PDT 2025


MisterDA wrote:

This macro crashes the assembler:

```asm
        index_a = 0
SubstitutionMacro MACRO field:REQ
        EXITM @CatStr(<[r14+>, %(my_struct_&field), <*8]>)
ENDM

        .CODE
        mov SubstitutionMacro(a), r15
        END
```

It seems that the `+` and `*` operands have disappeared. Maybe there's just an off-by-one error, or a token that's been erroneously consumed.

``` console
$ llvm-project/build/bin/llvm-ml -m64 -nologo -c -Fo test.obj test.asm
Included from <instantiation>:2:
<instantiation>:1:1: error: unable to parse text item in 'EXITM' directive
r14%(my_struct_a)8
^
test.asm:7:13: note: while in macro instantiation
        mov SubstitutionMacro(a), r15
            ^
Assertion failed: (EndStatementAtEOFStack.empty()), function Lex, file MasmParser.cpp, line 1193.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /Users/user/llvm-project/build/bin/llvm-ml -m64 -nologo -c -Fo test.obj test.asm
 #0 0x0000000100fca168 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/user/llvm-project/build/bin/llvm-ml+0x1006aa168)
 #1 0x0000000100fc88b0 llvm::sys::RunSignalHandlers() (/Users/user/llvm-project/build/bin/llvm-ml+0x1006a88b0)
 #2 0x0000000100fca8f0 SignalHandler(int, __siginfo*, void*) (/Users/user/llvm-project/build/bin/llvm-ml+0x1006aa8f0)
 #3 0x0000000192b9ade4 (/usr/lib/system/libsystem_platform.dylib+0x180482de4)
 #4 0x0000000192b63f70 (/usr/lib/system/libsystem_pthread.dylib+0x18044bf70)
 #5 0x0000000192a70908 (/usr/lib/system/libsystem_c.dylib+0x180358908)
 #6 0x0000000192a6fc1c (/usr/lib/system/libsystem_c.dylib+0x180357c1c)
 #7 0x0000000100f682a0 (anonymous namespace)::MasmParser::Lex((anonymous namespace)::MasmParser::ExpandKind) (.cold.6) (/Users/user/llvm-project/build/bin/llvm-ml+0x1006482a0)
 #8 0x0000000100f5bd9c (anonymous namespace)::MasmParser::Lex((anonymous namespace)::MasmParser::ExpandKind) (/Users/user/llvm-project/build/bin/llvm-ml+0x10063bd9c)
 #9 0x0000000100ab99a0 (anonymous namespace)::X86AsmParser::parseInstruction(llvm::ParseInstructionInfo&, llvm::StringRef, llvm::SMLoc, llvm::SmallVectorImpl<std::__1::unique_ptr<llvm::MCParsedAsmOperand, std::__1::default_delete<llvm::MCParsedAsmOperand>>>&) (/Users/user/llvm-project/build/bin/llvm-ml+0x1001999a0)
#10 0x0000000100f50a10 (anonymous namespace)::MasmParser::parseStatement((anonymous namespace)::ParseStatementInfo&, llvm::MCAsmParserSemaCallback*) (/Users/user/llvm-project/build/bin/llvm-ml+0x100630a10)
#11 0x0000000100f49c60 (anonymous namespace)::MasmParser::Run(bool, bool) (/Users/user/llvm-project/build/bin/llvm-ml+0x100629c60)
#12 0x0000000100924348 AssembleInput(llvm::StringRef, llvm::Target const*, llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo&, llvm::MCSubtargetInfo&, llvm::MCInstrInfo&, llvm::MCTargetOptions&, llvm::opt::ArgList const&) (/Users/user/llvm-project/build/bin/llvm-ml+0x100004348)
#13 0x0000000100923484 llvm_ml_main(int, char**, llvm::ToolContext const&) (/Users/user/Tarides/llvm-project/build/bin/llvm-ml+0x100003484)
#14 0x0000000100925d54 main (/Users/user/llvm-project/build/bin/llvm-ml+0x100005d54)
#15 0x00000001927e4274
[1]    81581 abort      ~/Tarides/llvm-project/build/bin/llvm-ml -m64 -nologo -c -Fo test.obj test.as
```

https://github.com/llvm/llvm-project/pull/130781


More information about the llvm-commits mailing list