Mercurial > lcfOS
diff python/ppci/objectfile.py @ 334:6f4753202b9a
Added more recipes
author | Windel Bouwman |
---|---|
date | Thu, 13 Feb 2014 22:02:08 +0100 |
parents | |
children | 582a1aaa3983 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/ppci/objectfile.py Thu Feb 13 22:02:08 2014 +0100 @@ -0,0 +1,32 @@ + +""" +Object files are used to store assembled code. Information contained +is code, symbol table and relocation information. +""" + +class Symbol: + def __init__(self, name, value): + self.name = name + self.value = value + + +class Relocation: + def __init__(self, typ): + pass + + +class Section: + def __init__(self, name): + self.name = name + + +class ObjectFile: + def __init__(self): + self.symbols = {} + self.sections = {} + self.relocations = [] + + def add_symbol(self, name, value): + sym = Symbol(name, value) + self.symbols[name] = sym + return sym