Data.Elf is a module for parsing a ByteString of an ELF file into an Elf record.
- parseElf :: ByteString -> Elf
- parseSymbolTables :: Elf -> [[ElfSymbolTableEntry]]
- findSymbolDefinition :: ElfSymbolTableEntry -> Maybe ByteString
- data Elf = Elf {
- elfClass :: ElfClass
- elfData :: ElfData
- elfVersion :: Int
- elfOSABI :: ElfOSABI
- elfABIVersion :: Int
- elfType :: ElfType
- elfMachine :: ElfMachine
- elfEntry :: Word64
- elfSections :: [ElfSection]
- elfSegments :: [ElfSegment]
- data ElfSection = ElfSection {}
- data ElfSectionType
- = SHT_NULL
- | SHT_PROGBITS
- | SHT_SYMTAB
- | SHT_STRTAB
- | SHT_RELA
- | SHT_HASH
- | SHT_DYNAMIC
- | SHT_NOTE
- | SHT_NOBITS
- | SHT_REL
- | SHT_SHLIB
- | SHT_DYNSYM
- | SHT_EXT Word32
- data ElfSectionFlags
- = SHF_WRITE
- | SHF_ALLOC
- | SHF_EXECINSTR
- | SHF_EXT Int
- data ElfSegment = ElfSegment {}
- data ElfSegmentType
- data ElfSegmentFlag
- data ElfClass
- = ELFCLASS32
- | ELFCLASS64
- data ElfData
- data ElfOSABI
- data ElfType
- data ElfMachine
- = EM_NONE
- | EM_M32
- | EM_SPARC
- | EM_386
- | EM_68K
- | EM_88K
- | EM_486
- | EM_860
- | EM_MIPS
- | EM_S370
- | EM_MIPS_RS3_LE
- | EM_SPARC64
- | EM_PARISC
- | EM_VPP500
- | EM_SPARC32PLUS
- | EM_960
- | EM_PPC
- | EM_PPC64
- | EM_S390
- | EM_SPU
- | EM_V800
- | EM_FR20
- | EM_RH32
- | EM_RCE
- | EM_ARM
- | EM_ALPHA
- | EM_SH
- | EM_SPARCV9
- | EM_TRICORE
- | EM_ARC
- | EM_H8_300
- | EM_H8_300H
- | EM_H8S
- | EM_H8_500
- | EM_IA_64
- | EM_MIPS_X
- | EM_COLDFIRE
- | EM_68HC12
- | EM_MMA
- | EM_PCP
- | EM_NCPU
- | EM_NDR1
- | EM_STARCORE
- | EM_ME16
- | EM_ST100
- | EM_TINYJ
- | EM_X86_64
- | EM_PDSP
- | EM_FX66
- | EM_ST9PLUS
- | EM_ST7
- | EM_68HC16
- | EM_68HC11
- | EM_68HC08
- | EM_68HC05
- | EM_SVX
- | EM_ST19
- | EM_VAX
- | EM_CRIS
- | EM_JAVELIN
- | EM_FIREPATH
- | EM_ZSP
- | EM_MMIX
- | EM_HUANY
- | EM_PRISM
- | EM_AVR
- | EM_FR30
- | EM_D10V
- | EM_D30V
- | EM_V850
- | EM_M32R
- | EM_MN10300
- | EM_MN10200
- | EM_PJ
- | EM_OPENRISC
- | EM_ARC_A5
- | EM_XTENSA
- | EM_VIDEOCORE
- | EM_TMM_GPP
- | EM_NS32K
- | EM_TPC
- | EM_SNP1K
- | EM_ST200
- | EM_IP2K
- | EM_MAX
- | EM_CR
- | EM_F2MC16
- | EM_MSP430
- | EM_BLACKFIN
- | EM_SE_C33
- | EM_SEP
- | EM_ARCA
- | EM_UNICORE
- | EM_EXT Word16
- data ElfSymbolTableEntry = EST {}
- data ElfSymbolType
- data ElfSymbolBinding
- data ElfSectionIndex
Documentation
parseElf :: ByteString -> ElfSource
Parses a ByteString into an Elf record. Parse failures call error. 32-bit ELF objects have their fields promoted to 64-bit so that the 32- and 64-bit ELF records can be the same.
parseSymbolTables :: Elf -> [[ElfSymbolTableEntry]]Source
findSymbolDefinition :: ElfSymbolTableEntry -> Maybe ByteStringSource
Use the symbol offset and size to extract its definition
(in the form of a ByteString).
If the size is zero, or the offset larger than the elfSectionData
,
then Nothing
is returned.
Elf | |
|
data ElfSection Source
ElfSection | |
|
data ElfSectionType Source
SHT_NULL | Identifies an empty section header. |
SHT_PROGBITS | Contains information defined by the program |
SHT_SYMTAB | Contains a linker symbol table |
SHT_STRTAB | Contains a string table |
SHT_RELA | Contains Rela type relocation entries |
SHT_HASH | Contains a symbol hash table |
SHT_DYNAMIC | Contains dynamic linking tables |
SHT_NOTE | Contains note information |
SHT_NOBITS | Contains uninitialized space; does not occupy any space in the file |
SHT_REL | Contains Rel type relocation entries |
SHT_SHLIB | Reserved |
SHT_DYNSYM | Contains a dynamic loader symbol table |
SHT_EXT Word32 | Processor- or environment-specific type |
data ElfSectionFlags Source
SHF_WRITE | Section contains writable data |
SHF_ALLOC | Section is allocated in memory image of program |
SHF_EXECINSTR | Section contains executable instructions |
SHF_EXT Int | Processor- or environment-specific flag |
data ElfSegment Source
ElfSegment | |
|
data ElfSegmentType Source
Segment Types.
data ElfSegmentFlag Source
ELFCLASS32 | 32-bit ELF format |
ELFCLASS64 | 64-bit ELF format |
ELFDATA2LSB | Little-endian ELF format |
ELFDATA2MSB | Big-endian ELF format |
ELFOSABI_SYSV | No extensions or unspecified |
ELFOSABI_HPUX | Hewlett-Packard HP-UX |
ELFOSABI_NETBSD | NetBSD |
ELFOSABI_LINUX | Linux |
ELFOSABI_SOLARIS | Sun Solaris |
ELFOSABI_AIX | AIX |
ELFOSABI_IRIX | IRIX |
ELFOSABI_FREEBSD | FreeBSD |
ELFOSABI_TRU64 | Compaq TRU64 UNIX |
ELFOSABI_MODESTO | Novell Modesto |
ELFOSABI_OPENBSD | Open BSD |
ELFOSABI_OPENVMS | Open VMS |
ELFOSABI_NSK | Hewlett-Packard Non-Stop Kernel |
ELFOSABI_AROS | Amiga Research OS |
ELFOSABI_ARM | ARM |
ELFOSABI_STANDALONE | Standalone (embedded) application |
ELFOSABI_EXT Word8 | Other |
data ElfMachine Source
EM_NONE | No machine |
EM_M32 | AT&T WE 32100 |
EM_SPARC | SPARC |
EM_386 | Intel 80386 |
EM_68K | Motorola 68000 |
EM_88K | Motorola 88000 |
EM_486 | Intel i486 (DO NOT USE THIS ONE) |
EM_860 | Intel 80860 |
EM_MIPS | MIPS I Architecture |
EM_S370 | IBM System/370 Processor |
EM_MIPS_RS3_LE | MIPS RS3000 Little-endian |
EM_SPARC64 | SPARC 64-bit |
EM_PARISC | Hewlett-Packard PA-RISC |
EM_VPP500 | Fujitsu VPP500 |
EM_SPARC32PLUS | Enhanced instruction set SPARC |
EM_960 | Intel 80960 |
EM_PPC | PowerPC |
EM_PPC64 | 64-bit PowerPC |
EM_S390 | IBM System/390 Processor |
EM_SPU | Cell SPU |
EM_V800 | NEC V800 |
EM_FR20 | Fujitsu FR20 |
EM_RH32 | TRW RH-32 |
EM_RCE | Motorola RCE |
EM_ARM | Advanced RISC Machines ARM |
EM_ALPHA | Digital Alpha |
EM_SH | Hitachi SH |
EM_SPARCV9 | SPARC Version 9 |
EM_TRICORE | Siemens TriCore embedded processor |
EM_ARC | Argonaut RISC Core, Argonaut Technologies Inc. |
EM_H8_300 | Hitachi H8/300 |
EM_H8_300H | Hitachi H8/300H |
EM_H8S | Hitachi H8S |
EM_H8_500 | Hitachi H8/500 |
EM_IA_64 | Intel IA-64 processor architecture |
EM_MIPS_X | Stanford MIPS-X |
EM_COLDFIRE | Motorola ColdFire |
EM_68HC12 | Motorola M68HC12 |
EM_MMA | Fujitsu MMA Multimedia Accelerator |
EM_PCP | Siemens PCP |
EM_NCPU | Sony nCPU embedded RISC processor |
EM_NDR1 | Denso NDR1 microprocessor |
EM_STARCORE | Motorola Star*Core processor |
EM_ME16 | Toyota ME16 processor |
EM_ST100 | STMicroelectronics ST100 processor |
EM_TINYJ | Advanced Logic Corp. TinyJ embedded processor family |
EM_X86_64 | AMD x86-64 architecture |
EM_PDSP | Sony DSP Processor |
EM_FX66 | Siemens FX66 microcontroller |
EM_ST9PLUS | STMicroelectronics ST9+ 8/16 bit microcontroller |
EM_ST7 | STMicroelectronics ST7 8-bit microcontroller |
EM_68HC16 | Motorola MC68HC16 Microcontroller |
EM_68HC11 | Motorola MC68HC11 Microcontroller |
EM_68HC08 | Motorola MC68HC08 Microcontroller |
EM_68HC05 | Motorola MC68HC05 Microcontroller |
EM_SVX | Silicon Graphics SVx |
EM_ST19 | STMicroelectronics ST19 8-bit microcontroller |
EM_VAX | Digital VAX |
EM_CRIS | Axis Communications 32-bit embedded processor |
EM_JAVELIN | Infineon Technologies 32-bit embedded processor |
EM_FIREPATH | Element 14 64-bit DSP Processor |
EM_ZSP | LSI Logic 16-bit DSP Processor |
EM_MMIX | Donald Knuth's educational 64-bit processor |
EM_HUANY | Harvard University machine-independent object files |
EM_PRISM | SiTera Prism |
EM_AVR | Atmel AVR 8-bit microcontroller |
EM_FR30 | Fujitsu FR30 |
EM_D10V | Mitsubishi D10V |
EM_D30V | Mitsubishi D30V |
EM_V850 | NEC v850 |
EM_M32R | Mitsubishi M32R |
EM_MN10300 | Matsushita MN10300 |
EM_MN10200 | Matsushita MN10200 |
EM_PJ | picoJava |
EM_OPENRISC | OpenRISC 32-bit embedded processor |
EM_ARC_A5 | ARC Cores Tangent-A5 |
EM_XTENSA | Tensilica Xtensa Architecture |
EM_VIDEOCORE | Alphamosaic VideoCore processor |
EM_TMM_GPP | Thompson Multimedia General Purpose Processor |
EM_NS32K | National Semiconductor 32000 series |
EM_TPC | Tenor Network TPC processor |
EM_SNP1K | Trebia SNP 1000 processor |
EM_ST200 | STMicroelectronics (www.st.com) ST200 microcontroller |
EM_IP2K | Ubicom IP2xxx microcontroller family |
EM_MAX | MAX Processor |
EM_CR | National Semiconductor CompactRISC microprocessor |
EM_F2MC16 | Fujitsu F2MC16 |
EM_MSP430 | Texas Instruments embedded microcontroller msp430 |
EM_BLACKFIN | Analog Devices Blackfin (DSP) processor |
EM_SE_C33 | S1C33 Family of Seiko Epson processors |
EM_SEP | Sharp embedded microprocessor |
EM_ARCA | Arca RISC Microprocessor |
EM_UNICORE | Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University |
EM_EXT Word16 | Other |
data ElfSymbolTableEntry Source
The symbol table entries consist of index information to be read from other parts of the ELF file. Some of this information is automatically retrieved for your convenience (including symbol name, description of the enclosing section, and definition).
EST | |
|
data ElfSymbolType Source
data ElfSymbolBinding Source