Tag:

如何从C程序内部或内联汇编中获取C函数的大小?

假设我有如下函数: # cat 003.c int foo(int a, int b) { return a+b; } 并编译它像这样: gcc -S 003.c 得到以下汇编结果: .file “003.c” .text .globl foo .type foo, @function foo: .LFB2: pushq %rbp .LCFI0: movq %rsp, %rbp .LCFI1: movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -8(%rbp), %edx movl -4(%rbp), %eax addl %edx, %eax leave ret .LFE2: .size foo, […]