I have already read this post and I understand that segments contain runtime information and encapsulate sections, which contain linking information. But, I am still confused on why these terms are being used seemingly interchangeably in these two books.
"The Shellcoder's Handbook"
Next, information is loaded from the program’s executable file to the newly created address space. There are three types of segments: .text, .bss, and .data. The .text segment is mapped as read-only, whereas .data and .bss are writable. The .bss and .data segments are reserved for global variables. The .data segment contains static initialized data, and the .bss segment contains uninitialized data. The final segment, .text, holds the program instructions.
"Professional Assembly Language"
The text section is required in all assembly language programs. It is where the instruction codes are declared within the executable program. The data and bss sections are optional, but often used within a program. The data section declares data elements that are declared with an initial value. These data elements are used as variables within the assembly language program. The bss section declares data elements that are instantiated with a zero (or null) value. These data elements are most often used as buffer areas within the assembly language program.
section
is the correct term. The first book is just being sloppy. – Jester.text
and.rodata
sections both get linked into the text segment. (Or used to; modernld
makes.rodata
a separate ELF segment so it can be non-executable.) – Peter Cordes.text
,.data
etc are defined in memory by segment descriptors and not by section descriptors, so I think that the term segments is more appropriate for memory blocks with different access rights. – vitsoft