1,对于汇编语言来说有多个Section比如.data .bss,存储空间不同,读、写、取得权限也不同
对于如下程序
#include <stdio.h>
const int A = 10;//.rodata字段只读,最后这个字段和.text合并,变为只读
int a = 20;//GLOBAL声明 .data字段
static int b = 30;//对于b来说,在编译时会添加一个LOCAL声明,即链接时不会被处理.data字段
int c; //位于.bss字段,此字段会和.data合并,不过这个字段用0填充
int main(void){
static int a = 40; //同样在.data字段,该值会编译为a.134,跟一串数字,进行去别
char b[] = "Hello world"; //栈
register int c = 50; //分配在寄存器
printf("Hello world %d\n", c);
return 0;
}