Re: win32/linux executables

vbdis@aol.com (VBDis)
5 Jan 2002 01:46:06 -0500

          From comp.compilers

Related articles
win32/linux executables alankarmisra@hotmail.com (2002-01-03)
Re: win32/linux executables fab@rhapsodyk.net (Fabrice Medio) (2002-01-05)
Re: win32/linux executables ck@kuckuk.com (Carsten Kuckuk) (2002-01-05)
Re: win32/linux executables vbdis@aol.com (2002-01-05)
Re: win32/linux executables newsfeed@boog.co.uk (Peter Cooper) (2002-01-05)
| List of all articles for this month |

From: vbdis@aol.com (VBDis)
Newsgroups: comp.compilers
Date: 5 Jan 2002 01:46:06 -0500
Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com
References: 02-01-010
Keywords: code
Posted-Date: 05 Jan 2002 01:46:06 EST

alankarmisra@hotmail.com (gods1child) schreibt:


>where do i start? intel's assembly specification ? windows APIs? any
>resource that would help me write a basic compiler would help. i can
>then try and expand that further and seek help as and when i get
>stuck.


You need a lot of informations, about the executable file structures,
system APIs and calling conventions, memory management, and the
program initialization and finalization framework. For Windows you'll
find most informations in the MSDN (Microsoft Developer Network), the
file format being discussed in "Microsoft Portable Executable and
Common Object File Format Specification".


If you really want to implement the linker, instead of using an
already available one, then it might be a good idea to make your
compiler produce position independent code (PIC). Then you can produce
a sample executable for every intended platform once, and your linker
only has to merge it with your specific code. In this case only a few
entries, regarding the actual size of the specific code, must be
modified. No modification is required at all, when you create the
sample with enough room for any intended specific code. Then you only
have to determine once the place in the sample executable, where to
copy the compiled code.


If your compiler cannot produce PIC code, then you'll have to write an
much more sophisticated linker. Then you may find out soon, that the
existing documentation is of little help. Statements like "here the
linker inserts..." are sufficient to understand the meaning of some
values, but not necessarily how to compute these values. Not to
mention the errors and omissions, which are copied from one
documentation version to the next one :-(




Another issue is the test of your compiler itself. Herefore you may
need to add debug information to the executables, so that you can use
an debugger. The production of that information requires at least as
much information as about the executables themselves, if not much
more. Debuggers and their specific debug information usually are
described only for compiler writers, as far as what the compiler
should produce. But the construction of the final debug information or
files usually is left to the linker, which is supplied with a specific
development system.


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.