-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Parser for ELF object format.
--
-- Parser for ELF object format.
@package elf
@version 0.26
-- | Data.Elf is a module for parsing a ByteString of an ELF file into an
-- Elf record.
module Data.Elf
-- | 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.
parseElf :: ByteString -> Elf
-- | Parse the symbol table section into a list of symbol table entries. If
-- no symbol table is found then an empty list is returned. This function
-- does not consult flags to look for SHT_STRTAB (when naming symbols),
-- it just looks for particular sections of .strtab and
-- .shstrtab.
parseSymbolTables :: Elf -> [[ElfSymbolTableEntry]]
-- | 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.
findSymbolDefinition :: ElfSymbolTableEntry -> Maybe ByteString
data Elf
Elf :: ElfClass -> ElfData -> Int -> ElfOSABI -> Int -> ElfType -> ElfMachine -> Word64 -> [ElfSection] -> [ElfSegment] -> Elf
-- | Identifies the class of the object file.
elfClass :: Elf -> ElfClass
-- | Identifies the data encoding of the object file.
elfData :: Elf -> ElfData
-- | Identifies the version of the object file format.
elfVersion :: Elf -> Int
-- | Identifies the operating system and ABI for which the object is
-- prepared.
elfOSABI :: Elf -> ElfOSABI
-- | Identifies the ABI version for which the object is prepared.
elfABIVersion :: Elf -> Int
-- | Identifies the object file type.
elfType :: Elf -> ElfType
-- | Identifies the target architecture.
elfMachine :: Elf -> ElfMachine
-- | Virtual address of the program entry point. 0 for non-executable Elfs.
elfEntry :: Elf -> Word64
-- | List of sections in the file.
elfSections :: Elf -> [ElfSection]
-- | List of segments in the file.
elfSegments :: Elf -> [ElfSegment]
data ElfSection
ElfSection :: String -> ElfSectionType -> [ElfSectionFlags] -> Word64 -> Word64 -> Word32 -> Word32 -> Word64 -> Word64 -> ByteString -> ElfSection
-- | Identifies the name of the section.
elfSectionName :: ElfSection -> String
-- | Identifies the type of the section.
elfSectionType :: ElfSection -> ElfSectionType
-- | Identifies the attributes of the section.
elfSectionFlags :: ElfSection -> [ElfSectionFlags]
-- | The virtual address of the beginning of the section in memory. 0 for
-- sections that are not loaded into target memory.
elfSectionAddr :: ElfSection -> Word64
-- | The size of the section. Except for SHT_NOBITS sections, this is the
-- size of elfSectionData.
elfSectionSize :: ElfSection -> Word64
-- | Contains a section index of an associated section, depending on
-- section type.
elfSectionLink :: ElfSection -> Word32
-- | Contains extra information for the index, depending on type.
elfSectionInfo :: ElfSection -> Word32
-- | Contains the required alignment of the section. Must be a power of
-- two.
elfSectionAddrAlign :: ElfSection -> Word64
-- | Size of entries if section has a table.
elfSectionEntSize :: ElfSection -> Word64
-- | The raw data for the section.
elfSectionData :: ElfSection -> ByteString
data ElfSectionType
-- | Identifies an empty section header.
SHT_NULL :: ElfSectionType
-- | Contains information defined by the program
SHT_PROGBITS :: ElfSectionType
-- | Contains a linker symbol table
SHT_SYMTAB :: ElfSectionType
-- | Contains a string table
SHT_STRTAB :: ElfSectionType
-- | Contains Rela type relocation entries
SHT_RELA :: ElfSectionType
-- | Contains a symbol hash table
SHT_HASH :: ElfSectionType
-- | Contains dynamic linking tables
SHT_DYNAMIC :: ElfSectionType
-- | Contains note information
SHT_NOTE :: ElfSectionType
-- | Contains uninitialized space; does not occupy any space in the file
SHT_NOBITS :: ElfSectionType
-- | Contains Rel type relocation entries
SHT_REL :: ElfSectionType
-- | Reserved
SHT_SHLIB :: ElfSectionType
-- | Contains a dynamic loader symbol table
SHT_DYNSYM :: ElfSectionType
-- | Processor- or environment-specific type
SHT_EXT :: Word32 -> ElfSectionType
data ElfSectionFlags
-- | Section contains writable data
SHF_WRITE :: ElfSectionFlags
-- | Section is allocated in memory image of program
SHF_ALLOC :: ElfSectionFlags
-- | Section contains executable instructions
SHF_EXECINSTR :: ElfSectionFlags
-- | Processor- or environment-specific flag
SHF_EXT :: Int -> ElfSectionFlags
data ElfSegment
ElfSegment :: ElfSegmentType -> [ElfSegmentFlag] -> Word64 -> Word64 -> Word64 -> ByteString -> Word64 -> ElfSegment
-- | Segment type
elfSegmentType :: ElfSegment -> ElfSegmentType
-- | Segment flags
elfSegmentFlags :: ElfSegment -> [ElfSegmentFlag]
-- | Virtual address for the segment
elfSegmentVirtAddr :: ElfSegment -> Word64
-- | Physical address for the segment
elfSegmentPhysAddr :: ElfSegment -> Word64
-- | Segment alignment
elfSegmentAlign :: ElfSegment -> Word64
-- | Data for the segment
elfSegmentData :: ElfSegment -> ByteString
-- | Size in memory (may be larger then the segment's data)
elfSegmentMemSize :: ElfSegment -> Word64
-- | Segment Types.
data ElfSegmentType
-- | Unused entry
PT_NULL :: ElfSegmentType
-- | Loadable segment
PT_LOAD :: ElfSegmentType
-- | Dynamic linking tables
PT_DYNAMIC :: ElfSegmentType
-- | Program interpreter path name
PT_INTERP :: ElfSegmentType
-- | Note sectionks
PT_NOTE :: ElfSegmentType
-- | Reserved
PT_SHLIB :: ElfSegmentType
-- | Program header table
PT_PHDR :: ElfSegmentType
-- | Some other type
PT_Other :: Word32 -> ElfSegmentType
data ElfSegmentFlag
-- | Execute permission
PF_X :: ElfSegmentFlag
-- | Write permission
PF_W :: ElfSegmentFlag
-- | Read permission
PF_R :: ElfSegmentFlag
-- | Some other flag, the Int is the bit number for the flag.
PF_Ext :: Int -> ElfSegmentFlag
data ElfClass
-- | 32-bit ELF format
ELFCLASS32 :: ElfClass
-- | 64-bit ELF format
ELFCLASS64 :: ElfClass
data ElfData
-- | Little-endian ELF format
ELFDATA2LSB :: ElfData
-- | Big-endian ELF format
ELFDATA2MSB :: ElfData
data ElfOSABI
-- | No extensions or unspecified
ELFOSABI_SYSV :: ElfOSABI
-- | Hewlett-Packard HP-UX
ELFOSABI_HPUX :: ElfOSABI
-- | NetBSD
ELFOSABI_NETBSD :: ElfOSABI
-- | Linux
ELFOSABI_LINUX :: ElfOSABI
-- | Sun Solaris
ELFOSABI_SOLARIS :: ElfOSABI
-- | AIX
ELFOSABI_AIX :: ElfOSABI
-- | IRIX
ELFOSABI_IRIX :: ElfOSABI
-- | FreeBSD
ELFOSABI_FREEBSD :: ElfOSABI
-- | Compaq TRU64 UNIX
ELFOSABI_TRU64 :: ElfOSABI
-- | Novell Modesto
ELFOSABI_MODESTO :: ElfOSABI
-- | Open BSD
ELFOSABI_OPENBSD :: ElfOSABI
-- | Open VMS
ELFOSABI_OPENVMS :: ElfOSABI
-- | Hewlett-Packard Non-Stop Kernel
ELFOSABI_NSK :: ElfOSABI
-- | Amiga Research OS
ELFOSABI_AROS :: ElfOSABI
-- | ARM
ELFOSABI_ARM :: ElfOSABI
-- | Standalone (embedded) application
ELFOSABI_STANDALONE :: ElfOSABI
-- | Other
ELFOSABI_EXT :: Word8 -> ElfOSABI
data ElfType
-- | Unspecified type
ET_NONE :: ElfType
-- | Relocatable object file
ET_REL :: ElfType
-- | Executable object file
ET_EXEC :: ElfType
-- | Shared object file
ET_DYN :: ElfType
-- | Core dump object file
ET_CORE :: ElfType
-- | Other
ET_EXT :: Word16 -> ElfType
data ElfMachine
-- | No machine
EM_NONE :: ElfMachine
-- | AT&T WE 32100
EM_M32 :: ElfMachine
-- | SPARC
EM_SPARC :: ElfMachine
-- | Intel 80386
EM_386 :: ElfMachine
-- | Motorola 68000
EM_68K :: ElfMachine
-- | Motorola 88000
EM_88K :: ElfMachine
-- | Intel i486 (DO NOT USE THIS ONE)
EM_486 :: ElfMachine
-- | Intel 80860
EM_860 :: ElfMachine
-- | MIPS I Architecture
EM_MIPS :: ElfMachine
-- | IBM System/370 Processor
EM_S370 :: ElfMachine
-- | MIPS RS3000 Little-endian
EM_MIPS_RS3_LE :: ElfMachine
-- | SPARC 64-bit
EM_SPARC64 :: ElfMachine
-- | Hewlett-Packard PA-RISC
EM_PARISC :: ElfMachine
-- | Fujitsu VPP500
EM_VPP500 :: ElfMachine
-- | Enhanced instruction set SPARC
EM_SPARC32PLUS :: ElfMachine
-- | Intel 80960
EM_960 :: ElfMachine
-- | PowerPC
EM_PPC :: ElfMachine
-- | 64-bit PowerPC
EM_PPC64 :: ElfMachine
-- | IBM System/390 Processor
EM_S390 :: ElfMachine
-- | Cell SPU
EM_SPU :: ElfMachine
-- | NEC V800
EM_V800 :: ElfMachine
-- | Fujitsu FR20
EM_FR20 :: ElfMachine
-- | TRW RH-32
EM_RH32 :: ElfMachine
-- | Motorola RCE
EM_RCE :: ElfMachine
-- | Advanced RISC Machines ARM
EM_ARM :: ElfMachine
-- | Digital Alpha
EM_ALPHA :: ElfMachine
-- | Hitachi SH
EM_SH :: ElfMachine
-- | SPARC Version 9
EM_SPARCV9 :: ElfMachine
-- | Siemens TriCore embedded processor
EM_TRICORE :: ElfMachine
-- | Argonaut RISC Core, Argonaut Technologies Inc.
EM_ARC :: ElfMachine
-- | Hitachi H8/300
EM_H8_300 :: ElfMachine
-- | Hitachi H8/300H
EM_H8_300H :: ElfMachine
-- | Hitachi H8S
EM_H8S :: ElfMachine
-- | Hitachi H8/500
EM_H8_500 :: ElfMachine
-- | Intel IA-64 processor architecture
EM_IA_64 :: ElfMachine
-- | Stanford MIPS-X
EM_MIPS_X :: ElfMachine
-- | Motorola ColdFire
EM_COLDFIRE :: ElfMachine
-- | Motorola M68HC12
EM_68HC12 :: ElfMachine
-- | Fujitsu MMA Multimedia Accelerator
EM_MMA :: ElfMachine
-- | Siemens PCP
EM_PCP :: ElfMachine
-- | Sony nCPU embedded RISC processor
EM_NCPU :: ElfMachine
-- | Denso NDR1 microprocessor
EM_NDR1 :: ElfMachine
-- | Motorola Star*Core processor
EM_STARCORE :: ElfMachine
-- | Toyota ME16 processor
EM_ME16 :: ElfMachine
-- | STMicroelectronics ST100 processor
EM_ST100 :: ElfMachine
-- | Advanced Logic Corp. TinyJ embedded processor family
EM_TINYJ :: ElfMachine
-- | AMD x86-64 architecture
EM_X86_64 :: ElfMachine
-- | Sony DSP Processor
EM_PDSP :: ElfMachine
-- | Siemens FX66 microcontroller
EM_FX66 :: ElfMachine
-- | STMicroelectronics ST9+ 8/16 bit microcontroller
EM_ST9PLUS :: ElfMachine
-- | STMicroelectronics ST7 8-bit microcontroller
EM_ST7 :: ElfMachine
-- | Motorola MC68HC16 Microcontroller
EM_68HC16 :: ElfMachine
-- | Motorola MC68HC11 Microcontroller
EM_68HC11 :: ElfMachine
-- | Motorola MC68HC08 Microcontroller
EM_68HC08 :: ElfMachine
-- | Motorola MC68HC05 Microcontroller
EM_68HC05 :: ElfMachine
-- | Silicon Graphics SVx
EM_SVX :: ElfMachine
-- | STMicroelectronics ST19 8-bit microcontroller
EM_ST19 :: ElfMachine
-- | Digital VAX
EM_VAX :: ElfMachine
-- | Axis Communications 32-bit embedded processor
EM_CRIS :: ElfMachine
-- | Infineon Technologies 32-bit embedded processor
EM_JAVELIN :: ElfMachine
-- | Element 14 64-bit DSP Processor
EM_FIREPATH :: ElfMachine
-- | LSI Logic 16-bit DSP Processor
EM_ZSP :: ElfMachine
-- | Donald Knuth's educational 64-bit processor
EM_MMIX :: ElfMachine
-- | Harvard University machine-independent object files
EM_HUANY :: ElfMachine
-- | SiTera Prism
EM_PRISM :: ElfMachine
-- | Atmel AVR 8-bit microcontroller
EM_AVR :: ElfMachine
-- | Fujitsu FR30
EM_FR30 :: ElfMachine
-- | Mitsubishi D10V
EM_D10V :: ElfMachine
-- | Mitsubishi D30V
EM_D30V :: ElfMachine
-- | NEC v850
EM_V850 :: ElfMachine
-- | Mitsubishi M32R
EM_M32R :: ElfMachine
-- | Matsushita MN10300
EM_MN10300 :: ElfMachine
-- | Matsushita MN10200
EM_MN10200 :: ElfMachine
-- | picoJava
EM_PJ :: ElfMachine
-- | OpenRISC 32-bit embedded processor
EM_OPENRISC :: ElfMachine
-- | ARC Cores Tangent-A5
EM_ARC_A5 :: ElfMachine
-- | Tensilica Xtensa Architecture
EM_XTENSA :: ElfMachine
-- | Alphamosaic VideoCore processor
EM_VIDEOCORE :: ElfMachine
-- | Thompson Multimedia General Purpose Processor
EM_TMM_GPP :: ElfMachine
-- | National Semiconductor 32000 series
EM_NS32K :: ElfMachine
-- | Tenor Network TPC processor
EM_TPC :: ElfMachine
-- | Trebia SNP 1000 processor
EM_SNP1K :: ElfMachine
-- | STMicroelectronics (www.st.com) ST200 microcontroller
EM_ST200 :: ElfMachine
-- | Ubicom IP2xxx microcontroller family
EM_IP2K :: ElfMachine
-- | MAX Processor
EM_MAX :: ElfMachine
-- | National Semiconductor CompactRISC microprocessor
EM_CR :: ElfMachine
-- | Fujitsu F2MC16
EM_F2MC16 :: ElfMachine
-- | Texas Instruments embedded microcontroller msp430
EM_MSP430 :: ElfMachine
-- | Analog Devices Blackfin (DSP) processor
EM_BLACKFIN :: ElfMachine
-- | S1C33 Family of Seiko Epson processors
EM_SE_C33 :: ElfMachine
-- | Sharp embedded microprocessor
EM_SEP :: ElfMachine
-- | Arca RISC Microprocessor
EM_ARCA :: ElfMachine
-- | Microprocessor series from PKU-Unity Ltd. and MPRC of Peking
-- University
EM_UNICORE :: ElfMachine
-- | Other
EM_EXT :: Word16 -> ElfMachine
-- | 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).
data ElfSymbolTableEntry
EST :: (Word32, Maybe ByteString) -> Maybe ElfSection -> ElfSymbolType -> ElfSymbolBinding -> Word8 -> ElfSectionIndex -> Word64 -> Word64 -> ElfSymbolTableEntry
steName :: ElfSymbolTableEntry -> (Word32, Maybe ByteString)
-- | Section from steIndex
steEnclosingSection :: ElfSymbolTableEntry -> Maybe ElfSection
steType :: ElfSymbolTableEntry -> ElfSymbolType
steBind :: ElfSymbolTableEntry -> ElfSymbolBinding
steOther :: ElfSymbolTableEntry -> Word8
-- | Section in which the def is held
steIndex :: ElfSymbolTableEntry -> ElfSectionIndex
steValue :: ElfSymbolTableEntry -> Word64
steSize :: ElfSymbolTableEntry -> Word64
data ElfSymbolType
STTNoType :: ElfSymbolType
STTObject :: ElfSymbolType
STTFunc :: ElfSymbolType
STTSection :: ElfSymbolType
STTFile :: ElfSymbolType
STTLoOS :: ElfSymbolType
STTHiOS :: ElfSymbolType
STTLoProc :: ElfSymbolType
STTHiProc :: ElfSymbolType
data ElfSymbolBinding
STBLocal :: ElfSymbolBinding
STBGlobal :: ElfSymbolBinding
STBWeak :: ElfSymbolBinding
STBLoOS :: ElfSymbolBinding
STBHiOS :: ElfSymbolBinding
STBLoProc :: ElfSymbolBinding
STBHiProc :: ElfSymbolBinding
data ElfSectionIndex
SHNUndef :: ElfSectionIndex
SHNLoProc :: ElfSectionIndex
SHNCustomProc :: Word64 -> ElfSectionIndex
SHNHiProc :: ElfSectionIndex
SHNLoOS :: ElfSectionIndex
SHNCustomOS :: Word64 -> ElfSectionIndex
SHNHiOS :: ElfSectionIndex
SHNAbs :: ElfSectionIndex
SHNCommon :: ElfSectionIndex
SHNIndex :: Word64 -> ElfSectionIndex
instance Eq ElfSectionType
instance Show ElfSectionType
instance Eq ElfSectionFlags
instance Show ElfSectionFlags
instance Eq ElfSection
instance Show ElfSection
instance Eq ElfClass
instance Show ElfClass
instance Eq ElfData
instance Show ElfData
instance Eq ElfOSABI
instance Show ElfOSABI
instance Eq ElfType
instance Show ElfType
instance Eq ElfMachine
instance Show ElfMachine
instance Eq ElfSegmentType
instance Show ElfSegmentType
instance Eq ElfSegmentFlag
instance Show ElfSegmentFlag
instance Eq ElfSegment
instance Show ElfSegment
instance Eq Elf
instance Show Elf
instance Eq ElfSymbolBinding
instance Ord ElfSymbolBinding
instance Show ElfSymbolBinding
instance Read ElfSymbolBinding
instance Eq ElfSymbolType
instance Ord ElfSymbolType
instance Show ElfSymbolType
instance Read ElfSymbolType
instance Eq ElfSectionIndex
instance Ord ElfSectionIndex
instance Show ElfSectionIndex
instance Read ElfSectionIndex
instance Eq ElfSymbolTableEntry
instance Show ElfSymbolTableEntry
instance Enum ElfSectionIndex
instance Enum ElfSymbolType
instance Enum ElfSymbolBinding