|translation from x86 assember to machine code email@example.com (michelle) (2002-01-14)|
|Re: translation from x86 assember to machine code firstname.lastname@example.org (Joachim Durchholz) (2002-01-17)|
|Re: translation from x86 assember to machine code RLWatkins@CompuServe.Com (R. L. Watkins) (2002-01-17)|
|Re: translation from x86 assember to machine code email@example.com (Hugo Rozas M.) (2002-01-17)|
|Re: translation from x86 assember to machine code firstname.lastname@example.org (2002-01-17)|
|Re: translation from x86 assember to machine code email@example.com (michelle) (2002-01-18)|
|Re: translation from x86 assember to machine code firstname.lastname@example.org (Paul Setterfield) (2002-01-28)|
|From:||Joachim Durchholz <email@example.com>|
|Date:||17 Jan 2002 00:27:39 -0500|
|Posted-Date:||17 Jan 2002 00:27:39 EST|
> I Can Build A Compiler That Outputs Assembly Code,
> But I Don'T Know How To Turn It Into Executable Code.
You need to do things:
1) Generate machine instructions.
2) Wrap the whole stuff with all the information that the operating
system requires to identify the file as executable.
The first task is simple. Just pick up the reference for the target
processor (in the case of x86, just download the references from
intel.com). If you can generate assembly, is should be simple to
replace that backend with a machine code generator, it's just a
different output format.
The second task would be as simple if the executable formats were
well-documented. They have changed massively over the last ten years,
and it's easy to get an outdated reference. (You may want to refer to
our esteemed moderator's book - I forgot the title, it was something
like "Linkers and Loaders".)
General advice: you'll save yourself a lot of fuss and hairpulling if
you simply generate object format, and let the system's linker handle
all the grotty stuff. (Downside: the Windows platform doesn't come with
a linker by default. But digging up an open-source linker will still be
less work than writing yet another one.) (Other downside: most linkers
cannot handle more than C interface conventions. If your language
deviates strongly from C's linkage conventions, the linker may be unable
to handle your requirements.)
Return to the
Search the comp.compilers archives again.