Potential of a compiler that creates the executable at once

Dennis dkorpel at gmail.com
Fri Feb 11 16:40:42 UTC 2022


On Friday, 11 February 2022 at 12:34:21 UTC, rempas wrote:
> That's nice to hear! However, does DMD generates object files 
> directly or "asm" files that are passed to a C compile? If I 
> remember correctly, LDC2 needs to pass the output to a C 
> compiler as people told me so what's the case from DMD?

DMD goes from its own backend block tree to an object file, 
without writing assembly. In fact, only recently was the ability 
to output asm added for debugging purposes:
https://dlang.org/blog/2022/01/24/the-binary-language-of-moisture-vaporators/

On Linux dmd invokes gcc by default to create an executable, but 
only to link the resulting object files, not to compile 
C/assembly code.

LDC goes from LLVM IR to machine code, but it can output assembly 
with the `-output-s` flag.

GDC does generate assembly text to the tmp folder and then 
invokes `gas` the GNU assembler, it can't directly write machine 
code.


More information about the Digitalmars-d mailing list