Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
7.  Object File Format File Format Special Sections  Previous   Contents   Next 
   
 
.bss

Uninitialized data that contribute to the program's memory image. By definition, the system initializes the data with zeros when the program begins to run. The section occupies no file space, as indicated by the section type SHT_NOBITS.

.comment

Comment information, typically contributed by the components of the compilation system. This section can be manipulated by mcs(1).

.data, .data1

Initialized data that contribute to the program's memory image.

.dynamic

Dynamic linking information. See "Dynamic Section" for details.

.dynstr

Strings needed for dynamic linking, most commonly the strings that represent the names associated with symbol table entries.

.dynsym

Dynamic linking symbol table. See "Symbol Table" for details.

.fini

Executable instructions that contribute to a single termination function for the executable or shared object containing the section. See "Initialization and Termination Routines" for details.

.fini_array

An array of function pointers that contribute to a single termination array for the executable or shared object containing the section. See "Initialization and Termination Routines" for details.

.got

The global offset table. See "Global Offset Table (Processor-Specific)".

.hash

Symbol hash table. See "Hash Table".

.init

Executable instructions that contribute to a single initialization function for the executable or shared object containing the section. See "Initialization and Termination Routines" for details.

.init_array

An array of function pointers that contributes to a single initialization array for the executable or shared object containing the section. See "Initialization and Termination Routines" for details.

.interp

The path name of a program interpreter. See "Program Interpreter".

.note

Information in the format described in "Note Section".

.plt

The procedure linkage table. See "Procedure Linkage Table (Processor-Specific)".

.preinit_array

An array of function pointers that contribute to a single pre-initialization array for the executable or shared object containing the section. See "Initialization and Termination Routines" for details.

.rela

Relocations that do not apply to a particular section. One use of this section is for register relocations. See "Register Symbols".

.relname, .relaname

Relocation information, as "Relocation" describes. If the file has a loadable segment that includes relocation, the sections' attributes will include the SHF_ALLOC bit. Otherwise, that bit will be off. Conventionally, name is supplied by the section to which the relocations apply. Thus a relocation section for .text normally will have the name .rel.text or .rela.text.

.rodata, .rodata1

Read-only data that typically contribute to a non-writable segment in the process image. See "Program Header".

.shstrtab

Section names.

.strtab

Strings, most commonly the strings that represent the names associated with symbol table entries. If the file has a loadable segment that includes the symbol string table, the section's attributes will include the SHF_ALLOC bit. Otherwise, that bit will be turned off.

.symtab

Symbol table, as "Symbol Table" describes. If the file has a loadable segment that includes the symbol table, the section's attributes will include the SHF_ALLOC bit. Otherwise, that bit will be turned off.

.text

The text or executable instructions of a program.

.SUNW_bss

Partially initialized data for shared objects that contribute to the program's memory image. The data is initialized at runtime. The section occupies no file space, as indicated by the section type SHT_NOBITS.

.SUNW_heap

The heap of a dynamic executable created from dldump(3DL).

.SUNW_move

Additional information for partially initialized data. See "Move Section".

.SUNW_reloc

Relocation information, as "Relocation" describes. This section is a concatenation of relocation sections that provides better locality of reference of the individual relocation records. Only the offset of the relocation record itself is meaningful, thus the section sh_info value is zero.

.SUNW_syminfo

Additional symbol table information. See "Syminfo Table".

.SUNW_version

Versioning information. See "Versioning Information".

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.

String Table

String table sections hold null-terminated character sequences, commonly called strings. The object file uses these strings to represent symbol and section names. You reference a string as an index into the string table section.

The first byte, which is index zero, holds a null character. Likewise, a string table's last byte holds a null character, ensuring null termination for all strings. A string whose index is zero specifies either no name or a null name, depending on the context.

An empty string table section is permitted. The section header's sh_size member will contain zero. Nonzero indexes are invalid for an empty string table.

A section header's sh_name member holds an index into the section header string table section, as designated by the e_shstrndx member of the ELF header. The following figure shows a string table with 25 bytes and the strings associated with various indexes.

Figure 7-4 ELF String Table

The table below shows the strings of the string table shown in the preceding figure.

Table 7-18 ELF String Table Indexes

Index

String

0

none

1

name

7

Variable

11

able

16

able

24

null string

As the example shows, a string table index can refer to any byte in the section. A string can appear more than once. References to substrings can exist. A single string can be referenced multiple times. Unreferenced strings also are allowed.

Symbol Table

An object file's symbol table holds information needed to locate and relocate a program's symbolic definitions and references. A symbol table index is a subscript into this array. Index 0 both designates the first entry in the table and serves as the undefined symbol index. See Table 7-22.

A symbol table entry has the following format, defined in sys/elf.h:

typedef struct {
        Elf32_Word      st_name;
        Elf32_Addr      st_value;
        Elf32_Word      st_size;
        unsigned char   st_info;
        unsigned char   st_other;
        Elf32_Half      st_shndx;
} Elf32_Sym;

typedef struct {
        Elf64_Word      st_name;
        unsigned char   st_info;
        unsigned char   st_other;
        Elf64_Half      st_shndx;
        Elf64_Addr      st_value;
        Elf64_Xword     st_size;
} Elf64_Sym;

The elements of this structure are:

 
 
 
  Previous   Contents   Next