comparison 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
comparison
equal deleted inserted replaced
363:396e5cefba13 364:c49459768aaa
111 U = 2 111 U = 2
112 if offset < 0: 112 if offset < 0:
113 offset = -offset 113 offset = -offset
114 U = 1 114 U = 1
115 assert offset < 4096 115 assert offset < 4096
116 section.data[reloc.offset+2] |= (U << 6) #(rel24 >> 16) & 0xFF 116 section.data[reloc.offset+2] |= (U << 6)
117 section.data[reloc.offset+1] |= (offset >> 8) & 0xF 117 section.data[reloc.offset+1] |= (offset >> 8) & 0xF
118 section.data[reloc.offset+0] = offset & 0xFF
119
120 @reloc('absaddr32')
121 def apply_absaddr32(reloc, sym, section, reloc_value):
122 assert sym.value % 4 == 0
123 assert reloc_value % 4 == 0
124 offset = sym.value
125 section.data[reloc.offset+3] = (offset >> 24) & 0xFF
126 section.data[reloc.offset+2] = (offset >> 16) & 0xFF
127 section.data[reloc.offset+1] = (offset >> 8) & 0xFF
118 section.data[reloc.offset+0] = offset & 0xFF 128 section.data[reloc.offset+0] = offset & 0xFF
119 129
120 130
121 class Linker: 131 class Linker:
122 """ Merges the sections of several object files and 132 """ Merges the sections of several object files and