diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/ppci/linker.py	Thu Feb 13 22:02:08 2014 +0100
@@ -0,0 +1,19 @@
+
+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