📄 elf.h
字号:
/* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's approach. */#define DT_VALRNGLO 0x6ffffd00#define DT_GNU_PRELINKED 0x6ffffdf5 /* Prelinking timestamp */#define DT_GNU_CONFLICTSZ 0x6ffffdf6 /* Size of conflict section */#define DT_GNU_LIBLISTSZ 0x6ffffdf7 /* Size of library list */#define DT_CHECKSUM 0x6ffffdf8#define DT_PLTPADSZ 0x6ffffdf9#define DT_MOVEENT 0x6ffffdfa#define DT_MOVESZ 0x6ffffdfb#define DT_FEATURE_1 0x6ffffdfc /* Feature selection (DTF_*). */#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting the following DT_* entry. */#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */#define DT_VALRNGHI 0x6ffffdff#define DT_VALTAGIDX(tag) (DT_VALRNGHI - (tag)) /* Reverse order! */#define DT_VALNUM 12/* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the Dyn.d_un.d_ptr field of the Elf*_Dyn structure. If any adjustment is made to the ELF object after it has been built these entries will need to be adjusted. */#define DT_ADDRRNGLO 0x6ffffe00#define DT_GNU_CONFLICT 0x6ffffef8 /* Start of conflict section */#define DT_GNU_LIBLIST 0x6ffffef9 /* Library list */#define DT_CONFIG 0x6ffffefa /* Configuration information. */#define DT_DEPAUDIT 0x6ffffefb /* Dependency auditing. */#define DT_AUDIT 0x6ffffefc /* Object auditing. */#define DT_PLTPAD 0x6ffffefd /* PLT padding. */#define DT_MOVETAB 0x6ffffefe /* Move table. */#define DT_SYMINFO 0x6ffffeff /* Syminfo table. */#define DT_ADDRRNGHI 0x6ffffeff#define DT_ADDRTAGIDX(tag) (DT_ADDRRNGHI - (tag)) /* Reverse order! */#define DT_ADDRNUM 10/* The versioning entry types. The next are defined as part of the GNU extension. */#define DT_VERSYM 0x6ffffff0#define DT_RELACOUNT 0x6ffffff9#define DT_RELCOUNT 0x6ffffffa/* These were chosen by Sun. */#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */#define DT_VERDEF 0x6ffffffc /* Address of version definition table */#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */#define DT_VERNEED 0x6ffffffe /* Address of table with needed versions */#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */#define DT_VERSIONTAGNUM 16/* Sun added these machine-independent extensions in the "processor-specific" range. Be compatible. */#define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */#define DT_FILTER 0x7fffffff /* Shared object to get values from */#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)#define DT_EXTRANUM 3/* Values of `d_un.d_val' in the DT_FLAGS entry. */#define DF_ORIGIN 0x00000001 /* Object may use DF_ORIGIN */#define DF_SYMBOLIC 0x00000002 /* Symbol resolutions starts here */#define DF_TEXTREL 0x00000004 /* Object contains text relocations */#define DF_BIND_NOW 0x00000008 /* No lazy binding for this object */#define DF_STATIC_TLS 0x00000010 /* Module uses the static TLS model *//* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry in the dynamic section. */#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. *//* Flags for the feature selection in DT_FEATURE_1. */#define DTF_1_PARINIT 0x00000001#define DTF_1_CONFEXP 0x00000002/* Flags in the DT_POSFLAG_1 entry effecting only the next DT_* entry. */#define DF_P1_LAZYLOAD 0x00000001 /* Lazyload following object. */#define DF_P1_GROUPPERM 0x00000002 /* Symbols from next object are not generally available. *//* Special section indices. */#define SHN_UNDEF 0 /* Undefined section */#define SHN_LORESERVE 0xff00 /* Start of reserved indices */#define SHN_LOPROC 0xff00 /* Start of processor-specific */#define SHN_HIPROC 0xff1f /* End of processor-specific */#define SHN_LOOS 0xff20 /* Start of OS-specific */#define SHN_HIOS 0xff3f /* End of OS-specific */#define SHN_ABS 0xfff1 /* Associated symbol is absolute */#define SHN_COMMON 0xfff2 /* Associated symbol is common */#define SHN_XINDEX 0xffff /* Index is in extra table. */#define SHN_HIRESERVE 0xffff /* End of reserved indices *//* Legal values for sh_type (section type). */#define SHT_NULL 0 /* Section header table entry unused */#define SHT_PROGBITS 1 /* Program data */#define SHT_SYMTAB 2 /* Symbol table */#define SHT_STRTAB 3 /* String table */#define SHT_RELA 4 /* Relocation entries with addends */#define SHT_HASH 5 /* Symbol hash table */#define SHT_DYNAMIC 6 /* Dynamic linking information */#define SHT_NOTE 7 /* Notes */#define SHT_NOBITS 8 /* Program space with no data (bss) */#define SHT_REL 9 /* Relocation entries, no addends */#define SHT_SHLIB 10 /* Reserved */#define SHT_DYNSYM 11 /* Dynamic linker symbol table */#define SHT_INIT_ARRAY 14 /* Array of constructors */#define SHT_FINI_ARRAY 15 /* Array of destructors */#define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */#define SHT_GROUP 17 /* Section group */#define SHT_SYMTAB_SHNDX 18 /* Extended section indeces */#define SHT_NUM 19 /* Number of defined types. */#define SHT_LOOS 0x60000000 /* Start OS-specific */#define SHT_GNU_LIBLIST 0x6ffffff7 /* Prelink library list */#define SHT_CHECKSUM 0x6ffffff8 /* Checksum for DSO content. */#define SHT_LOSUNW 0x6ffffffa /* Sun-specific low bound. */#define SHT_SUNW_move 0x6ffffffa#define SHT_SUNW_COMDAT 0x6ffffffb#define SHT_SUNW_syminfo 0x6ffffffc#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */#define SHT_HIOS 0x6fffffff /* End OS-specific type */#define SHT_LOPROC 0x70000000 /* Start of processor-specific */#define SHT_HIPROC 0x7fffffff /* End of processor-specific */#define SHT_LOUSER 0x80000000 /* Start of application-specific */#define SHT_HIUSER 0x8fffffff /* End of application-specific *//* Legal values for sh_flags (section flags). */#define SHF_WRITE (1 << 0) /* Writable */#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */#define SHF_EXECINSTR (1 << 2) /* Executable */#define SHF_MERGE (1 << 4) /* Might be merged */#define SHF_STRINGS (1 << 5) /* Contains nul-terminated strings */#define SHF_INFO_LINK (1 << 6) /* `sh_info' contains SHT index */#define SHF_LINK_ORDER (1 << 7) /* Preserve order after combining */#define SHF_OS_NONCONFORMING (1 << 8) /* Non-standard OS specific handling required */#define SHF_GROUP (1 << 9) /* Section is member of a group. */#define SHF_TLS (1 << 10) /* Section hold thread-local data. */#define SHF_MASKOS 0x0ff00000 /* OS-specific. */#define SHF_MASKPROC 0xf0000000 /* Processor-specific *//* Section group handling. */#define GRP_COMDAT 0x1 /* Mark group as COMDAT. *//* Symbol table entry. */typedef struct{ Elf32_Word st_name; /* Symbol name (string tbl index) */ Elf32_Addr st_value; /* Symbol value */ Elf32_Word st_size; /* Symbol size */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf32_Section st_shndx; /* Section index */} Elf32_Sym;typedef struct{ Elf64_Word st_name; /* Symbol name (string tbl index) */ unsigned char st_info; /* Symbol type and binding */ unsigned char st_other; /* Symbol visibility */ Elf64_Section st_shndx; /* Section index */ Elf64_Addr st_value; /* Symbol value */ Elf64_Xword st_size; /* Symbol size */} Elf64_Sym;/* Relocation table entry without addend (in section of type SHT_REL). */typedef struct{ Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */} Elf32_Rel;/* I have seen two different definitions of the Elf64_Rel and Elf64_Rela structures, so we'll leave them out until Novell (or whoever) gets their act together. *//* The following, at least, is used on Sparc v9, MIPS, and Alpha. */typedef struct{ Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */} Elf64_Rel;/* Relocation table entry with addend (in section of type SHT_RELA). */typedef struct{ Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */ Elf32_Sword r_addend; /* Addend */} Elf32_Rela;typedef struct{ Elf64_Addr r_offset; /* Address */ Elf64_Xword r_info; /* Relocation type and symbol index */ Elf64_Sxword r_addend; /* Addend */} Elf64_Rela;/* How to extract and insert information held in the r_info field. */#define ELF32_R_SYM(val) ((val) >> 8)#define ELF32_R_TYPE(val) ((val) & 0xff)#define ELF32_R_INFO(sym, type) (((sym) << 8) +((type) & 0xff))#define ELF64_R_SYM(i) ((i) >> 32)#define ELF64_R_TYPE(i) ((i) & 0xffffffff)#define ELF64_R_INFO(sym,type) ((((Elf64_Xword) (sym)) << 32) +(type))/* Intel 80386 specific definitions. *//* i386 relocs. */#define R_386_NONE 0 /* No reloc */#define R_386_32 1 /* Direct 32 bit */#define R_386_PC32 2 /* PC relative 32 bit */#define R_386_GOT32 3 /* 32 bit GOT entry */#define R_386_PLT32 4 /* 32 bit PLT address */#define R_386_COPY 5 /* Copy symbol at runtime */#define R_386_GLOB_DAT 6 /* Create GOT entry */#define R_386_JMP_SLOT 7 /* Create PLT entry */#define R_386_RELATIVE 8 /* Adjust by program base */#define R_386_GOTOFF 9 /* 32 bit offset to GOT */#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */#define R_386_32PLT 11#define R_386_TLS_TPOFF 14 /* Offset in static TLS block */#define R_386_TLS_IE 15 /* Address of GOT entry for static TLS block offset */#define R_386_TLS_GOTIE 16 /* GOT entry for static TLS block offset */#define R_386_TLS_LE 17 /* Offset relative to static TLS block */#define R_386_TLS_GD 18 /* Direct 32 bit for GNU version of general dynamic thread local data */#define R_386_TLS_LDM 19 /* Direct 32 bit for GNU version of local dynamic thread local data in LE code */#define R_386_16 20#define R_386_PC16 21#define R_386_8 22#define R_386_PC8 23#define R_386_TLS_GD_32 24 /* Direct 32 bit for general dynamic thread local data */#define R_386_TLS_GD_PUSH 25 /* Tag for pushl in GD TLS code */#define R_386_TLS_GD_CALL 26 /* Relocation for call to __tls_get_addr() */#define R_386_TLS_GD_POP 27 /* Tag for popl in GD TLS code */#define R_386_TLS_LDM_32 28 /* Direct 32 bit for local dynamic thread local data in LE code */#define R_386_TLS_LDM_PUSH 29 /* Tag for pushl in LDM TLS code */#define R_386_TLS_LDM_CALL 30 /* Relocation for call to __tls_get_addr() in LDM code */#define R_386_TLS_LDM_POP 31 /* Tag for popl in LDM TLS code */#define R_386_TLS_LDO_32 32 /* Offset relative to TLS block */#define R_386_TLS_IE_32 33 /* GOT entry for negated static TLS block offset */#define R_386_TLS_LE_32 34 /* Negated offset relative to static TLS block */#define R_386_TLS_DTPMOD32 35 /* ID of module containing symbol */#define R_386_TLS_DTPOFF32 36 /* Offset in TLS block */#define R_386_TLS_TPOFF32 37 /* Negated offset in static TLS block *//* Keep this the last entry. */#define R_386_NUM 38#endif /* ASSEMBLY */#endif /* ELF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -