Reputation: 877
So, I have this idea and I've searched around to see if its true, but haven't found anything to confirm it yet.
I'm working on an elf parser and I'd like to construct the program's data from the sections.
My idea is that the data segment is made of the information in the .data, .data1, .bss, .ctors and .dtors (.ctors and .dtors for c++ programs) sections; is that correct?
Please provide links for documentation
Upvotes: 1
Views: 91
Reputation: 4321
When loading segments to memory, you must look at the program header table, not at the section header table. Program headers are loader's inputs, whereas section headers are intended for debugging info.
For example, the .data
and .bss
could be gathered into the same program header, or scattered in two program headers. One or two segments of memory would be allocated. Having one code segment and one memory segment is nothing but mandatory. It depends on how the binary has been linked.
Upvotes: 1