main.lv
Dont think code it

# 2011-12-15 List ELF section names

Every ELF (Executable Linux Format) file has standard structure.
There is section names that used to identify purpose of section.

Here is example how to write all names of all ELF sections.

Here is steps that we have taken:
1. Find String Table Section
2. Get all section names from string table section
3. Run trough all section an get names of sections

First of all we need get ELF header (Elf32_Ehdr) from position 0.

Sting table section have attributes with help us to recognize it:
2. its type (Elf32_Shdr.sh_type) is SHT_STRTAB = 3
3. and it is first section with such attributes

To get trough all sections we make for cycle. We can get number
of sections from (Elf32_Ehdr.e_shnum) .
we run all trough all sections and checking for 3 string table section
rules.

for ( iter_s=0; iter_s < ELFheader.e_shnum; iter_s++  )
{
{
//some code
iter_s=ELFheader.e_shnum+1; //this is to exit from for cycle
}
}


String table section has all section names as strings. Section name
is in (Elf32_Shdr.sh_name) as position number of strings first symbol.

All string table values we read inside buffer

fseek( f, STRheader.sh_offset, SEEK_SET);


Now we can get section name with

printf("%s\n", STR_buffer+ITERheader.sh_name);


This is example code to get some info from ELF file. There is allot other
info that can be gained from ELF file.