FD.io VPP  v19.04.1-1-ge4a0f9f
Vector Packet Processing
elf.h File Reference
+ Include dependency graph for elf.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  elf_first_header_t
 
struct  elf32_file_header_t
 
struct  elf64_file_header_t
 
struct  elf32_section_header_t
 
struct  elf64_section_header_t
 
struct  elf32_segment_header_t
 
struct  elf64_segment_header_t
 
struct  elf32_symbol_t
 
struct  elf64_symbol_t
 
struct  elf_symbol_info_t
 
struct  elf32_relocation_t
 
struct  elf64_relocation_t
 
struct  elf_relocation_with_addend_t
 
struct  elf32_dynamic_entry_t
 
struct  elf64_dynamic_entry_t
 
struct  elf_dynamic_version_definition_t
 
struct  elf_dynamic_version_definition_aux_t
 
struct  elf_dynamic_version_need_t
 
struct  elf_dynamic_version_need_aux_t
 
union  elf_dynamic_version_need_union_t
 
struct  elf_note_t
 
struct  elf_symbol_table_t
 
struct  elf_relocation_table_t
 
struct  elf_section_t
 
struct  elf_segment_t
 
struct  elf_main_t
 

Macros

#define foreach_elf_file_class   _ (CLASS_NONE) _ (32BIT) _ (64BIT)
 
#define foreach_elf_data_encoding
 
#define ELF_VERSION_NONE   (0)
 
#define ELF_VERSION_CURRENT   (1)
 
#define foreach_elf_abi
 
#define foreach_elf_file_type
 
#define foreach_elf_architecture
 
#define foreach_elf32_file_header
 
#define foreach_elf64_file_header
 
#define foreach_elf32_section_header
 
#define foreach_elf64_section_header
 
#define foreach_elf32_segment_header
 
#define foreach_elf64_segment_header
 
#define foreach_elf32_symbol_header
 
#define foreach_elf64_symbol_header
 
#define foreach_elf_symbol_reserved_section_index
 
#define ELF_SYMBOL_SECTION_RESERVED_LO   0xff00
 
#define ELF_SYMBOL_SECTION_RESERVED_HI   0xffff
 
#define ELF_SYMBOL_SECTION_ARCH_SPECIFIC_LO   0xff00
 
#define ELF_SYMBOL_SECTION_ARCH_SPECIFIC_HI   0xff1f
 
#define ELF_SYMBOL_SECTION_OS_SPECIFIC_LO   0xff20
 
#define ELF_SYMBOL_SECTION_OS_SPECIFIC_HI   0xff3f
 
#define foreach_elf_section_type
 
#define foreach_elf_section_flag
 
#define foreach_elf_symbol_binding
 
#define foreach_elf_symbol_type
 
#define foreach_elf_symbol_visibility
 
#define foreach_elf_symbol_info_bound_to
 
#define foreach_elf_symbol_info_flags
 
#define elf_relocation_next(r, type)
 
#define foreach_elf_segment_type
 
#define foreach_elf_segment_flag
 
#define foreach_elf32_dynamic_entry_header
 
#define foreach_elf64_dynamic_entry_header
 
#define foreach_elf_dynamic_entry_type
 
#define ELF_DYNAMIC_FLAGS_ORIGIN   (1 << 0) /* Object may use DF_ORIGIN */
 
#define ELF_DYNAMIC_FLAGS_SYMBOLIC   (1 << 1) /* Symbol resolutions starts here */
 
#define ELF_DYNAMIC_FLAGS_TEXT_RELOCATIONS   (1 << 2) /* Object contains text relocations */
 
#define ELF_DYNAMIC_FLAGS_BIND_NOW   (1 << 3) /* No lazy binding for this object */
 
#define ELF_DYNAMIC_FLAGS_STATIC_TLS   (1 << 4) /* Module uses the static TLS model */
 
#define DF_1_NOW   0x00000001 /* Set RTLD_NOW for this object. */
 
#define DF_1_GLOBAL   0x00000002 /* Set RTLD_GLOBAL for this object. */
 
#define DF_1_GROUP   0x00000004 /* Set RTLD_GROUP for this object. */
 
#define DF_1_NODELETE   0x00000008 /* Set RTLD_NODELETE for this object. */
 
#define DF_1_LOADFLTR   0x00000010 /* Trigger filtee loading at runtime. */
 
#define DF_1_INITFIRST   0x00000020 /* Set RTLD_INITFIRST for this object */
 
#define DF_1_NOOPEN   0x00000040 /* Set RTLD_NOOPEN for this object. */
 
#define DF_1_ORIGIN   0x00000080 /* $ORIGIN must be handled. */
 
#define DF_1_DIRECT   0x00000100 /* Direct binding enabled. */
 
#define DF_1_TRANS   0x00000200
 
