![]() |
![]() |
| ||||||||
|
Section names with a dot (.) prefix are reserved for the system, although applications can use these sections if their existing meanings are satisfactory. Applications can use names without the prefix to avoid conflicts with system sections. The object file format enables you to define sections not in the list above. An object file can have more than one section with the same name. Section names reserved for a processor architecture are formed by placing an abbreviation of the architecture name ahead of the section name. The name should be taken from the architecture names used for e_machine. For example, .Foo.psect is the psect section defined by the FOO architecture. Existing extensions use their historical names COMDAT SectionCOMDAT sections are uniquely identified by their section name (sh_name). If the link-editor encounters multiple sections of type SHT_SUNW_COMDAT, with the same section name, the first section is retained and the rest discarded. Any relocations applied to a discarded SHT_SUNW_COMDAT section are ignored. Any symbols defined in a discarded section are removed. Additionally, the link-editor supports the section naming convention used for section reordering when the compiler is invoked with the -xF option. If a function is placed in a section with the name .sectname%funcname, the final SHT_SUNW_COMDAT sections that are retained are coalesced into a section identified by .sectname. Using this method, the SHT_SUNW_COMDAT sections are placed into the .text, .data, or any other section as their final destination. Group SectionSome sections occur in interrelated groups. For example, an out-of-line definition of an inline function might require additional information besides the section containing executable instructions. This additional information can be a read-only data section containing literals referenced, one or more debugging information sections, or other informational sections. Furthermore, there may be internal references among these sections. These references make no sense if one of the sections were removed, or one of the sections were replaced, by a duplicate from another object. Therefore, these groups are included, or these groups are omitted, from the linked object as a unit. A section of type SHT_GROUP defines such a grouping of sections. The name of a symbol from one of the containing object's symbol tables provides a signature for the section group. The section header of the SHT_GROUP section specifies the identifying symbol entry. The sh_link member contains the section header index of the symbol table section that contains the entry. The sh_info member contains the symbol table index of the identifying entry. The sh_flags member of the section header contains 0. The name of the section (sh_name) is not specified. The section data of a SHT_GROUP section is an array of Elf32_Word entries. The first entry is a flag word. The remaining entries are a sequence of section header indices. The following flag is currently defined: Table 7-17 ELF Group Section Flag
The section header indices in the SHT_GROUP section, identify the sections that make up the group. These sections must have the SHF_GROUP flag set in their sh_flags section header member. If the link-editor decides to remove the section group, the link-editor removes all members of the group. To facilitate removing a group without leaving dangling references and with only minimal processing of the symbol table, the following rules are followed:
Hash Table SectionA hash table consists of Elf32_Word or Elf64_Word objects that provide for symbol table access. The SHT_HASH section provides this hash table. The symbol table to which the hashing is associated is specified in the sh_link entry of the hash table's section header. Labels appear below to help explain the hash table organization, but they are not part of the specification. Figure 7-4 Symbol Hash Table ![]() The bucket array contains nbucket entries, and the chain array contains nchain entries. Indexes start at 0. Both bucket and chain hold symbol table indexes. Chain table entries parallel the symbol table. The number of symbol table entries should equal nchain, so symbol table indexes also select chain table entries. A hashing function that accepts a symbol name, returns a value to compute a bucket index. Consequently, if the hashing function returns the value x for some name, bucket [x%nbucket] gives an index y. This is an index into both the symbol table and the chain table. If the symbol table entry is not the name desired, chain[y] gives the next symbol table entry with the same hash value. The chain links can be followed until the selected symbol table entry holds the desired name, or the chain entry contains the value STN_UNDEF. The hash function is as follows:
Move SectionTypically, within ELF files, initialized data variables are maintained within the object file. If a data variable is very large, and contains only a small number of initialized (nonzero) elements, the entire variable is still maintained in the object file. Objects that contain large partially initialized data variables, such as FORTRAN COMMON blocks, can result in a significant disk space overhead. The SHT_SUNW_move section provides a mechanism of compressing these data variables. This compression reduces the disk size of the associated object. The SHT_SUNW_move section contains multiple entries of the type ELF32_Move or Elf64_Move. These entries allow data variables to be defined as tentative items (.bss), thus occupying no space in the object file but contributing to the object's memory image at runtime. The move records establish how the memory image is initialized with data to construct the complete data variable. ELF32_Move and Elf64_Move entries are defined as follows:
The elements of these structures are as follows:
The following data definition would traditionally consume 0x8000 bytes within an object file:
Using an SHT_SUNW_move section the data item can be moved to the .bss section and initialized with the associated move entries:
| ||||||||
| ||||||||