Go to main content

Oracle® Solaris 11.4 Linkers and Libraries Guide

Exit Print View

Updated: October 2019
 
 

Ancillary Section

In addition to the primary output object, the Solaris link-editor can produce one or more ancillary objects. Ancillary objects contain non-allocable sections that are normally written to the primary object. When ancillary objects are produced, the primary object and all of the associated ancillary objects contain a SHT_SUNW_ancillary section, containing information that identifies these related objects. The ancillary section from any of these objects provides the information needed to identify and interpret the other members of the group.

This section contains an array of the following structures. See sys/elf.h.

typedef struct {
        Elf32_Word      a_tag;
        union {
                Elf32_Word      a_val;
                Elf32_Addr      a_ptr;
        } a_un;
} Elf32_Ancillary;

typedef struct {
        Elf64_Xword     a_tag;
        union {
                Elf64_Xword     a_val;
                Elf64_Addr      a_ptr;
        } a_un;
} Elf64_Ancillary;

For each object with this type, a_tag controls the interpretation of a_un.

a_val

These objects represent integer values with various interpretations.

a_ptr

These objects represent program virtual addresses.

The following ancillary tags exist.

Table 24  ELF Ancillary Array Tags
Name
Value
c_un
ANC_SUNW_NULL
0
Ignored
ANC_SUNW_CHECKSUM
1
a_val
ANC_SUNW_MEMBER
2
a_ptr
ANC_SUNW_NULL

Marks the end of a group of the ancillary section.

ANC_SUNW_CHECKSUM

Provides the checksum for a file in the c_val element. When ANC_SUNW_CHECKSUM precedes the first instance of ANC_SUNW_MEMBER, it provides the checksum for the object from which the ancillary section is being read. When it follows an ANC_SUNW_MEMBER tag, it provides the checksum for that member.

ANC_SUNW_MEMBER

Specifies an object name. The a_ptr element contains the string table offset of a null-terminated string, that provides the file name.

An ancillary section must always contain an ANC_SUNW_CHECKSUM before the first instance of ANC_SUNW_MEMBER, identifying the current object. Following that, there should be an ANC_SUNW_MEMBER for each object that makes up the complete set of objects. Each ANC_SUNW_MEMBER should be followed by an ANC_SUNW_CHECKSUM for that object. A typical ancillary section is therefore be structured as follows.

Tag
Meaning
ANC_SUNW_CHECKSUM
Checksum of this object
ANC_SUNW_MEMBER
Name of object #1
ANC_SUNW_CHECKSUM
Checksum for object #1
ANC_SUNW_MEMBER
Name of object N
ANC_SUNW_CHECKSUM
Checksum for object N
ANC_SUNW_NULL

An object can therefore identify itself by comparing the initial ANC_SUNW_CHECKSUM to each of the ones that follow, until it finds a match.