Re: 1-pass Assembler Design

ian@cygnus.com
16 Aug 1998 22:46:54 -0400

          From comp.compilers

Related articles
1-pass Assembler Design marvl@fusionmm.com (Marv Luse) (1998-08-13)
Re: 1-pass Assembler Design leichter@smarts.com (Jerry Leichter) (1998-08-16)
Re: 1-pass Assembler Design gkasten@auco.com (Glenn Kasten) (1998-08-16)
Re: 1-pass Assembler Design nr@labrador.cs.virginia.edu (Norman Ramsey) (1998-08-16)
Re: 1-pass Assembler Design ian@cygnus.com (1998-08-16)
Re: 1-pass Assembler Design adrian@dcs.rhbnc.ac.uk (1998-08-17)
Re: 1-pass Assembler Design meissner@cygnus.com (Michael Meissner) (1998-08-17)
Re: 1-pass Assembler Design kochenbu@khe.scn.de (1998-08-19)
Re: 1-pass Assembler Design jcrens@magicnet.net (Jack W. Crenshaw) (1998-08-19)
Re: 1-pass Assembler Design nr@labrador.cs.virginia.edu (Norman Ramsey) (1998-08-20)
| List of all articles for this month |
From: ian@cygnus.com
Newsgroups: comp.compilers
Date: 16 Aug 1998 22:46:54 -0400
Organization: Compilers Central
References: 98-08-096
Keywords: assembler

In comp.compilers "Marv Luse" <marvl@fusionmm.com> writes:


>I have been pondering the design of a 1-pass assembler and have been
>considering schemes for dealing with forward references (i.e., jump to
>label not yet found in source code). Does anyone have any suggestions
>for a practical scheme for doing this? I have devised several
>approaches, but have limited time for investigation, so if someone
>could suggest an approach that would be great.


The GNU assembler is a 1-pass assembler. It uses a fairly
straightforward scheme that I believe is due to Richard Stallman.


An assembler must obviously be prepared to write out relocation
information. You treat a jump to an undefined symbol as a relocation.
At the end of the assembly you go back and fill in any relocations
which turn out to be for defined symbols.


Some object file formats can only represent a limited number of
relocations, so you may have to be able to represent more relocations
internally than you can actually write out to the object file.


This approach does assume that you can buffer up your output file in
memory before writing it to the output file.


Ian Taylor
ian@cygnus.com
--


Post a followup to this message

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