Mercurial > lcfOS
diff 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 |
line wrap: on
line diff
--- a/python/ppci/linker.py Sat Mar 08 16:16:41 2014 +0100 +++ b/python/ppci/linker.py Sat Mar 08 16:29:03 2014 +0100 @@ -89,6 +89,20 @@ section.data[reloc.offset+0] = rel24 & 0xFF +@reloc('ldr_imm12') +def apply_ldr_imm12(reloc, sym, section, reloc_value): + assert sym.value % 4 == 0 + assert reloc_value % 4 == 0 + offset = (sym.value - (reloc_value + 8)) + U = 1 + if offset < 0: + offset = -offset + U = 0 + assert offset < 4096 + section.data[reloc.offset+2] |= (U << 7) #(rel24 >> 16) & 0xFF + section.data[reloc.offset+1] |= (offset >> 8) & 0xF + section.data[reloc.offset+0] = offset & 0xFF + class Linker: """ Merges the sections of several object files and performs relocation """