#define DF_1_INTERPOSE   0x00000400 /* Object is used to interpose. */
 
#define DF_1_NODEFLIB   0x00000800 /* Ignore default lib search path. */
 
#define DF_1_NODUMP   0x00001000 /* Object can't be dldump'ed. */
 
#define DF_1_CONFALT   0x00002000 /* Configuration alternative created. */
 
#define DF_1_ENDFILTEE   0x00004000 /* Filtee terminates filters search. */
 
#define DF_1_DISPRELDNE   0x00008000 /* Disp reloc applied at build time. */
 
#define DF_1_DISPRELPND   0x00010000 /* Disp reloc applied at run-time. */
 
#define DTF_1_PARINIT   0x00000001
 
#define DTF_1_CONFEXP   0x00000002
 
#define DF_P1_LAZYLOAD   0x00000001 /* Lazyload following object. */
 
#define DF_P1_GROUPPERM
 
#define ELF_DYNAMIC_VERSION_FILE   (1 << 0) /* Version definition of file itself */
 
#define ELF_DYNAMIC_VERSION_WEAK   (1 << 1) /* Weak version identifier */
 
#define ELF_DYNAMIC_VERSYM_LOCAL   0 /* Symbol is local. */
 
#define ELF_DYNAMIC_VERSYM_GLOBAL   1 /* Symbol is global. */
 
#define ELF_DYNAMIC_VERSYM_RESERVED_LO   0xff00 /* Beginning of reserved entries. */
 
#define ELF_DYNAMIC_VERSYM_ELIMINATE   0xff01 /* Symbol is to be eliminated. */
 
#define foreach_elf_dynamic_version_need_field
 
#define foreach_elf_dynamic_version_need_aux_field
 
#define ELF_NOTE_SOLARIS   "SUNW Solaris"
 
#define ELF_NOTE_GNU   "GNU"
 
#define ELF_NOTE_PAGESIZE_HINT   1
 
#define ELF_NOTE_ABI   1
 
#define ELF_NOTE_OS_LINUX   0
 
#define ELF_NOTE_OS_GNU   1
 
#define ELF_NOTE_OS_SOLARIS2   2
 
#define ELF_NOTE_OS_FREEBSD   3
 
#define foreach_elf_x86_64_relocation_type
 
#define FORMAT_ELF_MAIN_SYMBOLS   (1 << 0)
 
#define FORMAT_ELF_MAIN_RELOCATIONS   (1 << 1)
 
#define FORMAT_ELF_MAIN_DYNAMIC   (1 << 2)
 

Enumerations

enum  elf_file_class_t { ELF_N_FILE_CLASS }
 
enum  elf_data_encoding_t { ELF_N_DATA_ENCODING }
 
enum  elf_abi_t { foreach_elf_abi }
 
enum  elf_file_type_t { foreach_elf_file_type }
 
enum  elf_architecture_t { foreach_elf_architecture }
 
enum  elf_section_type_t { ELF_SECTION_OS_SPECIFIC_HI = 0x6fffffff }
 
enum  elf_section_flag_bit_t { foreach_elf_section_flag }
 
enum  elf_section_flag_t { foreach_elf_section_flag }
 
enum  elf_segment_type_t { foreach_elf_segment_type }
 
enum  elf_segment_flag_bit_t { foreach_elf_segment_flag }
 
enum  elf_segment_flag_t { foreach_elf_segment_flag }
 
enum  elf_dynamic_entry_type_t { foreach_elf_dynamic_entry_type }
 

Functions

static void elf_symbol_table_free (elf_symbol_table_t *s)
 
static u8elf_symbol_name (elf_symbol_table_t *t, elf64_symbol_t *sym)
 
static void elf_relocation_table_free (elf_relocation_table_t *r)
 
static void elf_main_init (elf_main_t *em)
 
static void elf_main_free (elf_main_t *em)
 
static void elf_get_segment_contents (elf_main_t *em, void *data, uword segment_index)
 
static void * elf_get_section_contents (elf_main_t *em, uword section_index, uword elt_size)
 
static void elf_set_section_contents (elf_main_t *em, uword section_index, void *new_contents, uword n_content_bytes)
 
static u8elf_section_name (elf_main_t *em, elf_section_t *s)
 
static u8 elf_swap_u8 (elf_main_t *em, u8 x)
 
static u16 elf_swap_u16 (elf_main_t *em, u16 x)
 
static u32 elf_swap_u32 (elf_main_t *em, u32 x)
 
static u64 elf_swap_u64 (elf_main_t *em, u64 x)
 
clib_error_telf_read_file (elf_main_t *em, char *file_name)
 
clib_error_telf_write_file (elf_main_t *em, char *file_name)
 
clib_error_telf_delete_named_section (elf_main_t *em, char *section_name)
 
