Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/elftoolchain/libelf/_libelf.h
Show All 24 Lines | |||||
* | * | ||||
* $Id: _libelf.h 3632 2018-10-10 21:12:43Z jkoshy $ | * $Id: _libelf.h 3632 2018-10-10 21:12:43Z jkoshy $ | ||||
*/ | */ | ||||
#ifndef __LIBELF_H_ | #ifndef __LIBELF_H_ | ||||
#define __LIBELF_H_ | #define __LIBELF_H_ | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/tree.h> | |||||
#include "_libelf_config.h" | #include "_libelf_config.h" | ||||
#include "_elftc.h" | #include "_elftc.h" | ||||
/* | /* | ||||
* Library-private data structures. | * Library-private data structures. | ||||
*/ | */ | ||||
Show All 34 Lines | |||||
#define LIBELF_F_AR_HEADER 0x010000U /* translated header available */ | #define LIBELF_F_AR_HEADER 0x010000U /* translated header available */ | ||||
#define LIBELF_F_AR_VARIANT_SVR4 0x020000U /* BSD style ar(1) archive */ | #define LIBELF_F_AR_VARIANT_SVR4 0x020000U /* BSD style ar(1) archive */ | ||||
#define LIBELF_F_DATA_MALLOCED 0x040000U /* whether data was malloc'ed */ | #define LIBELF_F_DATA_MALLOCED 0x040000U /* whether data was malloc'ed */ | ||||
#define LIBELF_F_RAWFILE_MALLOC 0x080000U /* whether e_rawfile was malloc'ed */ | #define LIBELF_F_RAWFILE_MALLOC 0x080000U /* whether e_rawfile was malloc'ed */ | ||||
#define LIBELF_F_RAWFILE_MMAP 0x100000U /* whether e_rawfile was mmap'ed */ | #define LIBELF_F_RAWFILE_MMAP 0x100000U /* whether e_rawfile was mmap'ed */ | ||||
#define LIBELF_F_SHDRS_LOADED 0x200000U /* whether all shdrs were read in */ | #define LIBELF_F_SHDRS_LOADED 0x200000U /* whether all shdrs were read in */ | ||||
#define LIBELF_F_SPECIAL_FILE 0x400000U /* non-regular file */ | #define LIBELF_F_SPECIAL_FILE 0x400000U /* non-regular file */ | ||||
RB_HEAD(scntree, _Elf_Scn); | |||||
RB_PROTOTYPE(scntree, _Elf_Scn, e_scn, elfscn_cmp); | |||||
struct _Elf { | struct _Elf { | ||||
int e_activations; /* activation count */ | int e_activations; /* activation count */ | ||||
unsigned int e_byteorder; /* ELFDATA* */ | unsigned int e_byteorder; /* ELFDATA* */ | ||||
int e_class; /* ELFCLASS* */ | int e_class; /* ELFCLASS* */ | ||||
Elf_Cmd e_cmd; /* ELF_C_* used at creation time */ | Elf_Cmd e_cmd; /* ELF_C_* used at creation time */ | ||||
int e_fd; /* associated file descriptor */ | int e_fd; /* associated file descriptor */ | ||||
unsigned int e_flags; /* ELF_F_* & LIBELF_F_* flags */ | unsigned int e_flags; /* ELF_F_* & LIBELF_F_* flags */ | ||||
Elf_Kind e_kind; /* ELF_K_* */ | Elf_Kind e_kind; /* ELF_K_* */ | ||||
Show All 26 Lines | struct { /* regular ELF files */ | ||||
union { | union { | ||||
Elf32_Ehdr *e_ehdr32; | Elf32_Ehdr *e_ehdr32; | ||||
Elf64_Ehdr *e_ehdr64; | Elf64_Ehdr *e_ehdr64; | ||||
} e_ehdr; | } e_ehdr; | ||||
union { | union { | ||||
Elf32_Phdr *e_phdr32; | Elf32_Phdr *e_phdr32; | ||||
Elf64_Phdr *e_phdr64; | Elf64_Phdr *e_phdr64; | ||||
} e_phdr; | } e_phdr; | ||||
STAILQ_HEAD(, _Elf_Scn) e_scn; /* section list */ | struct scntree e_scn; /* sections */ | ||||
size_t e_nphdr; /* number of Phdr entries */ | size_t e_nphdr; /* number of Phdr entries */ | ||||
size_t e_nscn; /* number of sections */ | size_t e_nscn; /* number of sections */ | ||||
size_t e_strndx; /* string table section index */ | size_t e_strndx; /* string table section index */ | ||||
} e_elf; | } e_elf; | ||||
} e_u; | } e_u; | ||||
}; | }; | ||||
/* | /* | ||||
* The internal descriptor wrapping the "Elf_Data" type. | * The internal descriptor wrapping the "Elf_Data" type. | ||||
*/ | */ | ||||
struct _Libelf_Data { | struct _Libelf_Data { | ||||
Elf_Data d_data; /* The exported descriptor. */ | Elf_Data d_data; /* The exported descriptor. */ | ||||
Elf_Scn *d_scn; /* The containing section */ | Elf_Scn *d_scn; /* The containing section */ | ||||
unsigned int d_flags; | unsigned int d_flags; | ||||
STAILQ_ENTRY(_Libelf_Data) d_next; | STAILQ_ENTRY(_Libelf_Data) d_next; | ||||
}; | }; | ||||
struct _Elf_Scn { | struct _Elf_Scn { | ||||
union { | union { | ||||
Elf32_Shdr s_shdr32; | Elf32_Shdr s_shdr32; | ||||
Elf64_Shdr s_shdr64; | Elf64_Shdr s_shdr64; | ||||
} s_shdr; | } s_shdr; | ||||
STAILQ_HEAD(, _Libelf_Data) s_data; /* translated data */ | STAILQ_HEAD(, _Libelf_Data) s_data; /* translated data */ | ||||
STAILQ_HEAD(, _Libelf_Data) s_rawdata; /* raw data */ | STAILQ_HEAD(, _Libelf_Data) s_rawdata; /* raw data */ | ||||
STAILQ_ENTRY(_Elf_Scn) s_next; | RB_ENTRY(_Elf_Scn) s_tree; | ||||
struct _Elf *s_elf; /* parent ELF descriptor */ | struct _Elf *s_elf; /* parent ELF descriptor */ | ||||
unsigned int s_flags; /* flags for the section as a whole */ | unsigned int s_flags; /* flags for the section as a whole */ | ||||
size_t s_ndx; /* index# for this section */ | size_t s_ndx; /* index# for this section */ | ||||
uint64_t s_offset; /* managed by elf_update() */ | uint64_t s_offset; /* managed by elf_update() */ | ||||
uint64_t s_rawoff; /* original offset in the file */ | uint64_t s_rawoff; /* original offset in the file */ | ||||
uint64_t s_size; /* managed by elf_update() */ | uint64_t s_size; /* managed by elf_update() */ | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |