如何处理nasm中嵌入.text部分的跳转表



基本上我使用IDA Pro从SPEC2006中反汇编一些二进制文件,并做一些修改工作,使其在Windows 7 32位上可以重新运行。

我在IDAPro生成的反汇编asm代码中发现了一个问题:

;this is .text section
.....
LeadUpVec:
dd offset LeadUp1
dd offset LeadUp2
dd offset LeadUp3
LeadUp1:
;this is .text section

显然IDAPro把这个跳转表放在了代码中。

我使用nasm来组装这个代码,它生成了这样的代码:

error: comma expected after operand 1  

在的四条线中的每一条

我这样修改它:

;this is .text section
.....
section .data         <--- I add it here
LeadUpVec:
dd offset LeadUp1
dd offset LeadUp2
dd offset LeadUp3
section .text         <--- I add it here
LeadUp1:
;this is .text section

但它仍然在四行中的每一行产生相同的错误。。。

error: comma expected after operand 1  

有人能帮我吗?非常感谢。

好吧,把它看作是一个"答案"。

Nasm不使用offset关键字。只要dd LeadUp1等就可以了。如果你有很多它们,你可以%定义偏移量(什么都没有),让Nasm忽略它。在section.text中有一个跳转表应该不是问题。内存将是只读的,但您可能无论如何都不希望跳转表是可写的。。。

相关内容

最新更新