简体   繁体   English

带有 OFFSET 标签的汇编 PUSH 指令

[英]Assembly PUSH instruction with an OFFSET tag

I've written a simple 'Hello World' program in assembly:我在汇编中编写了一个简单的“Hello World”程序:

global  _main
extern  _printf

section .text
_main:
    push  offset  message
    call  _printf
    add   esp, 4
    ret
section .data
    message db  'Hello, World2', 10, 0

I've opened the compiled.EXE in Ghidra tool (freeware IDA alternative) and when I look at the generated assembly code listing, there is something like this:我在Ghidra工具(免费软件IDA替代品)中打开了已编译的.EXE,当我查看生成的汇编代码列表时,有这样的东西:

 push  message
 call  _printf
 add   esp,0x4

My question is: why is there no offset keyword there (like in the source)?我的问题是:为什么那里没有offset关键字(就像在源代码中一样)? Is it optional or so?它是可选的吗? Moreover when I'd like to patch the instruction, the tool doesn't allow me to type the offset keyword...此外,当我想修补指令时,该工具不允许我输入offset关键字......

Assemblers belong to one of two believes.汇编者属于两种信仰之一。

Assemblers that require square brackets to read/write memory will not need the offset tag to reference the offset of the label.需要方括号来读/写 memory 的汇编器不需要offset标签来引用 label 的偏移量。 This is the N ASM style.这是N ASM 风格。
These assemblers can allow or prohibit the use of offset .这些汇编器可以允许或禁止使用offset

Assemblers that don't require square brackets to read/write memory will need the offset tag to reference the offset of the label.不需要方括号来读/写 memory 的汇编器将需要offset标签来引用 label 的偏移量。 This is the M ASM style.这是M ASM 风格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM