ELF File Sections

ELF binary files consist of several sections. Each section has it's own responsibility: some contain executable code; others describe program dependencies; others symbol tables and so on. See the TIS documentation for a full description of each section.

To see how many sections the ELF file contains, including their names and sizes, is demonstated in the following code:

    int nSecNo = pReader->GetSectionsNum();
    for ( int i = 0; i < nSecNo; ++i ) {    // For all sections
        const IELFISection* pSec = pReader->GetSection( i );
        std::cout << pSec->GetName() << '' ''
                  << pSec->GetSize() << std::endl;

First, the number of sections are received; next, a pointer on the IELFISection interface. Using this interface, access is gained to the different section attributes: size, type, flags and address. To get a buffer that contains the section's bytes use the GetData() member function of this interface. See the IELFISection declaration for a full description of the IELFISection interface.