Quiz 2
Say following C program is built to an executable prog as follows:
main.c
M1: int helper(int); // Defined in helper.c
M2: int main() { return helper(7); }
L1: $(CC) -c main.c
L2: $(CC) -c helper.c
L3: $(CC) -o prog main.o helper.o
Following is the output of running readelf on the executable prog:
$ readelf -l prog
Elf file type is EXEC (Executable file)
Entry point 0x4000b0
There are 2 program headers, starting at offset 64
Program Headers:
Type Off VAddr PAddr FileSz MemSz Flg Algn
LOAD 0xb0 0x4000b0 0x4000b0 0x78 0x78 R E 0x8
GNU_STACK 0x0 0x0 0x0 0x0 0x0 RW 0x10
Section to Segment mapping:
Segment Sections...
00 .text .eh_frame
01