diff python/ppci/linker.py @ 364:c49459768aaa

Work on globals
author Windel Bouwman
date Wed, 19 Mar 2014 20:24:03 +0100
parents 396e5cefba13
children 98ff43cfdd36
line wrap: on
line diff
--- a/python/ppci/linker.py	Sun Mar 16 11:28:47 2014 +0100
+++ b/python/ppci/linker.py	Wed Mar 19 20:24:03 2014 +0100
@@ -113,10 +113,20 @@
         offset = -offset
         U = 1
     assert offset < 4096
-    section.data[reloc.offset+2] |= (U << 6) #(rel24 >> 16) & 0xFF
+    section.data[reloc.offset+2] |= (U << 6)
     section.data[reloc.offset+1] |= (offset >> 8) & 0xF
     section.data[reloc.offset+0] = offset & 0xFF
 
+@reloc('absaddr32')
+def apply_absaddr32(reloc, sym, section, reloc_value):
+    assert sym.value % 4 == 0
+    assert reloc_value % 4 == 0
+    offset = sym.value
+    section.data[reloc.offset+3] = (offset >> 24) & 0xFF
+    section.data[reloc.offset+2] = (offset >> 16) & 0xFF
+    section.data[reloc.offset+1] = (offset >> 8) & 0xFF
+    section.data[reloc.offset+0] = offset & 0xFF
+
 
 class Linker:
     """ Merges the sections of several object files and