I have a question asking me to explain in what regions of a linux memory map a procedure is stored. The question instructs me to use objdump -h to find this information.
Now, I am a little bit confused what “regions in memory” means.
I know that for a given procedure we have certain register that we work with (say %eax, %edx…) and also for each variable we have a memory location it is stored in (say 8(%ebp)). In addition I know that we have the %esp and %ebp registers to “take care” of the stack.
I also run objdump -h on my file but from what I get I cannot tell anything specific.
So should I just mention the registers being used and the memory addresses where the variables of this procedure are being stored?
I believe your question is asking where the linker has designated your actual code to reside in memory when it’s loaded by the operating system. This area of code would be represented by the program counter register, or
%EIPon x86.Typically on Linux, program code as well as read-only variables are stored in the lower regions of mapped memory for the process, with the stack in the upper regions (i.e., the stack grows down).