[Wisp-cvs] wisp/users/dig linkie.py,1.16,1.17
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-03-09 20:12:46
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv17753 Modified Files: linkie.py Log Message: implemented $foo -> !foo conversion Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- linkie.py 9 Mar 2003 19:33:24 -0000 1.16 +++ linkie.py 9 Mar 2003 20:12:38 -0000 1.17 @@ -234,17 +234,32 @@ that._linker_notes = this._linker_notes[:] that._origin = this._origin return that + def fall (this): + # forces the base address to zero and converts $foo to !foo + for sym, val in this._symbols: + if sym[0] == '$': + this._symbols.append(('!' + sym[1:], val - this._origin)) + this._origin = 0 def extend (this, that): # Returns the offset of /that/ inside /this/ after extension. if this._unresolved_locals: raise 'Incomplete linkie', this if that._unresolved_locals: raise 'Incomplete linkie', that + if this._origin != 0: + this.fall() if that.filesz(): this.deskip() this.align(that._alignment) - delta = this.memsz() + delta = this.memsz() - that._origin this._binary.extend(that._binary) this._skipped = that._skipped for sym, val in that._symbols: - this._symbols.append((sym, val + delta)) + if sym[0] in '#&$!': + this._symbols.append((sym, val)) + else: + # FIXME: backwards compatibility + print 'WARNING: unprefixed symbol', sym + this._symbols.append((sym, val + delta)) + if sym[0] == '$': + this._symbols.append(('!' + sym[1:], val + delta)) for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + delta, typ, arg)) return delta |