clib_error_telf_parse (elf_main_t *em, void *data, uword data_bytes)
 
void elf_parse_symbols (elf_main_t *em)
 
clib_error_telf_get_section_by_name (elf_main_t *em, char *section_name, elf_section_t **result)
 
clib_error_telf_get_section_by_start_address (elf_main_t *em, uword start_address, elf_section_t **result)
 
void elf_create_section_with_contents (elf_main_t *em, char *section_name, elf64_section_header_t *header, void *contents, uword n_content_bytes)
 
uword elf_delete_segment_with_type (elf_main_t *em, elf_segment_type_t segment_type)
 
void elf_set_dynamic_entries (elf_main_t *em)
 

Variables

format_function_t format_elf_main
 
format_function_t format_elf_symbol
 

Macro Definition Documentation

#define DF_1_CONFALT   0x00002000 /* Configuration alternative created. */

Definition at line 668 of file elf.h.

#define DF_1_DIRECT   0x00000100 /* Direct binding enabled. */

Definition at line 663 of file elf.h.

#define DF_1_DISPRELDNE   0x00008000 /* Disp reloc applied at build time. */

Definition at line 670 of file elf.h.

#define DF_1_DISPRELPND   0x00010000 /* Disp reloc applied at run-time. */

Definition at line 671 of file elf.h.

#define DF_1_ENDFILTEE   0x00004000 /* Filtee terminates filters search. */

Definition at line 669 of file elf.h.

#define DF_1_GLOBAL   0x00000002 /* Set RTLD_GLOBAL for this object. */

Definition at line 656 of file elf.h.

#define DF_1_GROUP   0x00000004 /* Set RTLD_GROUP for this object. */

Definition at line 657 of file elf.h.

#define DF_1_INITFIRST   0x00000020 /* Set RTLD_INITFIRST for this object */

Definition at line 660 of file elf.h.

#define DF_1_INTERPOSE   0x00000400 /* Object is used to interpose. */

Definition at line 665 of file elf.h.

#define DF_1_LOADFLTR   0x00000010 /* Trigger filtee loading at runtime. */

Definition at line 659 of file elf.h.

#define DF_1_NODEFLIB   0x00000800 /* Ignore default lib search path. */

Definition at line 666 of file elf.h.

#define DF_1_NODELETE   0x00000008 /* Set RTLD_NODELETE for this object. */

Definition at line 658 of file elf.h.

#define DF_1_NODUMP   0x00001000 /* Object can't be dldump'ed. */

Definition at line 667 of file elf.h.

#define DF_1_NOOPEN   0x00000040 /* Set RTLD_NOOPEN for this object. */

Definition at line 661 of file elf.h.

#define DF_1_NOW   0x00000001 /* Set RTLD_NOW for this object. */

Definition at line 655 of file elf.h.

#define DF_1_ORIGIN   0x00000080 /* $ORIGIN must be handled. */

Definition at line 662 of file elf.h.

#define DF_1_TRANS   0x00000200

Definition at line 664 of file elf.h.

#define DF_P1_GROUPPERM
Value:
0x00000002 /* Symbols from next object are not
generally available. */

Definition at line 679 of file elf.h.

#define DF_P1_LAZYLOAD   0x00000001 /* Lazyload following object. */

Definition at line 678 of file elf.h.

#define DTF_1_CONFEXP   0x00000002

Definition at line 675 of file elf.h.

#define DTF_1_PARINIT   0x00000001

Definition at line 674 of file elf.h.

#define ELF_DYNAMIC_FLAGS_BIND_NOW   (1 << 3) /* No lazy binding for this object */

Definition at line 650 of file elf.h.

#define ELF_DYNAMIC_FLAGS_ORIGIN   (1 << 0) /* Object may use DF_ORIGIN */

Definition at line 647 of file elf.h.

#define ELF_DYNAMIC_FLAGS_STATIC_TLS   (1 << 4) /* Module uses the static TLS model */

Definition at line 651 of file elf.h.

#define ELF_DYNAMIC_FLAGS_SYMBOLIC   (1 << 1) /* Symbol resolutions starts here */

Definition at line 648 of file elf.h.

#define ELF_DYNAMIC_FLAGS_TEXT_RELOCATIONS   (1 << 2) /* Object contains text relocations */

Definition at line 649 of file elf.h.

#define ELF_DYNAMIC_VERSION_FILE   (1 << 0) /* Version definition of file itself */

Definition at line 701 of file elf.h.

#define ELF_DYNAMIC_VERSION_WEAK   (1 << 1) /* Weak version identifier */

Definition at line 702 of file elf.h.

#define ELF_DYNAMIC_VERSYM_ELIMINATE   0xff01 /* Symbol is to be eliminated. */

Definition at line 708 of file elf.h.

#define ELF_DYNAMIC_VERSYM_GLOBAL   1 /* Symbol is global. */

