fromDynamicEntryType :: DynamicEntryType -> Word64
fromDynamicEntryType x = case x of
   DynTypeNone                     -> 0
   DynTypeNeededLibraryName        -> 1
   DynTypePLTRelocSize             -> 2
   DynTypePLTGOTAddress            -> 3
   DynTypeSymbolHashTableAddress   -> 4
   DynTypeStringTableAddress       -> 5
   DynTypeSymbolTableAddress       -> 6
   DynTypeRelocaAddress            -> 7
   DynTypeRelocaSize               -> 8
   DynTypeRelocaEntrySize          -> 9
   DynTypeStringTableSize          -> 10
   DynTypeSymbolEntrySize          -> 11
   DynTypeInitFunctionAddress      -> 12
   DynTypeFiniFunctionAddress      -> 13
   DynTypeSharedObjectName         -> 14
   DynTypeLibrarySearchPathOld     -> 15
   DynTypeSymbolic                 -> 16
   DynTypeRelocAddress             -> 17
   DynTypeRelocSize                -> 18
   DynTypeRelocEntrySize           -> 19
   DynTypePLTRelocType             -> 20
   DynTypeDebug                    -> 21
   DynTypeRelocatableText          -> 22
   DynTypePLTRelocAddress          -> 23
   DynTypeBindNow                  -> 24
   DynTypeInitFunctionArrayAddress -> 25
   DynTypeFiniFunctionArrayAddress -> 26
   DynTypeInitFunctionArraySize    -> 27
   DynTypeFiniFunctionArraySize    -> 28
   DynTypeLibrarySearchPath        -> 29
   DynTypeFlags                    -> 30
   --DynTypeEncoding               -> 32
   DynTypePreInitFunctionArrayAddress -> 32
   DynTypePreInitFunctionArraySize -> 33
   
   DynTypeGNUPrelinkedTimestamp    -> 0x6ffffdf5
   DynTypeGNUConflictSize          -> 0x6ffffdf6
   DynTypeGNULibraryListSize       -> 0x6ffffdf7
   DynTypeChecksum                 -> 0x6ffffdf8
   DynTypePLTPaddingSize           -> 0x6ffffdf9 
   DynTypeMoveEntrySize            -> 0x6ffffdfa 
   DynTypeMoveSize                 -> 0x6ffffdfb
   DynTypeFeatureSelection         -> 0x6ffffdfc
   DynTypePositionalFlags          -> 0x6ffffdfd
   DynTypeSymbolInfoSize           -> 0x6ffffdfe
   DynTypeSymbolInfoEntrySize      -> 0x6ffffdff
   
   DynTypeGNUHashTableAddress      -> 0x6ffffef5
   DynTypeTLSDescPLT               -> 0x6ffffef6
   DynTypeTLSDescGOT               -> 0x6ffffef7
   DynTypeGNUConflictSection       -> 0x6ffffef8
   DynTypeGNULibraryList           -> 0x6ffffef9
   DynTypeConfigInfo               -> 0x6ffffefa
   DynTypeDependencyAuditing       -> 0x6ffffefb
   DynTypeObjectAuditing           -> 0x6ffffefc
   DynTypePLTPadding               -> 0x6ffffefd
   DynTypeMoveTable                -> 0x6ffffefe
   DynTypeSymbolInfoTable          -> 0x6ffffeff
   
   DynTypeSymbolVersion            -> 0x6ffffff0
   DynTypeRelocaCount              -> 0x6ffffff9
   DynTypeRelocCount               -> 0x6ffffffa
   DynTypeStateFlags               -> 0x6ffffffb
   DynTypeVersionDefinitionTable   -> 0x6ffffffc
   DynTypeVersionDefinitionCount   -> 0x6ffffffd
   DynTypeVersionNeededTable       -> 0x6ffffffe
   DynTypeVersionNeededCount       -> 0x6fffffff
   
   DynTypeLoadBefore               -> 0x7ffffffd
   DynTypeGetValuesFrom            -> 0x7fffffff

   DynTypeUnknown v                -> v
