elf-0.22: Parser for ELF object format.Source codeContentsIndex
Data.Elf
Description
Data.Elf is a module for parsing a ByteString of an ELF file into an Elf record.
Synopsis
parseElf :: ByteString -> Elf
data Elf = Elf {
elfClass :: ElfClass
elfData :: ElfData
elfVersion :: Int
elfOSABI :: ElfOSABI
elfABIVersion :: Int
elfType :: ElfType
elfMachine :: ElfMachine
elfEntry :: Word64
elfSections :: [ElfSection]
}
data ElfSection = ElfSection {
elfSectionName :: String
elfSectionType :: ElfSectionType
elfSectionFlags :: [ElfSectionFlags]
elfSectionAddr :: Word64
elfSectionSize :: Word64
elfSectionLink :: Word32
elfSectionInfo :: Word32
elfSectionAddrAlign :: Word64
elfSectionEntSize :: Word64
elfSectionData :: ByteString
}
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 ElfClass
= ELFCLASS32
| ELFCLASS64
data ElfData
= ELFDATA2LSB
| ELFDATA2MSB
data ElfOSABI
= ELFOSABI_SYSV
| ELFOSABI_HPUX
| ELFOSABI_NETBSD
| ELFOSABI_LINUX
| ELFOSABI_SOLARIS
| ELFOSABI_AIX
| ELFOSABI_IRIX
| ELFOSABI_FREEBSD
| ELFOSABI_TRU64
| ELFOSABI_MODESTO
| ELFOSABI_OPENBSD
| ELFOSABI_OPENVMS
| ELFOSABI_NSK
| ELFOSABI_AROS
| ELFOSABI_ARM
| ELFOSABI_STANDALONE
| ELFOSABI_EXT Word8
data ElfType
= ET_NONE
| ET_REL
| ET_EXEC
| ET_DYN
| ET_CORE
| ET_EXT Word16
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
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.
data Elf Source
Constructors
Elf
elfClass :: ElfClassIdentifies the class of the object file.
elfData :: ElfDataIdentifies the data encoding of the object file.
elfVersion :: IntIdentifies the version of the object file format.
elfOSABI :: ElfOSABIIdentifies the operating system and ABI for which the object is prepared.
elfABIVersion :: IntIdentifies the ABI version for which the object is prepared.
elfType :: ElfTypeIdentifies the object file type.
elfMachine :: ElfMachineIdentifies the target architecture.
elfEntry :: Word64Virtual address of the program entry point. 0 for non-executable Elfs.
elfSections :: [ElfSection]List of sections in the file.
show/hide Instances
data ElfSection Source
Constructors
ElfSection
elfSectionName :: StringIdentifies the name of the section.
elfSectionType :: ElfSectionTypeIdentifies the type of the section.
elfSectionFlags :: [ElfSectionFlags]Identifies the attributes of the section.
elfSectionAddr :: Word64The virtual address of the beginning of the section in memory. 0 for sections that are not loaded into target memory.
elfSectionSize :: Word64The size of the section. Except for SHT_NOBITS sections, this is the size of elfSectionData.
elfSectionLink :: Word32Contains a section index of an associated section, depending on section type.
elfSectionInfo :: Word32Contains extra information for the index, depending on type.
elfSectionAddrAlign :: Word64Contains the required alignment of the section. Must be a power of two.
elfSectionEntSize :: Word64Size of entries if section has a table.
elfSectionData :: ByteStringThe raw data for the section.
show/hide Instances
data ElfSectionType Source
Constructors
SHT_NULLIdentifies an empty section header.
SHT_PROGBITSContains information defined by the program
SHT_SYMTABContains a linker symbol table
SHT_STRTABContains a string table
SHT_RELAContains Rela type relocation entries
SHT_HASHContains a symbol hash table
SHT_DYNAMICContains dynamic linking tables
SHT_NOTEContains note information
SHT_NOBITSContains uninitialized space; does not occupy any space in the file
SHT_RELContains Rel type relocation entries
SHT_SHLIBReserved
SHT_DYNSYMContains a dynamic loader symbol table
SHT_EXT Word32Processor- or environment-specific type
show/hide Instances
data ElfSectionFlags Source
Constructors
SHF_WRITESection contains writable data
SHF_ALLOCSection is allocated in memory image of program
SHF_EXECINSTRSection contains executable instructions
SHF_EXT IntProcessor- or environment-specific flag
show/hide Instances
data ElfClass Source
Constructors
ELFCLASS3232-bit ELF format
ELFCLASS6464-bit ELF format
show/hide Instances
data ElfData Source
Constructors
ELFDATA2LSBLittle-endian ELF format
ELFDATA2MSBBig-endian ELF format
show/hide Instances
data ElfOSABI Source
Constructors
ELFOSABI_SYSVNo extensions or unspecified
ELFOSABI_HPUXHewlett-Packard HP-UX
ELFOSABI_NETBSDNetBSD
ELFOSABI_LINUXLinux
ELFOSABI_SOLARISSun Solaris
ELFOSABI_AIXAIX
ELFOSABI_IRIXIRIX
ELFOSABI_FREEBSDFreeBSD
ELFOSABI_TRU64Compaq TRU64 UNIX
ELFOSABI_MODESTONovell Modesto
ELFOSABI_OPENBSDOpen BSD
ELFOSABI_OPENVMSOpen VMS
ELFOSABI_NSKHewlett-Packard Non-Stop Kernel
ELFOSABI_AROSAmiga Research OS
ELFOSABI_ARMARM
ELFOSABI_STANDALONEStandalone (embedded) application
ELFOSABI_EXT Word8Other
show/hide Instances
data ElfType Source
Constructors
ET_NONEUnspecified type
ET_RELRelocatable object file
ET_EXECExecutable object file
ET_DYNShared object file
ET_CORECore dump object file
ET_EXT Word16Other
show/hide Instances
data ElfMachine Source
Constructors
EM_NONENo machine
EM_M32AT&T WE 32100
EM_SPARCSPARC
EM_386Intel 80386
EM_68KMotorola 68000
EM_88KMotorola 88000
EM_486Intel i486 (DO NOT USE THIS ONE)
EM_860Intel 80860
EM_MIPSMIPS I Architecture
EM_S370IBM System/370 Processor
EM_MIPS_RS3_LEMIPS RS3000 Little-endian
EM_SPARC64SPARC 64-bit
EM_PARISCHewlett-Packard PA-RISC
EM_VPP500Fujitsu VPP500
EM_SPARC32PLUSEnhanced instruction set SPARC
EM_960Intel 80960
EM_PPCPowerPC
EM_PPC6464-bit PowerPC
EM_S390IBM System/390 Processor
EM_SPUCell SPU
EM_V800NEC V800
EM_FR20Fujitsu FR20
EM_RH32TRW RH-32
EM_RCEMotorola RCE
EM_ARMAdvanced RISC Machines ARM
EM_ALPHADigital Alpha
EM_SHHitachi SH
EM_SPARCV9SPARC Version 9
EM_TRICORESiemens TriCore embedded processor
EM_ARCArgonaut RISC Core, Argonaut Technologies Inc.
EM_H8_300Hitachi H8/300
EM_H8_300HHitachi H8/300H
EM_H8SHitachi H8S
EM_H8_500Hitachi H8/500
EM_IA_64Intel IA-64 processor architecture
EM_MIPS_XStanford MIPS-X
EM_COLDFIREMotorola ColdFire
EM_68HC12Motorola M68HC12
EM_MMAFujitsu MMA Multimedia Accelerator
EM_PCPSiemens PCP
EM_NCPUSony nCPU embedded RISC processor
EM_NDR1Denso NDR1 microprocessor
EM_STARCOREMotorola Star*Core processor
EM_ME16Toyota ME16 processor
EM_ST100STMicroelectronics ST100 processor
EM_TINYJAdvanced Logic Corp. TinyJ embedded processor family
EM_X86_64AMD x86-64 architecture
EM_PDSPSony DSP Processor
EM_FX66Siemens FX66 microcontroller
EM_ST9PLUSSTMicroelectronics ST9+ 8/16 bit microcontroller
EM_ST7STMicroelectronics ST7 8-bit microcontroller
EM_68HC16Motorola MC68HC16 Microcontroller
EM_68HC11Motorola MC68HC11 Microcontroller
EM_68HC08Motorola MC68HC08 Microcontroller
EM_68HC05Motorola MC68HC05 Microcontroller
EM_SVXSilicon Graphics SVx
EM_ST19STMicroelectronics ST19 8-bit microcontroller
EM_VAXDigital VAX
EM_CRISAxis Communications 32-bit embedded processor
EM_JAVELINInfineon Technologies 32-bit embedded processor
EM_FIREPATHElement 14 64-bit DSP Processor
EM_ZSPLSI Logic 16-bit DSP Processor
EM_MMIXDonald Knuth's educational 64-bit processor
EM_HUANYHarvard University machine-independent object files
EM_PRISMSiTera Prism
EM_AVRAtmel AVR 8-bit microcontroller
EM_FR30Fujitsu FR30
EM_D10VMitsubishi D10V
EM_D30VMitsubishi D30V
EM_V850NEC v850
EM_M32RMitsubishi M32R
EM_MN10300Matsushita MN10300
EM_MN10200Matsushita MN10200
EM_PJpicoJava
EM_OPENRISCOpenRISC 32-bit embedded processor
EM_ARC_A5ARC Cores Tangent-A5
EM_XTENSATensilica Xtensa Architecture
EM_VIDEOCOREAlphamosaic VideoCore processor
EM_TMM_GPPThompson Multimedia General Purpose Processor
EM_NS32KNational Semiconductor 32000 series
EM_TPCTenor Network TPC processor
EM_SNP1KTrebia SNP 1000 processor
EM_ST200STMicroelectronics (www.st.com) ST200 microcontroller
EM_IP2KUbicom IP2xxx microcontroller family
EM_MAXMAX Processor
EM_CRNational Semiconductor CompactRISC microprocessor
EM_F2MC16Fujitsu F2MC16
EM_MSP430Texas Instruments embedded microcontroller msp430
EM_BLACKFINAnalog Devices Blackfin (DSP) processor
EM_SE_C33S1C33 Family of Seiko Epson processors
EM_SEPSharp embedded microprocessor
EM_ARCAArca RISC Microprocessor
EM_UNICOREMicroprocessor series from PKU-Unity Ltd. and MPRC of Peking University
EM_EXT Word16Other
show/hide Instances
Produced by Haddock version 2.6.0