Definition at line 706 of file elf.h.

#define ELF_DYNAMIC_VERSYM_LOCAL   0 /* Symbol is local. */

Definition at line 705 of file elf.h.

#define ELF_DYNAMIC_VERSYM_RESERVED_LO   0xff00 /* Beginning of reserved entries. */

Definition at line 707 of file elf.h.

#define ELF_NOTE_ABI   1

Definition at line 779 of file elf.h.

#define ELF_NOTE_GNU   "GNU"

Definition at line 761 of file elf.h.

#define ELF_NOTE_OS_FREEBSD   3

Definition at line 787 of file elf.h.

#define ELF_NOTE_OS_GNU   1

Definition at line 785 of file elf.h.

#define ELF_NOTE_OS_LINUX   0

Definition at line 784 of file elf.h.

#define ELF_NOTE_OS_SOLARIS2   2

Definition at line 786 of file elf.h.

#define ELF_NOTE_PAGESIZE_HINT   1

Definition at line 767 of file elf.h.

#define ELF_NOTE_SOLARIS   "SUNW Solaris"

Definition at line 758 of file elf.h.

#define elf_relocation_next (   r,
  type 
)
Value:
((void *) ((r) + 1) \
+ ((type) == ELF_SECTION_RELOCATION_ADD ? sizeof ((r)->addend[0]) : 0))

Definition at line 499 of file elf.h.

#define ELF_SYMBOL_SECTION_ARCH_SPECIFIC_HI   0xff1f

Definition at line 349 of file elf.h.

#define ELF_SYMBOL_SECTION_ARCH_SPECIFIC_LO   0xff00

Definition at line 348 of file elf.h.

#define ELF_SYMBOL_SECTION_OS_SPECIFIC_HI   0xff3f

Definition at line 351 of file elf.h.

#define ELF_SYMBOL_SECTION_OS_SPECIFIC_LO   0xff20

Definition at line 350 of file elf.h.

#define ELF_SYMBOL_SECTION_RESERVED_HI   0xffff

Definition at line 347 of file elf.h.

#define ELF_SYMBOL_SECTION_RESERVED_LO   0xff00

Definition at line 346 of file elf.h.

#define ELF_VERSION_CURRENT   (1)

Definition at line 55 of file elf.h.

#define ELF_VERSION_NONE   (0)

Definition at line 54 of file elf.h.

#define foreach_elf32_dynamic_entry_header
Value:
_ (u32, type) \
_ (u32, data)
u8 data[128]
Definition: ipsec.api:248
unsigned int u32
Definition: types.h:88

Definition at line 553 of file elf.h.

#define foreach_elf32_file_header
Value:
_ (u32, entry_point) \
_ (u32, segment_header_file_offset) \
_ (u32, section_header_file_offset) \
_ (u32, flags) \
_ (u16, n_bytes_this_header) \
_ (u16, segment_header_size) \
_ (u16, segment_header_count) \
_ (u16, section_header_size) \
_ (u16, section_header_count) \
_ (u16, section_header_string_table_index)
u32 flags
Definition: vhost_user.h:115
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57

Definition at line 217 of file elf.h.

#define foreach_elf32_section_header
Value:
_ (u32, name) \
_ (u32, type) \
_ (u32, flags) \
_ (u32, exec_address) \
_ (u32, file_offset) \
_ (u32, file_size) \
_ (u32, link) \
_ (u32, additional_info) \
_ (u32, align) \
_ (u32, entry_size)
u32 flags
Definition: vhost_user.h:115
unsigned int u32
Definition: types.h:88
u8 name[64]
Definition: memclnt.api:152

Definition at line 242 of file elf.h.

#define foreach_elf32_segment_header
Value:
_ (u32, type) \
_ (u32, file_offset) \
_ (u32, virtual_address) \
_ (u32, physical_address) \
_ (u32, file_size) \
_ (u32, flags) \
_ (u32, align)
u32 flags
Definition: vhost_user.h:115
unsigned int u32
Definition: types.h:88
u64 memory_size
Definition: vhost_user.h:115

Definition at line 267 of file elf.h.

#define foreach_elf32_symbol_header
Value:
_ (u32, name) \
_ (u32, value) \
_ (u32, size) \
/* binding upper 4 bits; type lower 4 bits */ \
_ (u8, binding_and_type) \
_ (u8, visibility) \
_ (u16, section_index)
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
uword size
unsigned short u16
Definition: types.h:57
u8 name[64]
Definition: memclnt.api:152

Definition at line 288 of file elf.h.

#define foreach_elf64_dynamic_entry_header
Value:
_ (u64, type) \
_ (u64, data)
unsigned long u64
Definition: types.h:89
u8 data[128]
Definition: ipsec.api:248

Definition at line 557 of file elf.h.

