3 ms·
I'm assuming most compilers don't ship nasm/masm/whatever with them. How do compilers do actual "assembly to executable" step?
by rarestblog 16y ago
I'm assuming most compilers don't ship nasm/masm/whatever with them. How do compilers do actual "assembly to executable" step?
- kmavm 16y agoHistorically, C compilers really did run an assembler in a separate process and communicate with it via pipes or files. gcc still ships with gas. gas is more oriented to the needs of a compiler than to human writers of assembly code. Some compilers emit machine code from their own low-level intermediate representation, though. The trade-offs are similar to any other build/buy technical decision: full-custom gives you more control, while forcing you to reinvent the wheel.
- wingo 16y agoOne can assemble directly in your language of choice. See http://code.weinholt.se/industria/ http://code.weinholt.se/industria/ for a particularly terse example: 1300 lines for an x86 assembler. Link to source: http://bazaar.launchpad.net/~weinholt/scheme-libraries/industria/annotate/head:/weinholt/assembler/x86.sls http://bazaar.launchpad.net/~weinholt/scheme-libraries/indus...