diff options
| author | serpilliere <devnull@localhost> | 2012-03-22 09:44:36 +0100 |
|---|---|---|
| committer | serpilliere <devnull@localhost> | 2012-03-22 09:44:36 +0100 |
| commit | ad4a48f38f78a9f841a614a9450780c9178200e5 (patch) | |
| tree | f1b6f8e05c5341a73033eeeacb2babee1ed84f77 | |
| parent | b410b90f5a6192da950746357ac7693780fe73cd (diff) | |
| download | miasm-ad4a48f38f78a9f841a614a9450780c9178200e5.tar.gz miasm-ad4a48f38f78a9f841a614a9450780c9178200e5.zip | |
ia32arch: fix reloc generation
Diffstat (limited to '')
| -rw-r--r-- | miasm/arch/ia32_arch.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/miasm/arch/ia32_arch.py b/miasm/arch/ia32_arch.py index 9638dea8..260c5013 100644 --- a/miasm/arch/ia32_arch.py +++ b/miasm/arch/ia32_arch.py @@ -676,7 +676,6 @@ class x86allmncs: b = ad_to_generic(a) log.debug(b) raw = self.get_address_afs_hex(b) - b_out = [] raw_out = [] for i in range(len(b)): @@ -1786,7 +1785,6 @@ class x86_mn: fds prefix.append(prefix_seg[args_eval[-1][x86_afs.segm]]) del args_eval[-1][x86_afs.segm] - #XXX test if symbol in arg and replace with imm... for pre asm if x86_afs.symb in args_eval[-1]: log.debug('pre-assembling with symbol! %s'%str(args_eval[-1][x86_afs.symb])) @@ -2227,8 +2225,14 @@ class x86_mn: log.info(str(c)+' '+str(eat_arg)+' '+str(opc_o)) out_opc = prefix[:] out_opc += opc_o[0] - val_add = [opc_o[1]]+opc_o[2] + # here are the reloc ? + # note: can the code be more crapy than this? + reloc_off = None + if opc_o[1]: + reloc_off = len(reduce(lambda x,y: x+chr(y), out_opc, "")) + + val_add = [opc_o[1]]+opc_o[2] out_byte = reduce(lambda x,y: x+chr(y), out_opc, "") for c in val_add: if c == {}: @@ -2238,11 +2242,10 @@ class x86_mn: else: raise ValueError('bad size in asm! %s'%str(c)) - #XXX hack for reloc gen + # XXX only one reloc per instruction max? has_symb = None - for ea in eat_arg: - if x86_afs.ad in ea and ea[x86_afs.ad]: - has_symb = len(out_byte)-4 + if reloc_off != None: + has_symb = reloc_off symbol_off.append(has_symb) hex_candidate.append(out_byte) |