Re: Backpatch?

jcea@ait.uvigo.es (Jesus Cea Avion)
Wed, 19 Jul 1995 10:04:43 GMT

          From comp.compilers

Related articles
Backpatch? diaman@ee.upatras.gr (Nikos Diamantopoulos) (1995-06-25)
Re: Backpatch? boggs@osage.csc.ti.com (1995-06-30)
Re: Backpatch? gclind01@ulkyvx.louisville.edu (1995-07-01)
Re: Backpatch? IanC@gibside.demon.co.uk (Ian Cull) (1995-07-05)
Re: Backpatch? taweil@ucs.usc.edu (1995-07-13)
Re: Backpatch? jcea@ait.uvigo.es (1995-07-19)
Re: Backpatch? hebert@prism.uvsq.fr (1995-07-20)
Re: Backpatch? albaugh@agames.com (1995-07-20)
| List of all articles for this month |
Newsgroups: comp.compilers
From: jcea@ait.uvigo.es (Jesus Cea Avion)
Keywords: code
Organization: Compilers Central
References: 95-07-033
Date: Wed, 19 Jul 1995 10:04:43 GMT

> boggs@osage.csc.ti.com "Lowell Boggs" writes:
> > I used to work with an assembler that used back patching for symbol
> > names. The technique worked like this:
> >[keep link list per symbol in the object code]
>
> I once wrote a compiler & assembler in (ZX Spectrum) Basic - the compiler
> output assembler source code, then the assembler converted it to M/C.
[...]
> When the variable is unknown, its 'value' points to the linked list of
> places where it is referenced; as soon as its value is known, the linked
> list is resolved, and then the variable has its proper value ...
[...]


Well, I made a similar implementation in my Pascal and Basic compiler, and
in my 6502 assembler in the Commodore Vic20 (!!Long time ago!!) and
Commodore 128. But I had a problem. If you have the following fragment
of code (680xx family):


move.l #tableend-table,d0


where 'tableend' and 'table' are labels with obvious meaning, the 'd0' register
will be the lenght of that table. You can't resolve that references if
'tableend' and 'table' are defined after that line.


In order to backpatching correctly the code, you must convert that line to,
for example:


move.l #tableend,d0
sub.l #table,d0


Does anybody know how resolve forward references without that problem?.
Thank you.


--
Jesus Cea Avion
    jcea@ait.uvigo.es
    jcea@dtc.uvigo.es
--


Post a followup to this message

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