我想了解有关 ELF 文件的知识,但是当我想到全局变量、静态全局变量和静态作用域变量时,有些困惑。例如:
int a = 2;
int b;
static int c = 4;
static int d;
void fun(){
static int e = 6;
static int f;
}
int main(void){
fun();
}
谁能告诉我每个变量属于哪个段?在我看来,b
、d
和 f
属于 .bss
段,而 a
、c
和 e
属于数据段,但我不知道 ELF 文件中全局静态变量和全局变量之间的区别。