静态变量探查

int global_int_var = 84;
int global_unint_var;

void func1(int i){
    printf("%d\n",i);
}

int main(void){
    static int static_var = 85;
    static int static_var1;
    
    func1(static_var+static_var1);
}

gcc cProfile.c -o a.o

objdump -t a.o 

 

000000010000101c l       __DATA,__data	_main.static_var
0000000100001020 l       __DATA,__bss	_main.static_var1
0000000100000000 g     F __TEXT,__text	__mh_execute_header
0000000100000f40 g     F __TEXT,__text	_func1
0000000100001018 g       __DATA,__data	_global_int_var
0000000100001024 g       __DATA,__common	_global_unint_var
0000000100000f70 g     F __TEXT,__text	_main
0000000000000000         *UND*	_printf
0000000000000000         *UND*	dyld_stub_binder

 

添加了作用域修饰符

posted @ 2023-07-25 10:16  zzfx  阅读(14)  评论(0编辑  收藏  举报