In this video we'll be looking into structure of Elf file.
Elf is a file format for executables, libraries, libraries, core files, etc. this Elf file is divided
into two into mainly four parts.
Starting with elf header.
And then you have section header and different sections.
Then you have program header which is also called as segments and different segments and object code.
So each of the element play a different role in the linking and loading process of an Elf executable.
Elf header will always be available in the Elf file and section.
Header is important during linking time to create an executable and program header table is useful during
runtime to help load the executable into the memory.
So an important point is this is very important.
You have four main components of an Elf file, starting with an Elf header, and then you have section
header which is used during link linking stage by the linker.
And then you have a program header which is used during loading the executable into the memory by the
loader.
And then you have the object code.
So in the previous sections we have seen about, uh how CPU executes instruction, CPU only knows object
code, right?
It does not know.
Anything about other things.
It does not know C program.
It does not know assembly program.
It only knows the machine instruction.
But in the Elf, along with this object code, you have along with the machine instruction, you have
additional information which is elf header and section header and program header.
Why we need additional things because we are not directly running on the processor.
On the CPU we are in a user space and there is a kernel which is managing the performing the process
management and kernel expects the executable in this format to execute instructions.
If you just give the object code, kernel will not execute, it will need an Elf format, and Elf format
has an Elf header, section header, program header, and a section header has sections.
Program header has segments and the object code is the actual instructions.