I'm working on an assembler for the 8086 . My question is how do you convert the hex opcodes to an executable file like .EXE,.ELF,.COM,a.out etc .Looking for links/resources for this and should the assembler do the linking process or is it done by the OS automatically?
It's fairly complicated, and usually involves two steps:
Thus the assembler will generally not output executable files; you need to pick an object file format and read up on how to generate that. In theory, as long as you output a valid object file in a given format, any linker should be able to do the actual linking process, but usually assemblers and linkers come as a set, so I'm not sure how well it will actually work in practice (for example, the GNU assembler (gas) outputs GNU-specific relocations and sections that the GNU linker (ld) knows how to handle, so you can't use gas-generated object files in any other linker)
ELF is documented in section 4 of the SV ABI, although you'll need to read your processor's addendum too. COFF is documented as part of the PE spec, although I can't find it hosted on the Internet anywhere; if you need it I can post it somewhere
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With