view 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 source


"""
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