Why do assembly programs load segments (.data
/.bss
and .text
) into separate memory blocks instead of loading both the data and the code se
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 data
s to appropriate segments and the GAS assembler will convert this assembly to object code bytes.