Issue 126444
Summary llvm-ml fails to compile five-line Vulkan-Loader CMake MASM compiler tests
Labels new issue
Assignees
Reporter tfinnegan937
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to