JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris 11.1 Linkers and Libraries Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Part I Using the Link-Editor and Runtime Linker

1.  Introduction to the Oracle Solaris Link Editors

2.  Link-Editor

3.  Runtime Linker

4.  Shared Objects

Part II Quick Reference

5.  Link-Editor Quick Reference

Part III Advanced Topics

6.  Direct Bindings

7.  Building Objects to Optimize System Performance

8.  Mapfiles

9.  Interfaces and Versioning

10.  Establishing Dependencies with Dynamic String Tokens

11.  Extensibility Mechanisms

Part IV ELF Application Binary Interface

12.  Object File Format

File Format

Data Representation

ELF Header

ELF Identification

Data Encoding

Sections

Section Merging

Special Sections

Ancillary Section

COMDAT Section

Group Section

Capabilities Section

Hash Table Section

Move Section

Note Section

Relocation Sections

Relocation Calculations

SPARC: Relocations

SPARC: Relocation Types

64-bit SPARC: Relocation Types

x86: Relocations

32-bit x86: Relocation Types

x64: Relocation Types

String Table Section

Symbol Table Section

Symbol Values

Symbol Table Layout and Conventions

Symbol Sort Sections

Register Symbols

Syminfo Table Section

Versioning Sections

Version Definition Section

Version Dependency Section

Version Symbol Section

13.  Program Loading and Dynamic Linking

14.  Thread-Local Storage

Part V Appendices

A.  Linker and Libraries Updates and New Features

B.  System V Release 4 (Version 1) Mapfiles

Index

ELF Identification

ELF provides an object file framework to support multiple processors, multiple data encoding, and multiple classes of machines. To support this object file family, the initial bytes of the file specify how to interpret the file. These bytes are independent of the processor on which the inquiry is made and independent of the file's remaining contents.

The initial bytes of an ELF header and an object file correspond to the e_ident member.

Table 12-3 ELF Identification Index

Name
Value
Purpose
EI_MAG0
0
File identification
EI_MAG1
1
File identification
EI_MAG2
2
File identification
EI_MAG3
3
File identification
EI_CLASS
4
File class
EI_DATA
5
Data encoding
EI_VERSION
6
File version
EI_OSABI
7
Operating system/ABI identification
EI_ABIVERSION
8
ABI version
EI_PAD
9
Start of padding bytes
EI_NIDENT
16
Size of e_ident[]

These indexes access bytes that hold the following values.

EI_MAG0 - EI_MAG3

A 4–byte magic number, identifying the file as an ELF object file, as listed in the following table.

Name
Value
Position
ELFMAG0
0x7f
e_ident[EI_MAG0]
ELFMAG1
'E'
e_ident[EI_MAG1]
ELFMAG2
'L'
e_ident[EI_MAG2]
ELFMAG3
'F'
e_ident[EI_MAG3]
EI_CLASS

Byte e_ident[EI_CLASS] identifies the file's class, or capacity, as listed in the following table.

Name
Value
Meaning
ELFCLASSNONE
0
Invalid class
ELFCLASS32
1
32–bit objects
ELFCLASS64
2
64–bit objects

The file format is designed to be portable among machines of various sizes, without imposing the sizes of the largest machine on the smallest. The class of the file defines the basic types used by the data structures of the object file container. The data that is contained in object file sections can follow a different programming model.

Class ELFCLASS32 supports machines with files and virtual address spaces up to 4 gigabytes. This class uses the basic types that are defined in Table 12-1.

Class ELFCLASS64 is reserved for 64–bit architectures such as 64–bit SPARC and x64. This class uses the basic types that are defined in Table 12-2.

EI_DATA

Byte e_ident[EI_DATA] specifies the data encoding of the processor-specific data in the object file, as listed in the following table.

Name
Value
Meaning
ELFDATANONE
0
Invalid data encoding
ELFDATA2LSB
1
ELFDATA2MSB
2

More information on these encodings appears in the section Data Encoding. Other values are reserved for future use.

EI_VERSION

Byte e_ident[EI_VERSION] specifies the ELF header version number. Currently, this value must be EV_CURRENT.

EI_OSABI

Byte e_ident[EI_OSABI] identifies the operating system together with the ABI to which the object is targeted. Some fields in other ELF structures have flags and values that have operating system or ABI specific meanings. The interpretation of those fields is determined by the value of this byte.

EI_ABIVERSION

Byte e_ident[EI_ABIVERSION] identifies the version of the ABI to which the object is targeted. This field is used to distinguish among incompatible versions of an ABI. The interpretation of this version number is dependent on the ABI identified by the EI_OSABI field. If no values are specified for the EI_OSABI field for the processor, or no version values are specified for the ABI determined by a particular value of the EI_OSABI byte, the value zero is used to indicate unspecified.

EI_PAD

This value marks the beginning of the unused bytes in e_ident. These bytes are reserved and are set to zero. Programs that read object files should ignore these values.