I am learning about memory management and I am trying to identify what the second read only memory segment, specific to my program, is storing.
00400000-00401000 r-xp 00000000 00:28 144 /a.out
00600000-00601000 r--p 00000000 00:28 144 /a.out
00601000-00602000 rw-p 00001000 00:28 144 /a.out
I've, I think, Identified the lower range segment to be the code-segment (or text-segment) where the executing code, and constant global variables are stored. I also believe that the third segment, with read/write access, is the data-segment where we store global and static variables.
My research tells me that there is a segment called BSS where uninitialized variables are stored. But the second memory segment between address 00600000-00601000 is shown as read-only, surely one would have uninitialized variables there, (how would one initialize them?).
My theory was that we stored global constant variables here but research and experimenting showed me this is not the case, as it is stored in text-segment.
I also read about a read-only data-segment (rodata) which, from what I understand, should contain static constant data, Is this it? and why are my constant globals stored here?
I'm using gcc to compile my test program.