#define foreach_elf64_file_header
Value:
_ (u64, entry_point) \
_ (u64, segment_header_file_offset) \
_ (u64, section_header_file_offset) \
_ (u32, flags) \
_ (u16, n_bytes_this_header) \
_ (u16, segment_header_size) \
_ (u16, segment_header_count) \
_ (u16, section_header_size) \
_ (u16, section_header_count) \
_ (u16, section_header_string_table_index)
u32 flags
Definition: vhost_user.h:115
unsigned long u64
Definition: types.h:89
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57

Definition at line 229 of file elf.h.

#define foreach_elf64_section_header
Value:
_ (u32, name) \
_ (u32, type) \
_ (u64, flags) \
_ (u64, exec_address) \
_ (u64, file_offset) \
_ (u64, file_size) \
_ (u32, link) \
_ (u32, additional_info) \
_ (u64, align) \
_ (u64, entry_size)
u32 flags
Definition: vhost_user.h:115
unsigned long u64
Definition: types.h:89
unsigned int u32
Definition: types.h:88
u8 name[64]
Definition: memclnt.api:152

Definition at line 254 of file elf.h.

#define foreach_elf64_segment_header
Value:
_ (u32, type) \
_ (u32, flags) \
_ (u64, file_offset) \
_ (u64, virtual_address) \
_ (u64, physical_address) \
_ (u64, file_size) \
_ (u64, align)
u32 flags
Definition: vhost_user.h:115
unsigned long u64
Definition: types.h:89
unsigned int u32
Definition: types.h:88
u64 memory_size
Definition: vhost_user.h:115

Definition at line 277 of file elf.h.

#define foreach_elf64_symbol_header
Value:
_ (u32, name) \
_ (u8, binding_and_type) \
_ (u8, visibility) \
_ (u16, section_index) \
_ (u64, value) \
_ (u64, size)
unsigned long u64
Definition: types.h:89
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
uword size
unsigned short u16
Definition: types.h:57
u8 name[64]
Definition: memclnt.api:152

Definition at line 297 of file elf.h.

#define foreach_elf_abi
Value:
_ (SYSV, 0) \
_ (HPUX, 1) \
_ (NETBSD, 2) \
_ (LINUX, 3) \
_ (SOLARIS, 6) \
_ (AIX, 7) \
_ (IRIX, 8) \
_ (FREEBSD, 9) \
_ (COMPAQ_TRU64, 10) \
_ (MODESTO, 11) \
_ (OPENBSD, 12) \
_ (ARM, 97) \
_ (STANDALONE, 255)

Definition at line 57 of file elf.h.

#define foreach_elf_architecture

Definition at line 85 of file elf.h.

#define foreach_elf_data_encoding
Value:
_ (ENCODING_NONE) \
_ (TWOS_COMPLEMENT_LITTLE_ENDIAN) \
_ (TWOS_COMPLEMENT_BIG_ENDIAN)

Definition at line 49 of file elf.h.

#define foreach_elf_dynamic_entry_type

Definition at line 573 of file elf.h.

#define foreach_elf_dynamic_version_need_aux_field
Value:
_ (u32, hash) \
_ (u16, flags) \
_ (u16, versym_index) \
_ (u32, name) \
_ (u32, next_offset)
u32 flags
Definition: vhost_user.h:115
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
u8 name[64]
Definition: memclnt.api:152

Definition at line 718 of file elf.h.

#define foreach_elf_dynamic_version_need_field
Value:
_ (u16, version) \
_ (u16, aux_count) \
_ (u32, file_name_offset) \
_ (u32, first_aux_offset) \
_ (u32, next_offset)
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
option version
Definition: memclnt.api:17

Definition at line 711 of file elf.h.

#define foreach_elf_file_class   _ (CLASS_NONE) _ (32BIT) _ (64BIT)

Definition at line 46 of file elf.h.

#define foreach_elf_file_type
Value:
_ (NONE, 0) \
_ (RELOC, 1) \
_ (EXEC, 2) \
_ (SHARED, 3) \
_ (CORE, 4) \
_ (OS_SPECIFIC_LO, 0xfe00) \
_ (OS_SPECIFIC_HI, 0xfeff) \
_ (ARCH_SPECIFIC_LO, 0xff00) \
_ (ARCH_SPECIFIC_HI, 0xffff)

Definition at line 73 of file elf.h.

foreach_elf_section_flag
Value:
_ (WRITE, 0) \
_ (ALLOC, 1) \
_ (EXEC, 2) \
_ (MERGE, 3) \
_ (STRING_TABLE, 5) \
_ (INFO_LINK, 6) \
_ (PRESERVE_LINK_ORDER, 7) \
_ (OS_NON_CONFORMING, 8) \
_ (GROUP, 9) \
_ (TLS, 10) \
_ (OS_SPECIFIC_LO, 20) \
_ (OS_SPECIFIC_HI, 27) \
_ (ARCH_SPECIFIC_LO, 28) \
_ (ARCH_SPECIFIC_HI, 31)

