SPRAB89A September 2011 – March 2014
As specified in the System V ABI, a dynamic linked program has an entry of type PT_DYNAMIC in its program header. This entry points to a special section called .dynamic, having section type SHT_DYNAMIC, that contains information relating to dynamic linking and loading. The dynamic section refers to other sections such as dynamic symbol table sections and dynamic relocation sections, collectively called dynamic information.
The dynamic information may or may not be contained within the loadable image of the program (that is, within one or more PT_LOAD segments), depending on platform-specific conventions. If the dynamic information is not loadable, then dynamic tags that refer to object components are represented as file offsets rather than virtual addresses.
The dynamic section is specified in the System V ABI. There are a handful of C6000-specific dynamic tags, listed in Table 14-4.
Name | Value | d_un | Executable | Shared Object |
---|---|---|---|---|
DT_C6000_GSYM_OFFSET | 0x6000000D | d_val | Optional | Optional |
DT_C6000_GSTR_OFFSET | 0x6000000F | d_val | Optional | Optional |
DT_C6000_PRELINKED | 0x60000011 | d_val | Optional | Optional |
DT_C6000_DSBT_BASE | 0x70000000 | d_ptr | Mandatory (if DSBT model) | Mandatory (if DSBT model) |
DT_C6000_DSBT_SIZE | 0x70000001 | d_val | Mandatory (if DSBT model) | Mandatory (if DSBT model) |
DT_C6000_PREEMPTMAP | 0x70000002 | d_ptr | Optional | Optional |
DT_C6000_DSBT_INDEX | 0x70000003 | d_val | Optional | Optional |
Global Symbol Marker Tags
Symbols in the dynamic symbol table are designated as local or global. Local symbols are needed only for relocation of their containing module; they are not involved in dynamic symbol resolution, so the dynamic loader can throw them away after relocating the module. Grouping the local symbols before the global symbols in the dynamic symbol table helps the dynamic loader exploit this opportunity on bare-metal platforms. The DT_C6000_GSYM_OFFSET tag contains the offset of the first global symbol in the dynamic symbol table (.dynsym). The DT_C6000_GSTR_OFFSET tag contains the offset of the first global symbol name in the dynamic string table (.dynstr).
Local symbols may still be present after the locations marked by the tags, but there are guaranteed to be no global symbols before the marked locations.
DT_C6000_PRELINKED
This tag is used only in bare-metal load modules. It indicates that the file has had its virtual address assigned, perhaps by a prelinker or similar tool. The value represents a timestamp.
DT_C6000_PRELINKED is similar to the DT_GNU_PRELINKED tag used by the Linux prelinker, but since bare-metal prelinking is not precisely the same, a different tag is defined.
DSBT Tags
These tags are used in load modules that use the DSBT model for position independence (see Section 6.8). The DT_C6000_DSBT_BASE tag marks the statically linked location of the data segment; it corresponds to the _ _c6xabi_DSBT_BASE symbol. Since load modules are not required to contain symbol tables, the value is replicated in this tag.
The DT_C6000_DSBT_SIZE tag specifies the size reserved for the DSBT table. All load modules must have table sizes that are as least as large as the highest-numbered DSBT index among them. If a module is loaded with a too-small table or a too-large index, the loader must fail to load that module.
As described in Section 6.8, a module's DSBT index can be assigned statically by the linker or dynamically by the loader. If the load module has a statically assigned index, the DT_C6000_DSBT_INDEX tag specifies its value. No other dynamically linked module in the same process can use the same index. Modules with dynamically assignable indexes omit this tag.
DT_PREEMPTMAP
This tag contains the file offset of the preemption map for platforms that rely on static binding to pre-compute symbol preemptions.
DT_PLTGOT
This tag contains the virtual address of the Global Offset Table (GOT).
Dynamic Relocation Tags
The System V ABI defines seven dynamic tags that identify the location and type of dynamic relocations in the object file:
The base specification is unclear on whether the dynamic relocations delineated by DT_RELA and DT_RELASZ include the PLT-specific relocations delineated by DT_JMPREL and DT_PLTRELSZ. The C6000 ABI adopts the convention that the DT_RELA table includes the DT_JMPREL table.