<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126444>126444</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            llvm-ml fails to compile five-line Vulkan-Loader CMake MASM compiler tests
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tfinnegan937
      </td>
    </tr>
</table>

<pre>
    When cross-compiling with MinGW (Or clang targeting MinGW), the Vulkan-Loader CMake configuration runs the following command to check if the MASM compiler works:

${CMAKE_ASM_MASM_COMPILER} ${CMAKE_ASM_MASM_FLAGS} -c -Fo ${CMAKE_CURRENT_BUILD_DIR}/masm_check.obj ./mask_check.asm

In my case, CMAKE_ASM_MASM_COMPILER is llvm-ml.

The source files are not included with the Vulkan-Loader project -- rather, they're generated by CMake. This is the assembly file that the Vulkan Loader has generated:

```masm
.code
extrn start:near
    xor rax, rax
 ret
end
```

Compiling this assembly with the normal inputs and swapping the assembler with llvm-ml produces the following error:

```bash
llvm-ml -m64 -c -Fo ./masm_check.obj ./masm_check.asm
./masm_check.asm:2:13: error: unrecognized type in directive 'extern'
extrn start:near
```

I do not personally know MASM assembly at all -- I'm not working on any MASM projects. I am trying to cross-compile Vulkan, however, and it relies on the presence of a MASM compiler on windows targets to implement certain features. MinGW on Windows hosts uses ml64.exe to assemble masm files, but they do not provide an ml64 binary on linux. llvm-ml is currently my only option for that.

Due to my lack of experience with MASM, I'm not sure if this is a bug with llvm-ml, or a bug with Vulkan-Loader. I decided to start here as it seems to work fine with other MASM compilers.

LLVM Version:
```bash
tfinnegan@fedora:~/Projects/worldstate-engine/out/build/config-ninja-windows-cross-linux-clang/_deps/vulkan-loader-build/loader$ llvm-as --version
LLVM (http://llvm.org/):
  LLVM version 19.1.7
 Optimized build.
```

llvm-ml does not have a version flag itself, but I assume it built with the same version of llvm as my installed llvm-as binary.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx0Vl-Pm74S_TTOywhEHDZZHvJAd5uforu5rbr98xgZGMCN_yDbJOE-3M_-kw1hm20rRYqAmfGZc84MMGt5oxC35OEDeXhesN612mxdzZXChqlstVkUuhq2P1pUUBptbVRq2XHBVQMX7lo4cPXPDyD08ZOBUjDVgGOmQecDwjNCM0KfwLUI33txYip60axCA08HdkIotap50xvmuFZgemVDaK2F0BdfpNRSMlWB01C2WJ6A1yHikL8eYASDBi7anCxZ5SQJP5qSzYenQ_6fj8f89XD0scenT4fP-5ePX8jmGf4YsHvJ_3n1T6MSop2-C3r69uXLx_9-PX74tn95Pj7vfRVCd5JZeQywYl38hHi8dZpuMStHPHsFcoCSWfRU_AUXcAtCnGUkRTymfW0RrO5NiVBzgRaYQVDaAVel6CusRgl-p7Yz-ieWDqIIDHMtmkmBgdCNQWhQoWEOKyiGUYYYvrbcegS-GLMWZSGGcCq4lrlfzoDpjJbZt0JvzK-T8SfH5uNSV0iSHK_OKLCOGUdWuUJmSJIDAFy1AcOuHqD_S3Iw6HyCqn4tN1Z_mr3nPNwZ50yD0kYyAVx1vbPgbWMvrOvGjLkx7xefMbHt6ar6Et87D43R5vfOCmZbkuS35Eiu05tj4r9aQt5Z4g83Vzklq3y5Iqt8Phh6ZbDUjeL_wwrc0CFwBRU3WDp-RiB0g1eHRhG6-RvH7xjcQ6WDhTo0VismxAAnpS_jOM2EMgdMCO-fPaEbGTL8iHlatAKmhjFhMpqNYQ9MgjNDoFrf7Yqbc7zGrb7gefSjV4c7MCg4Wl_Vs98ZtKhKBF0DezfjWsGFq0pf7LRjrD-Jy06gROWgROMYV1Ajc71BG0_LSSv4MeW12joLvUULUqzTGK_oa9x8AV6UcdY8wqIPxh9mzow-8wqBqZANBVfMDL6-4Kq_xrOhuIWyNwaVE4OffK3EALoLK67WJozUNOPPfUAgBxCsPPm28dqh4YGEccPmrweP5k0J2xsc1-A4swyKvrmztI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