Definition at line 386 of file elf.h.

#define foreach_elf_section_type
Value:
_ (UNUSED, 0) \
_ (PROGRAM_DATA, 1) \
_ (SYMBOL_TABLE, 2) \
_ (STRING_TABLE, 3) \
_ (RELOCATION_ADD, 4) \
_ (SYMBOL_TABLE_HASH, 5) \
_ (DYNAMIC, 6) /* Dynamic linking information */ \
_ (NOTE, 7) /* Notes */ \
_ (NO_BITS, 8) /* Program space with no data (bss) */ \
_ (RELOCATION, 9) /* Relocation entries, no addends */ \
_ (DYNAMIC_SYMBOL_TABLE, 11) /* Dynamic linker symbol table */ \
_ (INIT_ARRAY, 14) /* Array of constructors */ \
_ (FINI_ARRAY, 15) /* Array of destructors */ \
_ (PREINIT_ARRAY, 16) /* Array of pre-constructors */ \
_ (GROUP, 17) /* Section group */ \
_ (SYMTAB_SHNDX, 18) /* Extended section indices */ \
_ (OS_SPECIFIC_LO, 0x60000000) /* Start OS-specific */ \
_ (GNU_LIBLIST, 0x6ffffff7) /* Prelink library list */ \
_ (CHECKSUM, 0x6ffffff8) /* Checksum for DSO content. */ \
_ (SUNW_MOVE, 0x6ffffffa) \
_ (SUNW_COMDAT, 0x6ffffffb) \
_ (SUNW_SYMINFO, 0x6ffffffc) \
_ (GNU_VERDEF, 0x6ffffffd) /* Version definition section. */ \
_ (GNU_VERNEED, 0x6ffffffe) /* Version needs section. */ \
_ (GNU_VERSYM, 0x6fffffff) /* Version symbol table. */ \
_ (ARCH_SPECIFIC_LO, 0x70000000) /* Start of processor-specific */ \
_ (ARCH_SPECIFIC_HI, 0x7fffffff) /* End of processor-specific */ \
_ (APP_SPECIFIC_LO, 0x80000000) /* Start of application-specific */ \
_ (APP_SPECIFIC_HI, 0x8fffffff) /* End of application-specific */

Definition at line 354 of file elf.h.

foreach_elf_segment_flag
Value:
_ (EXEC, 0) \
_ (WRITE, 1) \
_ (READ, 2) \
_ (OS_SPECIFIC_LO, 20) \
_ (OS_SPECIFIC_HI, 27) \
_ (ARCH_SPECIFIC_LO, 28) \
_ (ARCH_SPECIFIC_HI, 31)

Definition at line 523 of file elf.h.

#define foreach_elf_segment_type
Value:
_ (UNUSED, 0) \
_ (LOAD, 1) /* Loadable program segment */ \
_ (DYNAMIC, 2) /* Dynamic linking information */ \
_ (INTERP, 3) /* Program interpreter */ \
_ (NOTE, 4) /* Auxiliary information */ \
_ (SEGMENT_TABLE, 6) /* Entry for header table itself */ \
_ (TLS, 7) /* Thread-local storage segment */ \
_ (OS_SPECIFIC_LO, 0x60000000) /* Start of OS-specific */ \
_ (GNU_EH_FRAME, 0x6474e550) /* GCC .eh_frame_hdr segment */ \
_ (GNU_STACK, 0x6474e551) /* Indicates stack executability */ \
_ (GNU_RELRO, 0x6474e552) /* Read-only after relocation */ \
_ (SUNW_BSS, 0x6ffffffa) /* Sun specific BSS */ \
_ (SUNW_STACK, 0x6ffffffb) /* Sun specific stack */ \
_ (OS_SPECIFIC_HI, 0x6fffffff) /* End of OS-specific */ \
_ (ARCH_SPECIFIC_LO, 0x70000000) /* Start of processor-specific */ \
_ (ARCH_SPECIFIC_HI, 0x7fffffff) /* End of processor-specific */

Definition at line 504 of file elf.h.

#define foreach_elf_symbol_binding
Value:
_ (LOCAL, 0) /* Local symbol */ \
_ (GLOBAL, 1) /* Global symbol */ \
_ (WEAK, 2) /* Weak symbol */ \
_ (OS_SPECIFIC_LO, 10) /* Start of OS-specific */ \
_ (OS_SPECIFIC_HI, 12) /* End of OS-specific */ \
_ (ARCH_SPECIFIC_LO, 13) /* Start of processor-specific */ \
_ (ARCH_SPECIFIC_HI, 15) /* End of processor-specific */

