view python/ppci/linker.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


from .objectfile import ObjectFile

class Linker:
    def set_symbol(self, sym):
        self.dst.add_symbol(sym.name, sym.value)

    def link(self, objs):
        self.dst = ObjectFile()
        # First copy all sections into output sections:
        for iobj in objs:
            for sym in iobj.symbols:
                print(sym)
                self.set_symbol(sym)
        # Do relocations:
        # TODO
        # Check that there are no more unresolved symbols:
        # TODO
        return self.dst