Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides ELF data structures and (de)serialization routines.
- newtype FileClass = FileClass {
- unFileClass :: Word8
- invalidFileClass :: FileClass
- elf32FileClass :: FileClass
- elf64FileClass :: FileClass
- class (Typeable c, Typeable (Addr c), Data (Addr c), Typeable (Off c), Data (Off c), Typeable (UnSymIx c), Data (UnSymIx c), Typeable (UnRelType c), Data (UnRelType c), Show (Addr c), Read (Addr c), Show (Off c), Read (Off c), Show (UnSymIx c), Read (UnSymIx c), Show (UnRelType c), Read (UnRelType c), Eq (Addr c), Ord (Addr c), Bounded (Addr c), Enum (Addr c), Num (Addr c), Integral (Addr c), Real (Addr c), Bits (Addr c), FiniteBits (Addr c), Eq (Off c), Ord (Off c), Bounded (Off c), Enum (Off c), Num (Off c), Integral (Off c), Real (Off c), Bits (Off c), FiniteBits (Off c), Eq (UnSymIx c), Ord (UnSymIx c), Bounded (UnSymIx c), Enum (UnSymIx c), Ix (UnSymIx c), Num (UnSymIx c), Integral (UnSymIx c), Real (UnSymIx c), Bits (UnSymIx c), FiniteBits (UnSymIx c), Eq (UnRelType c), Ord (UnRelType c), Bounded (UnRelType c), Enum (UnRelType c), Ix (UnRelType c)) => IsFileClass c where
- data Elf32 = Elf32
- anElf32 :: Proxy Elf32
- data Elf64 = Elf64
- anElf64 :: Proxy Elf64
- newtype FileType = FileType {
- unFileType :: Word16
- noneFileType :: FileType
- relFileType :: FileType
- execFileType :: FileType
- dynFileType :: FileType
- coreFileType :: FileType
- loOsFileType :: FileType
- hiOsFileType :: FileType
- loProcFileType :: FileType
- hiProcFileType :: FileType
- newtype Machine = Machine {}
- undefMachine :: Machine
- i386Machine :: Machine
- amd64Machine :: Machine
- newtype MachFlags = MachFlags {}
- newtype Version = Version {}
- invalidVersion :: Version
- firstVersion :: Version
- newtype DataEnc = DataEnc {}
- invalidDataEnc :: DataEnc
- lsbDataEnc :: DataEnc
- msbDataEnc :: DataEnc
- newtype OsAbi = OsAbi {}
- sysvOsAbi :: OsAbi
- hpuxOsAbi :: OsAbi
- netBsdOsAbi :: OsAbi
- gnuOsAbi :: OsAbi
- solarisOsAbi :: OsAbi
- aixOsAbi :: OsAbi
- irixOsAbi :: OsAbi
- freeBsdOsAbi :: OsAbi
- tru64OsAbi :: OsAbi
- modestoOsAbi :: OsAbi
- openBsdOsAbi :: OsAbi
- openVmsOsAbi :: OsAbi
- nskOsAbi :: OsAbi
- arosOsAbi :: OsAbi
- fenixOsAbi :: OsAbi
- embedOsAbi :: OsAbi
- newtype AbiVer = AbiVer {}
- undefAbiVer :: AbiVer
- data Ident = Ident {}
- identSize :: Int
- buildIdent :: Ident -> Builder
- data FileHdr c = FileHdr {}
- type FileHdr32 = FileHdr Elf32
- type FileHdr64 = FileHdr Elf64
- fileHdr32Size :: Int
- fileHdr64Size :: Int
- putFileHdr32 :: Endian -> FileHdr32 -> Put
- getFileHdr32 :: Endian -> Get FileHdr32
- buildFileHdr32 :: Endian -> FileHdr32 -> Builder
- buildFileHdr64 :: Endian -> FileHdr64 -> Builder
- newtype SegType = SegType {}
- unusedSegType :: SegType
- loadSegType :: SegType
- dynSegType :: SegType
- interpSegType :: SegType
- noteSegType :: SegType
- shlibSegType :: SegType
- phdrSegType :: SegType
- loOsSegType :: SegType
- hiOsSegType :: SegType
- loProcSegType :: SegType
- hiProcSegType :: SegType
- newtype SegFlags = SegFlags {
- unSegFlags :: Word32
- execSegFlag :: SegFlags
- writeSegFlag :: SegFlags
- readSegFlag :: SegFlags
- osSegFlags :: SegFlags
- procSegFlags :: SegFlags
- data ProgHdr c = ProgHdr {}
- type ProgHdr32 = ProgHdr Elf32
- type ProgHdr64 = ProgHdr Elf64
- progHdr32Size :: Int
- progHdr64Size :: Int
- putProgHdr32 :: Endian -> ProgHdr32 -> Put
- getProgHdr32 :: Endian -> Get ProgHdr32
- buildProgHdr32 :: Endian -> ProgHdr32 -> Builder
- buildProgHdr64 :: Endian -> ProgHdr64 -> Builder
- type StrIx = Word32
- newtype SecIx = SecIx {}
- undefSecIx :: SecIx
- lastSecIx :: SecIx
- loOsSecIx :: SecIx
- hiOsSecIx :: SecIx
- loProcSecIx :: SecIx
- hiProcSecIx :: SecIx
- absSecIx :: SecIx
- commonSecIx :: SecIx
- xIndexSecIx :: SecIx
- newtype SecType = SecType {}
- unusedSecType :: SecType
- progBitsSecType :: SecType
- symSecType :: SecType
- strSecType :: SecType
- relaSecType :: SecType
- hashSecType :: SecType
- dynSecType :: SecType
- noteSecType :: SecType
- noBitsSecType :: SecType
- relSecType :: SecType
- shlibSecType :: SecType
- dynSymSecType :: SecType
- loOsSecType :: SecType
- hiOsSecType :: SecType
- loProcSecType :: SecType
- hiProcSecType :: SecType
- newtype SecFlags = SecFlags {
- unSecFlags :: Word32
- writeSecFlag :: SecFlags
- allocSecFlag :: SecFlags
- execSecFlag :: SecFlags
- mergeSecFlag :: SecFlags
- infoLinkSecFlag :: SecFlags
- osSecFlags :: SecFlags
- procSecFlags :: SecFlags
- data SecHdr c = SecHdr {}
- type SecHdr32 = SecHdr Elf32
- type SecHdr64 = SecHdr Elf64
- secHdr32Size :: Int
- secHdr64Size :: Int
- buildSecHdr32 :: Endian -> SecHdr32 -> Builder
- buildSecHdr64 :: Endian -> SecHdr64 -> Builder
- zeroSecHdr :: IsFileClass c => SecHdr c
- newtype SymType = SymType {}
- undefSymType :: SymType
- objSymType :: SymType
- funSymType :: SymType
- secSymType :: SymType
- fileSymType :: SymType
- commonSymType :: SymType
- tlsSymType :: SymType
- loOsSymType :: SymType
- hiOsSymType :: SymType
- loProcSymType :: SymType
- hiProcSymType :: SymType
- newtype SymBind = SymBind {}
- localSymBind :: SymBind
- globalSymBind :: SymBind
- weakSymBind :: SymBind
- loOsSymBind :: SymBind
- hiOsSymBind :: SymBind
- loProcSymBind :: SymBind
- hiProcSymBind :: SymBind
- data SymVisi
- unSymVisi :: SymVisi -> Word2
- newtype SymIx c = SymIx {}
- undefSymIx :: IsFileClass c => SymIx c
- data SymEnt c = SymEnt {}
- type SymEnt32 = SymEnt Elf32
- type SymEnt64 = SymEnt Elf64
- symEnt32Size :: Int
- symEnt64Size :: Int
- buildSymEnt32 :: Endian -> SymEnt32 -> Builder
- buildSymEnt64 :: Endian -> SymEnt64 -> Builder
- zeroSymEnt :: IsFileClass c => SymEnt c
- newtype RelType c = RelType {}
- type RelType32 = RelType Elf32
- type RelType64 = RelType Elf64
- data RelEnt c = RelEnt {}
- type RelEnt32 = RelEnt Elf32
- type RelEnt64 = RelEnt Elf64
- data RelaEnt c = RelaEnt {}
- type RelaEnt32 = RelaEnt Elf32
- type RelaEnt64 = RelaEnt Elf64
- relaEnt32Size :: Int
- relaEnt64Size :: Int
- buildRelaEnt32 :: Endian -> RelaEnt32 -> Builder
- buildRelaEnt64 :: Endian -> RelaEnt64 -> Builder
Documentation
File class.
invalidFileClass :: FileClass Source #
Invalid class (ELFCLASSNONE
).
elf32FileClass :: FileClass Source #
ELF32 class (ELFCLASS32
).
elf64FileClass :: FileClass Source #
ELF64 class (ELFCLASS64
).
class (Typeable c, Typeable (Addr c), Data (Addr c), Typeable (Off c), Data (Off c), Typeable (UnSymIx c), Data (UnSymIx c), Typeable (UnRelType c), Data (UnRelType c), Show (Addr c), Read (Addr c), Show (Off c), Read (Off c), Show (UnSymIx c), Read (UnSymIx c), Show (UnRelType c), Read (UnRelType c), Eq (Addr c), Ord (Addr c), Bounded (Addr c), Enum (Addr c), Num (Addr c), Integral (Addr c), Real (Addr c), Bits (Addr c), FiniteBits (Addr c), Eq (Off c), Ord (Off c), Bounded (Off c), Enum (Off c), Num (Off c), Integral (Off c), Real (Off c), Bits (Off c), FiniteBits (Off c), Eq (UnSymIx c), Ord (UnSymIx c), Bounded (UnSymIx c), Enum (UnSymIx c), Ix (UnSymIx c), Num (UnSymIx c), Integral (UnSymIx c), Real (UnSymIx c), Bits (UnSymIx c), FiniteBits (UnSymIx c), Eq (UnRelType c), Ord (UnRelType c), Bounded (UnRelType c), Enum (UnRelType c), Ix (UnRelType c)) => IsFileClass c where Source #
File class type-level index.
32-bit ELF class type-level index.
64-bit ELF class type-level index.
File type.
noneFileType :: FileType Source #
No file type (ET_NONE
).
relFileType :: FileType Source #
Relocatable object file (ET_REL
).
execFileType :: FileType Source #
Executable file (ET_EXEC
).
dynFileType :: FileType Source #
Shared object file (ET_DYN
).
coreFileType :: FileType Source #
Core file (ET_CORE
).
loOsFileType :: FileType Source #
First environment-specific type (ET_LOOS
).
hiOsFileType :: FileType Source #
Last environment-specific type (ET_HIOS
).
loProcFileType :: FileType Source #
First processor-specific type (ET_LOPROC
).
hiProcFileType :: FileType Source #
Last processor-specific type (ET_HIPROC
).
Machine architecture.
undefMachine :: Machine Source #
No machine (EM_NONE
).
i386Machine :: Machine Source #
Intel 80386 (EM_386
).
amd64Machine :: Machine Source #
AMD x86-64 (EM_X86_64
).
Architecture-specific flags.
ELF version.
invalidVersion :: Version Source #
Invalid version.
firstVersion :: Version Source #
Version 1.
Data encoding.
invalidDataEnc :: DataEnc Source #
Invalid data encoding.
lsbDataEnc :: DataEnc Source #
Little-endian data encoding (ELFDATA2LSB
).
msbDataEnc :: DataEnc Source #
Big-endian data encoding (ELFDATA2MSB
).
System ABI.
netBsdOsAbi :: OsAbi Source #
NetBSD (ELFOSABI_NETBSD
).
solarisOsAbi :: OsAbi Source #
Solaris (ELFOSABI_SOLARIS
).
freeBsdOsAbi :: OsAbi Source #
FreeBSD (ELFOSABI_FREEBSD
).
tru64OsAbi :: OsAbi Source #
Tru64 UNIX (ELFOSABI_TRU64
).
modestoOsAbi :: OsAbi Source #
Novell Modesto (ELFOSABI_MODESTO
).
openBsdOsAbi :: OsAbi Source #
OpenBSD (ELFOSABI_OPENBSD
).
openVmsOsAbi :: OsAbi Source #
OpenVMS (ELFOSABI_OPENVMS
).
fenixOsAbi :: OsAbi Source #
FenixOS (ELFOSABI_FENIXOS
).
embedOsAbi :: OsAbi Source #
Standalone (embedded) application.
ABI version.
undefAbiVer :: AbiVer Source #
Undefined ABI version.
Identification.
buildIdent :: Ident -> Builder Source #
Serialize identification via ByteString
builder.
File header.
fileHdr32Size :: Int Source #
ELF32 file header size.
fileHdr64Size :: Int Source #
ELF64 file header size.
buildFileHdr32 :: Endian -> FileHdr32 -> Builder Source #
Serialize ELF32 file header via ByteString
builder.
buildFileHdr64 :: Endian -> FileHdr64 -> Builder Source #
Serialize ELF64 file header via ByteString
builder.
Segment type.
unusedSegType :: SegType Source #
Unused program header entry (PT_NULL
).
loadSegType :: SegType Source #
Loadable segment (PT_LOAD
).
dynSegType :: SegType Source #
Dynamic linking tables (PT_DYNAMIC
).
interpSegType :: SegType Source #
Program interpreter path name (PT_INTERP
).
noteSegType :: SegType Source #
Note sections (PT_NOTE
).
shlibSegType :: SegType Source #
A reserved segment type (PT_SHLIB
).
phdrSegType :: SegType Source #
Program header table (PT_PHDR
).
loOsSegType :: SegType Source #
First environment-specific segment type (PT_LOOS
).
hiOsSegType :: SegType Source #
Last environment-specific segment type (PT_HIOS
).
loProcSegType :: SegType Source #
First processor-specific segment type (PT_LOPROC
).
hiProcSegType :: SegType Source #
Last processor-specific segment type (PT_HIPROC
).
Segment flags.
execSegFlag :: SegFlags Source #
Execute permission (PF_X
).
writeSegFlag :: SegFlags Source #
Write permission (PF_W
).
readSegFlag :: SegFlags Source #
Read permission (PF_R
).
osSegFlags :: SegFlags Source #
Environment-specific flags mask (PF_MASKOS
).
procSegFlags :: SegFlags Source #
Processor-specific flags mask (PF_MASKPROC
).
Program header table entry.
progHdr32Size :: Int Source #
ELF32 program header table entry size.
progHdr64Size :: Int Source #
ELF64 program header table entry size.
buildProgHdr32 :: Endian -> ProgHdr32 -> Builder Source #
Serialize ELF32 program header via ByteString
builder.
buildProgHdr64 :: Endian -> ProgHdr64 -> Builder Source #
Serialize ELF64 program header via ByteString
builder.
Section header entry index.
undefSecIx :: SecIx Source #
Undefined section reference (SHN_UNDEF
).
loProcSecIx :: SecIx Source #
First processor-specific section index (SHN_LOPROC
).
hiProcSecIx :: SecIx Source #
Last processor-specific section index (SHN_HIPROC
).
commonSecIx :: SecIx Source #
Common block indicator (SHN_COMMON
).
xIndexSecIx :: SecIx Source #
Escape value (SHN_XINDEX
).
Section type.
unusedSecType :: SecType Source #
Unused section (SHT_NULL
).
progBitsSecType :: SecType Source #
Program information (SHT_PROGBITS
).
symSecType :: SecType Source #
Symbol table (SHT_SYMTAB
).
strSecType :: SecType Source #
String table (SHT_STRTAB
).
relaSecType :: SecType Source #
Relocation entries (SHT_RELA
).
hashSecType :: SecType Source #
Symbol hash table (SHT_HASH
).
dynSecType :: SecType Source #
Dynamic linking table (SHT_DYNAMIC
).
noteSecType :: SecType Source #
Note information (SHT_NOTE
).
noBitsSecType :: SecType Source #
Uninitialized space (SHT_NOBITS
).
relSecType :: SecType Source #
Relocation entries (SHT_REL
).
shlibSecType :: SecType Source #
A reserved section type (SHT_SHLIB
).
dynSymSecType :: SecType Source #
Dynamic loader symbol table (SHT_DYNSYM
).
loOsSecType :: SecType Source #
First environment-specific section type (SHT_LOOS
).
hiOsSecType :: SecType Source #
Last environment-specific section type (SHT_HIOS
).
loProcSecType :: SecType Source #
First processor-specific section type (SHT_LOPROC
).
hiProcSecType :: SecType Source #
Last processor-specific section type (SHT_HIPROC
).
Section flags.
writeSecFlag :: SecFlags Source #
Writable data (SHF_WRITE
).
allocSecFlag :: SecFlags Source #
Allocated data (SHF_ALLOC
).
execSecFlag :: SecFlags Source #
Executable instructions (SHF_EXECINSTR
).
mergeSecFlag :: SecFlags Source #
Mergeable data (SHF_MERGE
).
infoLinkSecFlag :: SecFlags Source #
Flag that indicates that shInfo
is a section header table index.
(SHF_INFO_LINK
)
osSecFlags :: SecFlags Source #
Environment-specific flags mask (SHF_MASKOS
).
procSecFlags :: SecFlags Source #
Processor-specific flags mask (SHF_MASKOS
).
Section header table entry.
secHdr32Size :: Int Source #
ELF32 section header table entry size.
secHdr64Size :: Int Source #
ELF64 section header table entry size.
buildSecHdr32 :: Endian -> SecHdr32 -> Builder Source #
Serialize ELF32 section header via ByteString
builder.
buildSecHdr64 :: Endian -> SecHdr64 -> Builder Source #
Serialize ELF64 section header via ByteString
builder.
zeroSecHdr :: IsFileClass c => SecHdr c Source #
Section header filled with zeros.
Symbol type.
undefSymType :: SymType Source #
Undefined symbol type (STT_NOTYPE
).
objSymType :: SymType Source #
Object (STT_OBJECT
).
funSymType :: SymType Source #
Function (STT_FUNC
).
secSymType :: SymType Source #
Section (STT_SECTION
).
fileSymType :: SymType Source #
Source file name (STT_FILE
).
commonSymType :: SymType Source #
Common block label (STT_COMMON
).
tlsSymType :: SymType Source #
Thread-local storage (STT_TLS
).
loOsSymType :: SymType Source #
First environment-specific symbol type (STT_LOOS
).
hiOsSymType :: SymType Source #
Last environment-specific symbol type (STT_HIOS
).
loProcSymType :: SymType Source #
First processor-specific symbol type (STT_LOPROC
).
hiProcSymType :: SymType Source #
Last processor-specific symbol type (STT_HIPROC
).
Symbol binding type.
localSymBind :: SymBind Source #
Local symbol (STB_LOCAL
).
globalSymBind :: SymBind Source #
Global symbol (STB_GLOBAL
).
weakSymBind :: SymBind Source #
Lower precedence global symbol (STB_WEAK
).
loOsSymBind :: SymBind Source #
First environment-specific symbol binding type (STB_LOOS
).
hiOsSymBind :: SymBind Source #
Last environment-specific symbol binding type (STB_HIOS
).
loProcSymBind :: SymBind Source #
First processor-specific symbol binding type (STB_LOPROC
).
hiProcSymBind :: SymBind Source #
Last processor-specific symbol binding type (STB_HIPROC
).
Symbol visibility.
DefSymVisi | Default (specified by the binding type)
( |
IntSymVisi | Internal (processor-specific hidden type)
( |
HiddenSymVisi | Hidden ( |
ProtSymVisi | Protected ( |
Symbol table index.
IsFileClass c => Bounded (SymIx c) Source # | |
IsFileClass c => Enum (SymIx c) Source # | |
IsFileClass c => Eq (SymIx c) Source # | |
IsFileClass c => Integral (SymIx c) Source # | |
(Data c, IsFileClass c) => Data (SymIx c) Source # | |
IsFileClass c => Num (SymIx c) Source # | |
IsFileClass c => Ord (SymIx c) Source # | |
IsFileClass c => Read (SymIx c) Source # | |
IsFileClass c => Real (SymIx c) Source # | |
IsFileClass c => Show (SymIx c) Source # | |
IsFileClass c => Ix (SymIx c) Source # | |
IsFileClass c => Bits (SymIx c) Source # | |
IsFileClass c => FiniteBits (SymIx c) Source # | |
undefSymIx :: IsFileClass c => SymIx c Source #
Undefined symbol table index.
Symbol table entry.
symEnt32Size :: Int Source #
ELF32 symbol table entry size.
symEnt64Size :: Int Source #
ELF64 symbol table entry size.
buildSymEnt32 :: Endian -> SymEnt32 -> Builder Source #
Serialize ELF32 symbol table entry via ByteString
builder.
buildSymEnt64 :: Endian -> SymEnt64 -> Builder Source #
Serialize ELF64 symbol table entry via ByteString
builder.
zeroSymEnt :: IsFileClass c => SymEnt c Source #
Symbol table entry filled with zeros.
Relocation type.
IsFileClass c => Bounded (RelType c) Source # | |
IsFileClass c => Enum (RelType c) Source # | |
IsFileClass c => Eq (RelType c) Source # | |
(Data c, IsFileClass c) => Data (RelType c) Source # | |
IsFileClass c => Ord (RelType c) Source # | |
IsFileClass c => Read (RelType c) Source # | |
IsFileClass c => Show (RelType c) Source # | |
IsFileClass c => Ix (RelType c) Source # | |
Relocation table entry (REL).
Relocation table entry (RELA).
relaEnt32Size :: Int Source #
ELF32 relocation table entry (RELA) size.
relaEnt64Size :: Int Source #
ELF64 relocation table entry (RELA) size.