Mercurial > lcfOS
comparison python/ppci/objectfile.py @ 342:86b02c98a717 devel
Moved target directory
author | Windel Bouwman |
---|---|
date | Sat, 01 Mar 2014 15:40:31 +0100 |
parents | d1ecc493384e |
children | 9667d78ba79e |
comparison
equal
deleted
inserted
replaced
341:4d204f6f7d4e | 342:86b02c98a717 |
---|---|
15 def __repr__(self): | 15 def __repr__(self): |
16 return 'SYM {}, val={} sec={}'.format(self.name, self.value, self.section) | 16 return 'SYM {}, val={} sec={}'.format(self.name, self.value, self.section) |
17 | 17 |
18 | 18 |
19 class Relocation: | 19 class Relocation: |
20 """ Represents a relocation entry. A relocation always has a symbol to refer to | |
21 and a relocation type """ | |
20 def __init__(self, sym, offset, typ, section): | 22 def __init__(self, sym, offset, typ, section): |
21 self.sym = sym | 23 self.sym = sym |
22 self.offset = offset | 24 self.offset = offset |
23 self.typ = typ | 25 self.typ = typ |
24 self.section = section | 26 self.section = section |
62 sym = Symbol(name, value, section) | 64 sym = Symbol(name, value, section) |
63 self.symbols[name] = sym | 65 self.symbols[name] = sym |
64 return sym | 66 return sym |
65 | 67 |
66 def add_relocation(self, sym_name, offset, typ, section): | 68 def add_relocation(self, sym_name, offset, typ, section): |
69 assert type(sym_name) is str, str(sym_name) | |
67 assert section in self.sections | 70 assert section in self.sections |
68 reloc = Relocation(sym_name, offset, typ, section) | 71 reloc = Relocation(sym_name, offset, typ, section) |
69 self.relocations.append(reloc) | 72 self.relocations.append(reloc) |
70 return reloc | 73 return reloc |
71 | 74 |