Question: a. In which segments of the executable are a, b, s, and func stored? Use the command readelf -hSs out to verify your solution. Locate
a. In which segments of the executable are a, b, s, and func stored? Use the command readelf -hSs out to verify your solution. Locate each object in the symbol table (.symtab) and match the section index given in the Ndx column with the section headers. Hint: The compiler may have renamed s to s.n with n being some decimal number to prevent name clashes.
b. In which address space segments do r and *parg (the value (int) that parg points to) reside, respecively, when executing the program?
c. Where is the return value of func() placed? Verify you solution by disassembling the executable with objdump -Sd out and finding the epilogue of func().
d. What shared libraries are needed by out? Use the tool ldd to list all library dependencies. /lib64/ld-linux-x86-64.so.2 is the 64-bit ELF dynamic linker/loader, responsible for resolving library dependencies, loading them into the address space of the process and performing the dynamic linking. What purpose does each of the other libraries serve?
Consider the following C program that does some random computations. Download the source code of the program gcc with the following command line: gcc -g main.c func.c -o out You should now have an executable file called out. main.c: #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