Definition at line 425 of file elf.h.

#define foreach_elf_symbol_info_bound_to
Value:
_ (SELF, 0xffff) /* Symbol bound to self */ \
_ (PARENT, 0xfffe) /* Symbol bound to parent */ \
_ (RESERVED_LO, 0xff00) \
_ (RESERVED_HI, 0xffff)

Definition at line 464 of file elf.h.

#define foreach_elf_symbol_info_flags
Value:
_ (DIRECT) /* Direct bound symbol */ \
_ (PASS_THRU) /* Pass-thru symbol for translator */ \
_ (COPY) /* Symbol is a copy-reloc */ \
_ (LAZY_LOAD) /* Symbol bound to object to be lazy loaded */

Definition at line 471 of file elf.h.

#define foreach_elf_symbol_reserved_section_index
Value:
_ (ABSOLUTE, 0xfff1) /* Associated symbol is absolute */ \
_ (COMMON, 0xfff2) /* Associated symbol is common */ \
_ (XINDEX, 0xffff) /* Index is in extra table. */

Definition at line 341 of file elf.h.

#define foreach_elf_symbol_type
Value:
_ (NONE, 0) \
_ (DATA, 1) /* Symbol is a data object */ \
_ (CODE, 2) /* Symbol is a code object */ \
_ (SECTION, 3) /* Symbol associated with a section */ \
_ (FILE, 4) /* Symbol's name is file name */ \
_ (COMMON, 5) /* Symbol is a common data object */ \
_ (TLS, 6) /* Symbol is thread-local data */ \
_ (OS_SPECIFIC_LO, 10) /* Start of OS-specific */ \
_ (OS_SPECIFIC_HI, 12) /* End of OS-specific */ \
_ (ARCH_SPECIFIC_LO, 13) /* Start of processor-specific */ \
_ (ARCH_SPECIFIC_HI, 15) /* End of processor-specific */

Definition at line 435 of file elf.h.

#define foreach_elf_symbol_visibility
Value:
_ (DEFAULT, 0) /* Default symbol visibility rules */ \
_ (INTERNAL, 1) /* Processor specific hidden class */ \
_ (HIDDEN, 2) /* Unavailable in other modules */ \
_ (PROTECTED, 3) /* Not preemptible, not exported */

Definition at line 449 of file elf.h.

#define foreach_elf_x86_64_relocation_type
Value:
_ (NONE, 0) /* No reloc */ \
_ (DIRECT_64, 1) /* Direct 64 bit */ \
_ (PC_REL_I32, 2) /* PC relative 32 bit signed */ \
_ (GOT_REL_32, 3) /* 32 bit GOT entry */ \
_ (PLT_REL_32, 4) /* 32 bit PLT address */ \
_ (COPY, 5) /* Copy symbol at runtime */ \
_ (CREATE_GOT, 6) /* Create GOT entry */ \
_ (CREATE_PLT, 7) /* Create PLT entry */ \
_ (RELATIVE, 8) /* Adjust by program base */ \
_ (PC_REL_I32_GOT, 9) /* 32 bit PC relative offset to GOT */ \
_ (DIRECT_U32, 10) /* Direct 32 bit zero extended */ \
_ (DIRECT_I32, 11) /* Direct 32 bit sign extended */ \
_ (DIRECT_U16, 12) /* Direct 16 bit zero extended */ \
_ (PC_REL_I16, 13) /* 16 bit sign extended pc relative */ \
_ (DIRECT_I8, 14) /* Direct 8 bit sign extended */ \
_ (PC_REL_I8, 15) /* 8 bit sign extended pc relative */ \
_ (DTPMOD64, 16) /* ID of module containing symbol */ \
_ (DTPOFF64, 17) /* Offset in module's TLS block */ \
_ (TPOFF64, 18) /* Offset in initial TLS block */ \
_ (TLSGD, 19) /* 32 bit signed PC relative offset to two GOT entries for GD symbol */ \
_ (TLSLD, 20) /* 32 bit signed PC relative offset to two GOT entries for LD symbol */ \
_ (DTPOFF32, 21) /* Offset in TLS block */ \
_ (GOTTPOFF, 22) /* 32 bit signed PC relative offset to GOT entry for IE symbol */ \
_ (TPOFF32, 23) /* Offset in initial TLS, block) */

Definition at line 790 of file elf.h.

#define FORMAT_ELF_MAIN_DYNAMIC   (1 << 2)

Definition at line 1028 of file elf.h.

#define FORMAT_ELF_MAIN_RELOCATIONS   (1 << 1)

Definition at line 1027 of file elf.h.

#define FORMAT_ELF_MAIN_SYMBOLS   (1 << 0)

Definition at line 1026 of file elf.h.

Enumeration Type Documentation

