Mercurial > lcfOS
comparison python/ppci/linker.py @ 345:b4882ff0ed06
Added more arm isa tests
author | Windel Bouwman |
---|---|
date | Sun, 02 Mar 2014 17:12:08 +0100 |
parents | d1ecc493384e |
children | 442fb043d149 |
comparison
equal
deleted
inserted
replaced
344:1378c4b027a0 | 345:b4882ff0ed06 |
---|---|
74 section.data[reloc.offset + 2] = imm11 & 0xFF | 74 section.data[reloc.offset + 2] = imm11 & 0xFF |
75 section.data[reloc.offset + 3] |= (imm11 >> 8) & 0x7 | 75 section.data[reloc.offset + 3] |= (imm11 >> 8) & 0x7 |
76 section.data[reloc.offset] |= imm6 | 76 section.data[reloc.offset] |= imm6 |
77 section.data[reloc.offset + 1] |= (s << 2) | 77 section.data[reloc.offset + 1] |= (s << 2) |
78 | 78 |
79 # ARM reloc!! | |
80 # TODO: move to target classes??? | |
81 @reloc('b_imm24') | |
82 def apply_b_imm24(reloc, sym, section, reloc_value): | |
83 assert sym.value % 4 == 0 | |
84 assert reloc_value % 4 == 0 | |
85 offset = (sym.value - (reloc_value + 8)) | |
86 rel24 = wrap_negative(offset >> 2, 24) | |
87 section.data[reloc.offset+2] = (rel24 >> 16) & 0xFF | |
88 section.data[reloc.offset+1] = (rel24 >> 8) & 0xFF | |
89 section.data[reloc.offset+0] = rel24 & 0xFF | |
90 | |
79 | 91 |
80 class Linker: | 92 class Linker: |
81 """ Merges the sections of several object files and | 93 """ Merges the sections of several object files and |
82 performs relocation """ | 94 performs relocation """ |
83 def link(self, objs, layout={}): | 95 def link(self, objs, layout={}): |