Pages1

ELF object files and its type

ELF object file:
ELF is common standard file format used for an UNIX of unix like operating systems.
- Object files
- Shared libraries
- Executable files
- Core file( Crash dump)

Types of ELF file :

Relocatable file:
This type of ELF files contains data and code(text) which can be linked together with other relocatable file.
Command to generate relocatable file:

$gcc -c example.c -o example.o

Here example.o is file that is relocatable it can be linked with other relocatable file while at the time of linking process.
- Contains section, 

Shared Object file:
This kind of elf file will be used by dynamic linker to combine with executable or other shared files to create a complete process image.
Command to generate shared object file:
$ gcc -c -Wall -Werror -fPIC shared.c
$ gcc -shared -o libshared.so shared.o

libshared.so is shared obejct file which is platform independent can can be linked with executable at run time.

Executable ELF File:
This file has capability to run, contains segment which are used to create process image at run time.
 - Composed of segments

Core ELF file :
This file has created by kernel while executing process crashed due to some reason.
This file has memory dump of complete process, stack dump to back trace program flow, it always has a "note" section which provides details of the GPR-General purpose register at the time of crash.
It also contains reason of crash - signal details, process id  etc.

ELF header:
Header of any file format is used to place complete organization of a file in beginning of that file.
   

No comments:

Post a Comment