Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to cross-compile MASM files #1022

Open
russelltg opened this issue Apr 1, 2024 · 5 comments
Open

Ability to cross-compile MASM files #1022

russelltg opened this issue Apr 1, 2024 · 5 comments

Comments

@russelltg
Copy link
Contributor

LLVM has a MASM assembler, llvm-ml, which can perform the tasks of ml.exe and ml64.exe (with the -m64 flag), that can be used when cross-compiling to Windows.

Currently, these .exe names are hardcoded, which feels a bit kludgy, but at least there is the woarkaround of adding a script like

$ cat tools/ml64.exe
#!/bin/bash
llvm-ml -m64 $@

which does indeed work. Ideally cc-rs could be taught about llvm-ml though. I see a few options, that may not be mutually exclusive:

  1. Fallback to llvm-ml if ml64.exe isn't found
  2. Use llvm-ml if host is not Windows
  3. Add a MASM_ASM env var (or similar) to allow selection of an assembler. cc-rs would also have to detect the special case of llvm-ml and 64-bit and be able to add the -m64 flag.

Thoughts?

@NobodyXu
Copy link
Collaborator

NobodyXu commented Apr 1, 2024

Thanks, I think option 1 and option 3 makes sense.

Fallback to llvm-ml helps with cross compilation, and having an environment for selecting ar makes a lot of sense.

Though I wonder if we could use existing env variable AR instead of a new one.

@russelltg
Copy link
Contributor Author

AR is for archivers, not assemblers....

But you're saying "assume you want an LLVM assember if you want an LLVM archiver"?

@NobodyXu
Copy link
Collaborator

NobodyXu commented Apr 2, 2024

Thanks for correction, yeah I mixed them up

In that case having a MASM_ASM env var does make sense.

@russelltg
Copy link
Contributor Author

Since there's no "standard" env var name for this maybe CC_MASM_ASM to match the other cc-specific env var CC_ENABLE_DEBUG_OUTPUT?

@NobodyXu
Copy link
Collaborator

NobodyXu commented Apr 2, 2024

Yeah, having CC_ prefix definitely makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants