comparison python/ppci/objectfile.py @ 334:6f4753202b9a

Added more recipes
author Windel Bouwman
date Thu, 13 Feb 2014 22:02:08 +0100
parents
children 582a1aaa3983
comparison
equal deleted inserted replaced
333:dcae6574c974 334:6f4753202b9a
1
2 """
3 Object files are used to store assembled code. Information contained
4 is code, symbol table and relocation information.
5 """
6
7 class Symbol:
8 def __init__(self, name, value):
9 self.name = name
10 self.value = value
11
12
13 class Relocation:
14 def __init__(self, typ):
15 pass
16
17
18 class Section:
19 def __init__(self, name):
20 self.name = name
21
22
23 class ObjectFile:
24 def __init__(self):
25 self.symbols = {}
26 self.sections = {}
27 self.relocations = []
28
29 def add_symbol(self, name, value):
30 sym = Symbol(name, value)
31 self.symbols[name] = sym
32 return sym