Issue 81070
Summary Cross-compiling with clang-cl to intel on an arm machine doesn't work great (or at all)
Labels new issue
Assignees
Reporter nico
    I saw https://neugierig.org/software/blog/2024/02/cross-compile.html and was like "this is super easy to do with clang-cl as long as you have a win sysroot!". Then I tried it on my Apple Silicon laptop:

```
 % cat main.c
int main() {}
```

```
 % out/gn/bin/clang-cl main.c /winsysroot ~/src/chrome/src/third_party/depot_tools/win_toolchain/vs_files/27370823e7 
clang-cl: error: unable to execute command: Executable "link.exe" doesn't exist!
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)
```

Ah right, I have to use lld, of course:

```
% out/gn/bin/clang-cl main.c /winsysroot ~/src/chrome/src/third_party/depot_tools/win_toolchain/vs_files/27370823e7 -fuse-ld=lld
% file main.exe
main.exe: PE32+ executable (console) Aarch64, for MS Windows
```

Hm. I suppose that makes sense? But let's make an intel binary. Just `-m32` picks 32-bit arm which I suppose maybe makes sense, so let's pass an explicit triple:

```
% out/gn/bin/clang-cl main.c /winsysroot ~/src/chrome/src/third_party/depot_tools/win_toolchain/vs_files/27370823e7 -fuse-ld=lld --target=x86_64-pc-windows 
clang (LLVM option parsing): Unknown command line argument '-x86-asm-syntax=intel'.  Try: 'clang (LLVM option parsing) --help'
clang (LLVM option parsing): Did you mean '--asan-stack=intel'?
```

Whaat? Why is that command line arg unknown? That should work?

I suppose this bug report is only about this very last thing. (But maybe we should default to lld too, at least on non-Win hosts, since link.exe can't possibly work there?)

@zmodem 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to