llvm-ml does not accept `equ` followed by `dq ?` or `[r1].MyStruct.`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This test addition is motivated by Asm/X86/LzmaDecOpt.asm from the LZMA SDK:
```diff
diff --git a/llvm/test/tools/llvm-ml/expansion.asm b/llvm/test/tools/llvm-ml/expansion.asm
index 344184965f39..ec32c07faa03 100644
--- a/llvm/test/tools/llvm-ml/expansion.asm
+++ b/llvm/test/tools/llvm-ml/expansion.asm
@@ -2,6 +2,14 @@
.code
+PTR_FIELD equ dq ?
+
+MyStruct struct
+ my_field PTR_FIELD
+MyStruct ends
+
+GET_STRUCT equ [r1].MyStruct.
+
num EQU 276
var TEXTEQU %num
@@ -35,4 +43,6 @@ mov eax, var
; CHECK: mov eax, 276
; CHECK: mov eax, 276
+mov eax, GET_STRUCT my_field
+
end
```
llvm-ml rejects it, but ml64 apparently accepts it.
It looks like ml64 is pretty lenient in what it allows after equ. Per https://learn.microsoft.com/en-us/cpp/assembler/masm/masm-bnf-grammar?view=msvc-170 I think both of these are technically invalid (since dq isn't an expr at all, and the 2nd set of equs are just expression fragments, not full expressions.
Maybe ml64 just does textual replacement of equ and no pre-parsing.
(Upstream issue: https://issues.chromium.org/issues/40230692)
Contributor guide
Assessment
This issue has not been assessed yet.