Skip to content

Misc Sections

.comment

Contains version control information.

.debug

Contains debug information. The content format is not specified.

.line

Contains line number information for debugging, describing the correspondence between source code and machine code.

.note

The note section. See details below.

Note Sections

Sometimes the vendor or system builder needs to mark an object file with special information that other programs can use to check compliance, compatibility, etc. SHT_NOTE type sections and PT_NOTE type program header elements can be used for this purpose.

The note information in sections and program headers must contain 4-byte words in the format of the target processor. Below is a diagram representing the note information. For illustration purposes, labels are shown for the entries and their alignment, but they are not part of the specification.

There are no limitations on the note section contents in ELF files.

.hash

The .hash section contains the symbol hash table. Details are as follows:

The hash table is used to support symbol table access, helping to improve search speed.

The algorithm used by the hash function is as follows:

unsigned long
elf_hash(const unsigned char *name)
{
    unsigned long h = 0, g;
    while(*name)
    {
        h = (h << 4) + *name++;
        if(g = h & 0xf0000000)
            h ^= g >> 24;
        h &= ~g;
    }
    return h;
}