If an object file participates in dynamic linking, its program header table will have an element of type PT_DYNAMIC. This segment contains the .dynamic section. A special symbol, _DYNAMIC, labels the section, which contains an array of the following structures, defined in sys/link.h:
typedef struct { Elf32_Sword d_tag; union { Elf32_Word d_val; Elf32_Addr d_ptr; Elf32_Off d_off; } d_un; } Elf32_Dyn; typedef struct { Elf64_Xword d_tag; union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn;
For each object with this type, d_tag controls the interpretation of d_un.
These objects represent integer values with various interpretations.
These objects represent program virtual addresses. A file's virtual addresses might not match the memory virtual addresses during execution. When interpreting addresses contained in the dynamic structure, the runtime linker computes actual addresses, based on the original file value and the memory base address. For consistency, files do not contain relocation entries to correct addresses in the dynamic structure.
To make interpreting the contents of dynamic section entries simpler for tools, the value of each tag, except for those in two special compatibility ranges, will determine the interpretation of the d_un union. A tag whose value is an even number indicates a dynamic section entry that uses d_ptr. A tag whose value is an odd number indicates a dynamic section entry that uses d_val or that uses neither d_ptr nor d_val. Tags whose values are less than the special value DT_ENCODING and tags whose values fall between DT_HIOS and DT_LOPROC do not follow these rules.
The following table summarizes the tag requirements for executable and shared object files. If a tag is marked mandatory, then the dynamic linking array must have an entry of that type. Likewise, optional means an entry for the tag can appear but is not required.
Table 7–42 ELF Dynamic Array Tags
Name |
Value |
d_un |
Executable |
Shared Object |
---|---|---|---|---|
DT_NULL |
0 |
Ignored |
Mandatory |
Mandatory |
DT_NEEDED |
1 |
d_val |
Optional |
Optional |
DT_PLTRELSZ |
2 |
d_val |
Optional |
Optional |
DT_PLTGOT |
3 |
d_ptr |
Optional |
Optional |
DT_HASH |
4 |
d_ptr |
Mandatory |
Mandatory |
DT_STRTAB |
5 |
d_ptr |
Mandatory |
Mandatory |
DT_SYMTAB |
6 |
d_ptr |
Mandatory |
Mandatory |
DT_RELA |
7 |
d_ptr |
Mandatory |
Optional |
DT_RELASZ |
8 |
d_val |
Mandatory |
Optional |
DT_RELAENT |
9 |
d_val |
Mandatory |
Optional |
DT_STRSZ |
10 |
d_val |
Mandatory |
Mandatory |
DT_SYMENT |
11 |
d_val |
Mandatory |
Mandatory |
DT_INIT |
12 |
d_ptr |
Optional |
Optional |
DT_FINI |
13 |
d_ptr |
Optional |
Optional |
DT_SONAME |
14 |
d_val |
Ignored |
Optional |
DT_RPATH |
15 |
d_val |
Optional |
Optional |
DT_SYMBOLIC |
16 |
Ignored |
Ignored |
Optional |
DT_REL |
17 |
d_ptr |
Mandatory |
Optional |
DT_RELSZ |
18 |
d_val |
Mandatory |
Optional |
DT_RELENT |
19 |
d_val |
Mandatory |
Optional |
DT_PLTREL |
20 |
d_val |
Optional |
Optional |
DT_DEBUG |
21 |
d_ptr |
Optional |
Ignored |
DT_TEXTREL |
22 |
Ignored |
Optional |
Optional |
DT_JMPREL |
23 |
d_ptr |
Optional |
Optional |
DT_BIND_NOW |
24 |
Ignored |
Optional |
Optional |
DT_INIT_ARRAY |
25 |
d_ptr |
Optional |
Optional |
DT_FINI_ARRAY |
26 |
d_ptr |
Optional |
Optional |
DT_INIT_ARRAYSZ |
27 |
d_val |
Optional |
Optional |
DT_FINI_ARRAYSZ |
28 |
d_val |
Optional |
Optional |
DT_RUNPATH |
29 |
d_val |
Optional |
Optional |
DT_FLAGS |
30 |
d_val |
Optional |
Optional |
DT_ENCODING |
32 |
Unspecified |
Unspecified |
Unspecified |
DT_PREINIT_ARRAY |
32 |
d_ptr |
Optional |
Ignored |
DT_PREINIT_ARRAYSZ |
33 |
d_val |
Optional |
Ignored |
DT_LOOS |
0x6000000d |
Unspecified |
Unspecified |
Unspecified |
DT_SUNW_RTLDINF |
0x6000000e |
d_ptr |
Optional |
Optional |
DT_HIOS |
0x6ffff000 |
Unspecified |
Unspecified |
Unspecified |
DT_VALRNGLO |
0x6ffffd00 |
Unspecified |
Unspecified |
Unspecified |
DT_CHECKSUM |
0x6ffffdf8 |
d_val |
Optional |
Optional |
DT_PLTPADSZ |
0x6ffffdf9 |
d_val |
Optional |
Optional |
DT_MOVEENT |
0x6ffffdfa |
d_val |
Optional |
Optional |
DT_MOVESZ |
0x6ffffdfb |
d_val |
Optional |
Optional |
DT_FEATURE_1 |
0x6ffffdfc |
d_val |
Optional |
Optional |
DT_POSFLAG_1 |
0x6ffffdfd |
d_val |
Optional |
Optional |
DT_SYMINSZ |
0x6ffffdfe |
d_val |
Optional |
Optional |
DT_SYMINENT |
0x6ffffdff |
d_val |
Optional |
Optional |
DT_VALRNGHI |
0x6ffffdff |
Unspecified |
Unspecified |
Unspecified |
DT_ADDRRNGLO |
0x6ffffe00 |
Unspecified |
Unspecified |
Unspecified |
DT_CONFIG |
0x6ffffefa |
d_ptr |
Optional |
Optional |
DT_DEPAUDIT |
0x6ffffefb |
d_ptr |
Optional |
Optional |
DT_AUDIT |
0x6ffffefc |
d_ptr |
Optional |
Optional |
DT_PLTPAD |
0x6ffffefd |
d_ptr |
Optional |
Optional |
DT_MOVETAB |
0x6ffffefe |
d_ptr |
Optional |
Optional |
DT_SYMINFO |
0x6ffffeff |
d_ptr |
Optional |
Optional |
DT_ADDRRNGHI |
0x6ffffeff |
Unspecified |
Unspecified |
Unspecified |
DT_RELACOUNT |
0x6ffffff9 |
d_val |
Optional |
Optional |
DT_RELCOUNT |
0x6ffffffa |
d_val |
Optional |
Optional |
DT_FLAGS_1 |
0x6ffffffb |
d_val |
Optional |
Optional |
DT_VERDEF |
0x6ffffffc |
d_ptr |
Optional |
Optional |
DT_VERDEFNUM |
0x6ffffffd |
d_val |
Optional |
Optional |
DT_VERNEED |
0x6ffffffe |
d_ptr |
Optional |
Optional |
DT_VERNEEDNUM |
0x6fffffff |
d_val |
Optional |
Optional |
DT_LOPROC |
0x70000000 |
Unspecified |
Unspecified |
Unspecified |
DT_SPARC_REGISTER |
0x70000001 |
d_val |
Optional |
Optional |
DT_AUXILIARY |
0x7ffffffd |
d_val |
Unspecified |
Optional |
DT_USED |
0x7ffffffe |
d_val |
Optional |
Optional |
DT_FILTER |
0x7fffffff |
d_val |
Unspecified |
Optional |
DT_HIPROC |
0x7fffffff |
Unspecified |
Unspecified |
Unspecified |
Marks the end of the _DYNAMIC array.
The DT_STRTAB string table offset of a null-terminated string, giving the name of a needed dependency. The dynamic array can contain multiple entries of this type. The relative order of these entries is significant, though their relation to entries of other types is not. See Shared Object Dependencies.
The total size, in bytes, of the relocation entries associated with the procedure linkage table. See Procedure Linkage Table (Processor-Specific).
An address associated with the procedure linkage table or the global offset table. See Procedure Linkage Table (Processor-Specific) and Global Offset Table (Processor-Specific).
The address of the symbol hash table. This table refers to the symbol table indicated by the DT_SYMTAB element. See Hash Table Section.
The address of the string table. Symbol names, dependency names, and other strings required by the runtime linker reside in this table. See String Table Section.
The address of the symbol table. See Symbol Table Section.
The address of a relocation table. See Relocation Sections.
An object file can have multiple relocation sections. When creating the relocation table for an executable or shared object file, the link-editor catenates those sections to form a single table. Although the sections may remain independent in the object file, the runtime linker sees a single table. When the runtime linker creates the process image for an executable file or adds a shared object to the process image, it reads the relocation table and performs the associated actions.
This element requires the DT_RELASZ and DT_RELAENT elements also be present. When relocation is mandatory for a file, either DT_RELA or DT_REL can occur.
The total size, in bytes, of the DT_RELA relocation table.
The size, in bytes, of the DT_RELA relocation entry.
The total size, in bytes, of the DT_STRTAB string table.
The size, in bytes, of the DT_SYMTAB symbol entry.
The address of an initialization function. See Initialization and Termination Sections.
The address of a termination function. See Initialization and Termination Sections.
The DT_STRTAB string table offset of a null-terminated string, identifying the name of the shared object. See Recording a Shared Object Name.
The DT_STRTAB string table offset of a null-terminated library search path string. This element's use has been superseded by DT_RUNPATH. See Directories Searched by the Runtime Linker.
Indicates the object contains symbolic bindings that were applied during its link-edit. This elements use has been superseded by the DF_SYMBOLIC flag. See Using -B symbolic.
Similar to DT_RELA, except its table has implicit addends. This element requires that the DT_RELSZ and DT_RELENT elements also be present.
The total size, in bytes, of the DT_REL relocation table.
The size, in bytes, of the DT_REL relocation entry.
Indicates the type of relocation entry to which the procedure linkage table refers, either DT_REL or DT_RELA. All relocations in a procedure linkage table must use the same relocation. See Procedure Linkage Table (Processor-Specific). This element requires a DT_JMPREL element also be present.
Used for debugging.
Indicates that one or more relocation entries might request modifications to a non-writable segment, and the runtime linker can prepare accordingly. This element's use has been superseded by the DF_TEXTREL flag. See Position-Independent Code.
The address of relocation entries associated solely with the procedure linkage table. See Procedure Linkage Table (Processor-Specific). Separating these relocation entries enables the runtime linker to ignore them when the object is loaded if lazy binding is enabled. This element requires the DT_PLTRELSZ and DT_PLTREL elements also be present.
Various state flags which are applied to the DT_ element immediately following. See Table 7–45.
Indicates that all relocations for this object must be processed before returning control to the program. The presence of this entry takes precedence over a directive to use lazy binding when specified through the environment or via dlopen(3DL). This element's use has been superseded by the DF_BIND_NOW flag. See When Relocations Are Performed.
The address of an array of pointers to initialization functions. This element requires that a DT_INIT_ARRAYSZ element also be present. See Initialization and Termination Sections.
The address of an array of pointers to termination functions. This element requires that a DT_FINI_ARRAYSZ element also be present. See Initialization and Termination Sections.
The total size, in bytes, of the DT_INIT_ARRAY array.
The total size, in bytes, of the DT_FINI_ARRAY array.
The DT_STRTAB string table offset of a null-terminated library search path string. See Directories Searched by the Runtime Linker.
Flag values specific to this object. See Table 7–43.
Values greater than or equal to DT_ENCODING and less than or equal to DT_HIOS follow the rules for the interpretation of the d_un union.
The address of an array of pointers to pre-initialization functions. This element requires that a DT_PREINIT_ARRAYSZ element also be present. This array is processed only in an executable file. It is ignored if contained in a shared object. See Initialization and Termination Sections.
The total size, in bytes, of the DT_PREINIT_ARRAY array.
Values in this inclusive range are reserved for operating system-specific semantics. All such values follow the rules for the interpretation of the d_un union.
Reserved for internal use by the runtime-linker.
The address of the symbol information table. This element requires that the DT_SYMINENT and DT_SYMINSZ elements also be present. See Syminfo Table Section.
The size, in bytes, of the DT_SYMINFO information entry.
The total size, in bytes, of the DT_SYMINFO table.
The address of the version definition table. Elements within this table contain indexes into the string table DT_STRTAB. This element requires that the DT_VERDEFNUM element also be present. See Version Definition Section.
The number of entries in the DT_VERDEF table.
The address of the version dependency table. Elements within this table contain indexes into the string table DT_STRTAB. This element requires that the DT_VERNEEDNUM element also be present. See Version Dependency Section.
The number of entries in the DT_VERNEEDNUM table.
Indicates that all Elf32_Rela (or Elf64_Rela) RELATIVE relocations have been concatenated together, and specifies the RELATIVE relocation count. See Combined Relocation Sections.
Indicates that all Elf32_Rel RELATIVE relocations have been concatenated together, and specifies the RELATIVE relocation count. See Combined Relocation Sections.
The DT_STRTAB string table offset of a null-terminated string that names one or more auxiliary filtees. See Generating Auxiliary Filters.
The DT_STRTAB string table offset of a null-terminated string that names one or more standard filtees. See Generating Standard Filters.
A simple checksum of selected sections of the object. See gelf_checksum(3ELF).
The size, in bytes, of the DT_MOVETAB move entries.
The total size, in bytes, of the DT_MOVETAB table.
The address of a move table. This element requires that the DT_MOVEENT and DT_MOVESZ elements also be present. See Move Section.
The DT_STRTAB string table offset of a null-terminated string defining a configuration file. The configuration file is only meaningful in an executable, and is typically unique to this object. See Configuring the Default Search Paths.
The DT_STRTAB string table offset of a null-terminated string defining one or more audit libraries. See Runtime Linker Auditing Interface.
The DT_STRTAB string table offset of a null-terminated string defining one or more audit libraries. See Runtime Linker Auditing Interface.
Flag values specific to this object. See Table 7–44.
Feature values specific to this object. See Feature Checking.
Values in this inclusive range use the d_un.d_val field of the dynamic structure.
Values in this inclusive range use the d_un.d_ptr field of the dynamic structure. If any adjustment is made to the ELF object after it has been built, these entries must be updated accordingly.
The index of an STT_SPARC_REGISTER symbol within the DT_SYMTAB symbol table. There is one entry for every STT_SPARC_REGISTER symbol in the symbol table. See Register Symbols.
Values in this inclusive range are reserved for processor-specific semantics.
Except for the DT_NULL element at the end of the dynamic array and the relative order of DT_NEEDED and DT_POSFLAG_1 elements, entries can appear in any order. Tag values not appearing in the table are reserved.
Table 7–43 ELF Dynamic Flags, DT_FLAGS
Name |
Value |
Meaning |
---|---|---|
DF_ORIGIN |
0x1 |
$ORIGIN processing required |
DF_SYMBOLIC |
0x2 |
Symbolic symbol resolution required |
DF_TEXTREL |
0x4 |
Text relocations exist |
DF_BIND_NOW |
0x8 |
Non-lazy binding required |
DF_STATIC_TLS |
0x10 |
Object uses static thread-local storage scheme |
Indicates that the object requires $ORIGIN processing. See Locating Associated Dependencies.
Indicates that the object contains symbolic bindings that were applied during its link-edit. See Using -B symbolic.
Indicates that one or more relocation entries might request modifications to a non-writable segment, and the runtime linker can prepare accordingly. See Position-Independent Code.
Indicates that all relocations for this object must be processed before returning control to the program. The presence of this entry takes precedence over a directive to use lazy binding when specified through the environment or via dlopen(3DL). See When Relocations Are Performed.
Indicates that the object contains code using a static thread-local storage scheme. Static thread-local storage can not be used in objects that are dynamically loaded, either using dlopen(3DL), or using lazy loading. Because of this restriction, the link-editor does not support the creation of a shared object that requires static thread-local storage.
Name |
Value |
Meaning |
---|---|---|
DF_1_NOW |
0x1 |
Perform complete relocation processing. |
DF_1_GLOBAL |
0x2 |
Unused. |
DF_1_GROUP |
0x4 |
Indicate object is a member of a group. |
DF_1_NODELETE |
0x8 |
Object cannot be deleted from a process. |
DF_1_LOADFLTR |
0x10 |
Ensure immediate loading of filtees. |
DF_1_INITFIRST |
0x20 |
Objects' initialization occurs first. |
DF_1_NOOPEN |
0x40 |
Object can not be used with dlopen(3DL). |
DF_1_ORIGIN |
0x80 |
$ORIGIN processing required. |
DF_1_DIRECT |
0x100 |
Direct bindings enabled. |
DF_1_INTERPOSE |
0x400 |
Object is an interposer. |
DF_1_NODEFLIB |
0x800 |
Ignore default library search path. |
DF_1_NODUMP |
0x1000 |
Object cannot be dumped with dldump(3DL). |
DF_1_CONFALT |
0x2000 |
Object is a configuration alternative. |
DF_1_ENDFILTEE |
0x4000 |
Filtee terminates filter's search. |
DF_1_DISPRELDNE |
0x8000 |
Displacement relocation done. |
DF_1_DISPRELPND |
0x10000 |
Displacement relocation pending. |
DF_1_NODIRECT |
0x20000 |
Object contains non-direct bindings. |
Indicates that all relocations for this object must be processed before returning control to the program. The presence of this flag takes precedence over a directive to use lazy binding when specified through the environment or via dlopen(3DL). See When Relocations Are Performed.
Indicates that the object is a member of a group. This flag is recorded in the object using the link-editor's -B group option. See Object Hierarchies.
Indicates that the object cannot be deleted from a process. If the object is loaded in a process, either directly or as a dependency, with dlopen(3DL), it cannot be unloaded with dlclose(3DL). This flag is recorded in the object using the link-editor's -z nodelete option.
Meaningful only for filters. Indicates that all associated filtees be processed immediately. This flag is recorded in the object using the link-editor's -z loadfltr option. See Filtee Processing.
Indicates that this object's initialization section be run before any other objects loaded with it. This flag is intended for specialized system libraries only, and is recorded in the object using the link-editor's -z initfirst option.
Indicates that the object cannot be added to a running process with dlopen(3DL). This flag is recorded in the object using the link-editor's -z nodlopen option.
Indicates that the object requires $ORIGIN processing. See Locating Associated Dependencies.
Indicates that the object should use direct binding information. See Direct Binding.
Indicates that the objects symbol table is to interpose before all symbols except the primary load object, which is typically the executable. This flag is recorded with the link-editor's -z interpose option. See Direct Binding.
Indicates that the search for dependencies of this object ignores any default library search paths. This flag is recorded in the object using the link-editor's -z nodefaultlib option. See Directories Searched by the Runtime Linker.
Indicates that this object is not dumped by dldump(3DL). Candidates for this option include objects with no relocations that might get included when generating alternative objects using crle(1). This flag is recorded in the object using the link-editor's -z nodump option.
Identifies this object as a configuration alternative object generated by crle(1). This flag triggers the runtime linker to search for a configuration file $ORIGIN/ld.config.app-name.
Meaningful only for filtees. Terminates a filters search for any further filtees. This flag is recorded in the object using the link-editor's -z endfiltee option. See Reducing Filtee Searches.
Indicates that this object has displacement relocations applied. The displacement relocation records no longer exist within the object as they were discarded once the relocation was applied. See Displacement Relocations.
Indicates that this object has displacement relocations pending. The displacement relocations exits within the object so they can be completed at runtime. See Displacement Relocations.
Indicates that this object contains symbols that can not be directly bound to. See Defining Additional Symbols.
Name |
Value |
Meaning |
---|---|---|
DF_P1_LAZYLOAD |
0x1 |
Identify lazy loaded dependency. |
DF_P1_GROUPPERM |
0x2 |
Identify group dependency. |
Identifies the following DT_NEEDED entry as an object to be lazy loaded. This flag is recorded in the object using the link-editor's -z lazyload option. See Lazy Loading of Dynamic Dependencies.
Identifies the following DT_NEEDED entry as an object to be loaded as a group. This flag is recorded in the object using the link-editor's -z groupperm option. See Isolating a Group.
Name |
Value |
Meaning |
---|---|---|
DTF_1_PARINIT |
0x1 |
Partial initialization is required. |
DTF_1_CONFEXP |
0x2 |
A Configuration file is expected. |
Indicates that the object requires partial initialization. See Move Section.
Identifies this object as a configuration alternative object generated by crle(1). This flag triggers the runtime linker to search for a configuration file $ORIGIN/ld.config.app-name. This flag has the same affect as DF_1_CONFALT.