Skip to content

Enable assembly generation - #2770

Merged
nickclark2016 merged 1 commit into
premake:masterfrom
theComputeKid:assembly
Aug 19, 2026
Merged

Enable assembly generation#2770
nickclark2016 merged 1 commit into
premake:masterfrom
theComputeKid:assembly

Conversation

@theComputeKid

Copy link
Copy Markdown
Contributor
  • GCC and Clang use -save-temps=obj when generateassembly is On. Verbose additionally uses -fverbose-asm.
  • MSVC uses /FA for On and /FAs for Verbose.
  • Assembly is output in the object directory. Some logic has been added to avoid output name clashes, by deriving it from the object file name and assigning to /Fa$(asm_name).asm for msvc-syntax compilers. This requires modifying the vs/ninja/makefile generators for those compilers.

Future work can decouple assembly generation and output location. But having asm output to the object directory is a good starting point and a very common use case when you want to inspect the assembly for optimization purposes.

Comment thread modules/ninja/tests/test_ninja_build_rules.lua Outdated
Comment thread src/tools/msc.lua Outdated
Comment thread website/docs/generateassembly.md Outdated
Comment thread modules/ninja/ninja_cpp.lua Outdated
Comment thread website/docs/generateassembly.md Outdated
@theComputeKid

Copy link
Copy Markdown
Contributor Author

@nickclark2016 : I have changed the flag's scope from config to per file, which makes more sense for a flag that enables assembly generation. Can you please review if I did it correctly?

@theComputeKid
theComputeKid force-pushed the assembly branch 3 times, most recently from a590575 to 8ab3df9 Compare August 17, 2026 12:42

@nickclark2016 nickclark2016 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall code looks really good. Just one, hopefully trivial, comment to fix up.

Comment thread src/tools/msc.lua Outdated
- GCC and Clang use `-save-temps=obj` when `generateassembly` is `On`. `Verbose` additionally uses `-fverbose-asm`.
- MSVC uses `/FA` for `On` and `/FAs` for `Verbose`.
- Assembly is output in the object directory. Some logic has been added to msc to avoid output name clashes, by deriving it from the object file name.

Future work can decouple assembly generation and output location. But having asm output to the object directory is one of its main workflows when you want to inspect the assmebly for optimization purposes.
@nickclark2016
nickclark2016 merged commit 24b67a3 into premake:master Aug 19, 2026
85 checks passed
@theComputeKid
theComputeKid deleted the assembly branch August 19, 2026 13:13
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

Successfully merging this pull request may close these issues.

3 participants