diff python/ppci/linker.py @ 381:6df89163e114

Fix section and ldr pseudo instruction
author Windel Bouwman
date Sat, 26 Apr 2014 17:41:56 +0200
parents 9667d78ba79e
children 173e20a47fda
line wrap: on
line diff
--- a/python/ppci/linker.py	Fri Apr 18 13:08:45 2014 +0200
+++ b/python/ppci/linker.py	Sat Apr 26 17:41:56 2014 +0200
@@ -99,7 +99,7 @@
     if offset < 0:
         offset = -offset
         U = 0
-    assert offset < 4096
+    assert offset < 4096, str(sym) + str(section) + str(reloc)
     section.data[reloc.offset+2] |= (U << 7)
     section.data[reloc.offset+1] |= (offset >> 8) & 0xF
     section.data[reloc.offset+0] = offset & 0xFF
@@ -130,16 +130,13 @@
     section.data[reloc.offset+0] = offset & 0xFF
 
 
-class Layout:
-    pass
-
 class Linker:
     """ Merges the sections of several object files and 
         performs relocation """
     def __init__(self):
         self.logger = logging.getLogger('Linker')
 
-    def link(self, objs, layout={}):
+    def link(self, objs, layout):
         assert type(objs) is list
         # Create new object file to store output:
         self.dst = ObjectFile()
@@ -175,6 +172,9 @@
                 offset = offsets[reloc.section] + reloc.offset
                 self.dst.add_relocation(reloc.sym, offset, reloc.typ, reloc.section)
 
+        # Apply layout rules:
+        # TODO
+
         # Perform relocations:
         for reloc in self.dst.relocations:
             # Lookup symbol: