[Wisp-cvs] wisp/users/dig linkie.py,1.27,1.28
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-19 09:57:35
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv29752 Modified Files: linkie.py Log Message: added the /relative/ parameter to Linkie._emit_sum Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- linkie.py 14 Apr 2003 21:59:24 -0000 1.27 +++ linkie.py 19 Apr 2003 09:57:31 -0000 1.28 @@ -76,18 +76,24 @@ def notify_linker (this, offset, type, arg): this._linker_notes.append((offset, type, arg)) - def _emit_sum (this, size, addends, delta = 0): + def _emit_sum (this, size, addends, delta = 0, relative = 0): + # If /relative/ is given, so many first components are PC-relative. + # /relative/ must be smaller than or equal to len(addends). if this._skipped <> 0: raise "Events out of order", this + if relative > len(addends): + raise 'Too many relatives', (addends, relative) for a in addends: + if relative: s = -size; relative -= 1 + else: s = size if type(a) == IntType: # local reference if this._locals[a] <> None: # backwards delta += this._locals[a] else: # forwards - this._unresolved_locals.append((a, size, len(this._binary))) + this._unresolved_locals.append((a, s, len(this._binary))) elif type(a) == StringType: # global reference if not a[0] in '#&!%': raise 'unprefixed symbol being referred to', a - this.notify_linker(this.memsz(), size, a) + this.notify_linker(this.memsz(), s, a) else: raise 'Invalid addend', a return delta def emit_byte_sum (this, addends, delta = 0): |