fromDynamicEntryType :: DynamicEntryType -> Word64
fromDynamicEntryType x = case x of
   DynTypeNone                     -> 0
   DynTypeNeededLibraryName        -> 1
   DynTypePLTRelocSize             -> 2
   DynTypePLTGOTAddress            -> 3
   DynTypeSymbolHashTableAddress   -> 4
   DynTypeStringTableAddress       -> 5
   DynTypeSymbolTableAddress       -> 6
   DynTypeRelocaAddress            -> 7
   DynTypeRelocaSize               -> 8
   DynTypeRelocaEntrySize          -> 9
   DynTypeStringTableSize          -> 10
   DynTypeSymbolEntrySize          -> 11
   DynTypeInitFunctionAddress      -> 12
   DynTypeFiniFunctionAddress      -> 13
   DynTypeSharedObjectName         -> 14
   DynTypeLibrarySearchPathOld     -> 15
   DynTypeSymbolic                 -> 16
   DynTypeRelocAddress             -> 17
   DynTypeRelocSize                -> 18
   DynTypeRelocEntrySize           -> 19
   DynTypePLTRelocType             -> 20
   DynTypeDebug                    -> 21
   DynTypeRelocatableText          -> 22
   DynTypePLTRelocAddress          -> 23
   DynTypeBindNow                  -> 24
   DynTypeInitFunctionArrayAddress -> 25
   DynTypeFiniFunctionArrayAddress -> 26
   DynTypeInitFunctionArraySize    -> 27
   DynTypeFiniFunctionArraySize    -> 28
   DynTypeLibrarySearchPath        -> 29
   DynTypeFlags                    -> 30
   --DynTypeEncoding               -> 32
   DynTypePreInitFunctionArrayAddress -> 32
   DynTypePreInitFunctionArraySize -> 33
   
   DynTypeGNUPrelinkedTimestamp    -> 0x6ffffdf5
   DynTypeGNUConflictSize          -> 0x6ffffdf6
   DynTypeGNULibraryListSize       -> 0x6ffffdf7
   DynTypeChecksum                 -> 0x6ffffdf8
   DynTypePLTPaddingSize           -> 0x6ffffdf9 
   DynTypeMoveEntrySize            -> 0x6ffffdfa 
   DynTypeMoveSize                 -> 0x6ffffdfb
   DynTypeFeatureSelection         -> 0x6ffffdfc
   DynTypePositionalFlags          -> 0x6ffffdfd
   DynTypeSymbolInfoSize           -> 0x6ffffdfe
   DynTypeSymbolInfoEntrySize      -> 0x6ffffdff
   
   DynTypeGNUHashTableAddress      -> 0x6ffffef5
   DynTypeTLSDescPLT               -> 0x6ffffef6
   DynTypeTLSDescGOT               -> 0x6ffffef7
   DynTypeGNUConflictSection       -> 0x6ffffef8
   DynTypeGNULibraryList           -> 0x6ffffef9
   DynTypeConfigInfo               -> 0x6ffffefa
   DynTypeDependencyAuditing       -> 0x6ffffefb
   DynTypeObjectAuditing           -> 0x6ffffefc
   DynTypePLTPadding               -> 0x6ffffefd
   DynTypeMoveTable                -> 0x6ffffefe
   DynTypeSymbolInfoTable          -> 0x6ffffeff
   
   DynTypeSymbolVersion            -> 0x6ffffff0
   DynTypeRelocaCount              -> 0x6ffffff9
   DynTypeRelocCount               -> 0x6ffffffa
   DynTypeStateFlags               -> 0x6ffffffb
   DynTypeVersionDefinitionTable   -> 0x6ffffffc
   DynTypeVersionDefinitionCount   -> 0x6ffffffd
   DynTypeVersionNeededTable       -> 0x6ffffffe
   DynTypeVersionNeededCount       -> 0x6fffffff
   
   DynTypeLoadBefore               -> 0x7ffffffd
   DynTypeGetValuesFrom            -> 0x7fffffff

   DynTypeUnknown v                -> v
