comparison python/ppci/linker.py @ 350:2b02bd286fe9

Fixed A9 hello worle
author Windel Bouwman
date Sat, 08 Mar 2014 16:29:03 +0100
parents 442fb043d149
children 5477e499b039
comparison
equal deleted inserted replaced
349:13a6e73b448f 350:2b02bd286fe9
87 section.data[reloc.offset+2] = (rel24 >> 16) & 0xFF 87 section.data[reloc.offset+2] = (rel24 >> 16) & 0xFF
88 section.data[reloc.offset+1] = (rel24 >> 8) & 0xFF 88 section.data[reloc.offset+1] = (rel24 >> 8) & 0xFF
89 section.data[reloc.offset+0] = rel24 & 0xFF 89 section.data[reloc.offset+0] = rel24 & 0xFF
90 90
91 91
92 @reloc('ldr_imm12')
93 def apply_ldr_imm12(reloc, sym, section, reloc_value):
94 assert sym.value % 4 == 0
95 assert reloc_value % 4 == 0
96 offset = (sym.value - (reloc_value + 8))
97 U = 1
98 if offset < 0:
99 offset = -offset
100 U = 0
101 assert offset < 4096
102 section.data[reloc.offset+2] |= (U << 7) #(rel24 >> 16) & 0xFF
103 section.data[reloc.offset+1] |= (offset >> 8) & 0xF
104 section.data[reloc.offset+0] = offset & 0xFF
105
92 class Linker: 106 class Linker:
93 """ Merges the sections of several object files and 107 """ Merges the sections of several object files and
94 performs relocation """ 108 performs relocation """
95 def __init__(self): 109 def __init__(self):
96 self.logger = logging.getLogger('Linker') 110 self.logger = logging.getLogger('Linker')