enum elf_abi_t
Enumerator
foreach_elf_abi 

Definition at line 178 of file elf.h.

Enumerator
foreach_elf_architecture 

Definition at line 190 of file elf.h.

Enumerator
ELF_N_DATA_ENCODING 

Definition at line 169 of file elf.h.

Enumerator
foreach_elf_dynamic_entry_type 

Definition at line 639 of file elf.h.

Enumerator
ELF_N_FILE_CLASS 

Definition at line 164 of file elf.h.

Enumerator
foreach_elf_file_type 

Definition at line 183 of file elf.h.

Enumerator
foreach_elf_section_flag 

Definition at line 410 of file elf.h.

Enumerator
foreach_elf_section_flag 

Definition at line 417 of file elf.h.

Enumerator
ELF_SECTION_OS_SPECIFIC_HI 

Definition at line 402 of file elf.h.

Enumerator
foreach_elf_segment_flag 

Definition at line 539 of file elf.h.

Enumerator
foreach_elf_segment_flag 

Definition at line 546 of file elf.h.

Enumerator
foreach_elf_segment_type 

Definition at line 532 of file elf.h.

Function Documentation

void elf_create_section_with_contents ( elf_main_t em,
char *  section_name,
elf64_section_header_t header,
void *  contents,
uword  n_content_bytes 
)

Definition at line 1963 of file elf.c.

clib_error_t* elf_delete_named_section ( elf_main_t em,
char *  section_name 
)

Definition at line 1948 of file elf.c.

+ Here is the call graph for this function:

uword elf_delete_segment_with_type ( elf_main_t em,
elf_segment_type_t  segment_type 
)

Definition at line 2014 of file elf.c.

clib_error_t* elf_get_section_by_name ( elf_main_t em,
char *  section_name,
elf_section_t **  result 
)

Definition at line 47 of file elf.c.

+ Here is the caller graph for this function:

clib_error_t* elf_get_section_by_start_address ( elf_main_t em,
uword  start_address,
elf_section_t **  result 
)

Definition at line 69 of file elf.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void* elf_get_section_contents ( elf_main_t em,
uword  section_index,
uword  elt_size 
)
inlinestatic

Definition at line 958 of file elf.h.

+ Here is the caller graph for this function:

static void elf_get_segment_contents ( elf_main_t em,
void *  data,
uword  segment_index 
)
inlinestatic

Definition at line 949 of file elf.h.

static void elf_main_free ( elf_main_t em)
inlinestatic

Definition at line 926 of file elf.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void elf_main_init ( elf_main_t em)
inlinestatic

Definition at line 920 of file elf.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* elf_parse ( elf_main_t em,
void *  data,
uword  data_bytes 
)

Definition at line 978 of file elf.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void elf_parse_symbols ( elf_main_t em)

Definition at line 869 of file elf.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

clib_error_t* elf_read_file ( elf_main_t em,
char *  file_name 
)

Definition at line 1329 of file elf.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void elf_relocation_table_free ( elf_relocation_table_t r)
inlinestatic

Definition at line 848 of file elf.h.

+ Here is the caller graph for this function:

static u8* elf_section_name ( elf_main_t em,
elf_section_t s 
)
inlinestatic

Definition at line 994 of file elf.h.

+ Here is the caller graph for this function:

void elf_set_dynamic_entries ( elf_main_t em)

Definition at line 899 of file elf.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void elf_set_section_contents ( elf_main_t em,
uword  section_index,
void *  new_contents,
uword  n_content_bytes 
)
inlinestatic

Definition at line 982 of file elf.h.

+ Here is the caller graph for this function:

static u16 elf_swap_u16 ( elf_main_t em,
u16  x 
)
inlinestatic

Definition at line 1009 of file elf.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 elf_swap_u32 ( elf_main_t em,
u32  x 
)
inlinestatic

Definition at line 1015 of file elf.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u64 elf_swap_u64 ( elf_main_t em,
u64  x 
)
inlinestatic

Definition at line 1021 of file elf.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u8 elf_swap_u8 ( elf_main_t em,
u8  x 
)
inlinestatic

Definition at line 1003 of file elf.h.

static u8* elf_symbol_name ( elf_symbol_table_t t,
elf64_symbol_t sym 
)
inlinestatic

Definition at line 835 of file elf.h.

+ Here is the caller graph for this function:

static void elf_symbol_table_free ( elf_symbol_table_t s)
inlinestatic

Definition at line 828 of file elf.h.

+ Here is the caller graph for this function:

clib_error_t* elf_write_file ( elf_main_t em,
char *  file_name 
)

Definition at line 1752 of file elf.c.

+ Here is the call graph for this function:

Variable Documentation

format_function_t format_elf_main

Definition at line 1030 of file elf.h.

format_function_t format_elf_symbol

Definition at line 1031 of file elf.h.