fromDynamicEntryType x = case x of
   DynTypeNone                     -> 0
   DynTypeNeededLibraryName        -> 1
   DynTypePLTRelocSize             -> 2
   DynTypePLTGOTAddress            -> 3
   DynTypeSymbolHashTableAddress   -> 4
   DynTypeStringTableAddress       -> 5
   DynTypeSymbolTableAddress       -> 6
   DynTypeRelocaAddress            -> 7
   DynTypeRelocaSize               -> 8
   DynTypeRelocaEntrySize          -> 9
   DynTypeStringTableSize          -> 10
   DynTypeSymbolEntrySize          -> 11
   DynTypeInitFunctionAddress      -> 12
   DynTypeFiniFunctionAddress      -> 13
   DynTypeSharedObjectName         -> 14
   DynTypeLibrarySearchPathOld     -> 15
   DynTypeSymbolic                 -> 16
   DynTypeRelocAddress             -> 17
   DynTypeRelocSize                -> 18
   DynTypeRelocEntrySize           -> 19
   DynTypePLTRelocType             -> 20
   DynTypeDebug                    -> 21
   DynTypeRelocatableText          -> 22
   DynTypePLTRelocAddress          -> 23
   DynTypeBindNow                  -> 24
   DynTypeInitFunctionArrayAddress -> 25
   DynTypeFiniFunctionArrayAddress -> 26
   DynTypeInitFunctionArraySize    -> 27
   DynTypeFiniFunctionArraySize    -> 28
   DynTypeLibrarySearchPath        -> 29
   DynTypeFlags                    -> 30
   --DynTypeEncoding               -> 32
   DynTypePreInitFunctionArrayAddress -> 32
   DynTypePreInitFunctionArraySize -> 33
   
   DynTypeGNUPrelinkedTimestamp    -> 0x6ffffdf5
   DynTypeGNUConflictSize          -> 0x6ffffdf6
   DynTypeGNULibraryListSize       -> 0x6ffffdf7
   DynTypeChecksum                 -> 0x6ffffdf8
   DynTypePLTPaddingSize           -> 0x6ffffdf9 
   DynTypeMoveEntrySize            -> 0x6ffffdfa 
   DynTypeMoveSize                 -> 0x6ffffdfb
   DynTypeFeatureSelection         -> 0x6ffffdfc
   DynTypePositionalFlags          -> 0x6ffffdfd
   DynTypeSymbolInfoSize           -> 0x6ffffdfe
   DynTypeSymbolInfoEntrySize      -> 0x6ffffdff
   
   DynTypeGNUHashTableAddress      -> 0x6ffffef5
   DynTypeTLSDescPLT               -> 0x6ffffef6
   DynTypeTLSDescGOT               -> 0x6ffffef7
   DynTypeGNUConflictSection       -> 0x6ffffef8
   DynTypeGNULibraryList           -> 0x6ffffef9
   DynTypeConfigInfo               -> 0x6ffffefa
   DynTypeDependencyAuditing       -> 0x6ffffefb
   DynTypeObjectAuditing           -> 0x6ffffefc
   DynTypePLTPadding               -> 0x6ffffefd
   DynTypeMoveTable                -> 0x6ffffefe
   DynTypeSymbolInfoTable          -> 0x6ffffeff
   
   DynTypeSymbolVersion            -> 0x6ffffff0
   DynTypeRelocaCount              -> 0x6ffffff9
   DynTypeRelocCount               -> 0x6ffffffa
   DynTypeStateFlags               -> 0x6ffffffb
   DynTypeVersionDefinitionTable   -> 0x6ffffffc
   DynTypeVersionDefinitionCount   -> 0x6ffffffd
   DynTypeVersionNeededTable       -> 0x6ffffffe
   DynTypeVersionNeededCount       -> 0x6fffffff
   
   DynTypeLoadBefore               -> 0x7ffffffd
   DynTypeGetValuesFrom            -> 0x7fffffff

   DynTypeUnknown v                -> v