Why do assembly programs have separate segments?

后端 未结 3 935
忘了有多久
忘了有多久 2021-02-09 09:25

Why do assembly programs load segments (.data/.bss and .text) into separate memory blocks instead of loading both the data and the code se

3条回答
  •  轮回少年
    2021-02-09 10:07

    No, I think you understood wrong, segmentation concept in not only used in assembly, every machine specific high level languages (like C, C++, Basic, Pascal, etc.) use segments internally.

    Because every C and C++ programs are compiled to assembly language by GNU compiler (in the case of Ubuntu), the compiler will put appropriate datas to appropriate segments and the GAS assembler will convert this assembly to object code bytes.

提交回复
热议问题