Re: MS-COFF Object Files

htak@eskimo.com (Henry S. Takeuchi)
12 Nov 1996 22:05:33 -0500

          From comp.compilers

Related articles
MS-COFF Object Files gleeh@tulletts.sprint.com (1996-11-10)
Re: MS-COFF Object Files meissner@cygnus.com (Michael Meissner) (1996-11-12)
Re: MS-COFF Object Files htak@eskimo.com (1996-11-12)
Re: MS-COFF Object Files shankar@chromatic.com (1996-11-12)
Re: MS-COFF Object Files alt-x@erinet.com (1996-11-14)
Re: MS-COFF Object Files albaugh@agames.com (1996-11-19)
| List of all articles for this month |

From: htak@eskimo.com (Henry S. Takeuchi)
Newsgroups: comp.compilers
Date: 12 Nov 1996 22:05:33 -0500
Organization: Compilers Central
References: 96-11-071
Keywords: linker

Hugo <gleeh@tulletts.sprint.com> wrote:
>Its all very well writing a codegen generator, that creates block of
>machine code, but what about the messy details of differing object
>file formats.


>Is there such a thing as an 'OBJ format' independent codegen ?


>When you think about it, the obj format is nothing to do with code
>generation, I wonder if anyone has any views or info on this aspect
>of compilers ?


The following is a simplified list of my OMF generating routines:


output header
initialize (segment)
output absolute code (segment, data)
output relocatable code (segment, target segment, displacement part)
output relocatable code (segment, external reference, displacement part)
flush (segment)
output trailer


These routines are suitable for a sequential format such as OMF. My
intention was to also use these for generating MS-COFF files. (Won't
be done in the near future because the VC++ linker can handle OMF, and
other parts of my compiler have higher priority.)


The output routines know nothing about CPU instructions, only about
what kinds of relocatable data are possible.


A separate pass is used to define internal labels and external symbols,
collect names, determine segment sizes, etc.


The output routines increment the location counters and takes care of
all the messy file details like record overflow, checksums, etc.
    If symbol tables need to appear at the beginning of the file, the output
header routine takes care of this.


--
Henry S. Takeuchi
htak@eskimo.com
Seattle, Washington (USA)
--


Post a followup to this message

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