6464#define LLIL_GET_TEMP_REG_INDEX (n ) ((n) & 0x7fffffff)
6565#define BN_INVALID_REGISTER 0xffffffff
6666
67+ #define BN_NOCOERCE_EXTERN_PTR 0xfffffffe
6768#define BN_INVALID_OPERAND 0xffffffff
6869
6970#define BN_INVALID_EXPR ((size_t)-1)
@@ -733,6 +734,7 @@ extern "C"
733734 EntryValue ,
734735 ConstantValue ,
735736 ConstantPointerValue ,
737+ ExternalPointerValue ,
736738 StackFrameOffset ,
737739 ReturnAddressValue ,
738740 ImportedAddressValue ,
@@ -777,6 +779,7 @@ extern "C"
777779 {
778780 BNRegisterValueType state ;
779781 int64_t value ;
782+ int64_t offset ;
780783 };
781784
782785 struct BNRegisterValueWithConfidence
@@ -794,6 +797,7 @@ extern "C"
794797 {
795798 BNRegisterValueType state ;
796799 int64_t value ;
800+ int64_t offset ;
797801 BNValueRange * ranges ;
798802 int64_t * valueSet ;
799803 BNLookupTableEntry * table ;
@@ -1124,12 +1128,13 @@ extern "C"
11241128 StandardRelocationType ,
11251129 IgnoredRelocation
11261130 };
1127-
1131+ #define MAX_RELOCATION_SIZE 8
11281132 struct BNRelocationInfo
11291133 {
11301134 BNRelocationType type ; // BinaryNinja Relocation Type
11311135 bool pcRelative ; // PC Relative or Absolute (subtract address from relocation)
11321136 bool baseRelative ; // Relative to start of module (Add module base to relocation)
1137+ uint64_t base ; // Base address for this binary view
11331138 size_t size ; // Size of the data to be written
11341139 size_t truncateSize ; // After addition/subtraction truncate to
11351140 uint64_t nativeType ; // Base type from relocation entry
@@ -1141,6 +1146,9 @@ extern "C"
11411146 size_t sectionIndex ; // Index into the section table
11421147 uint64_t address ; // Absolute address or segment offset
11431148 bool dataRelocation ; // This relocation is effecting data not code
1149+ uint8_t relocationDataCache [MAX_RELOCATION_SIZE ];
1150+ struct BNRelocationInfo * prev ; // Link to relocation another related relocation
1151+ struct BNRelocationInfo * next ; // Link to relocation another related relocation
11441152 };
11451153
11461154 struct BNInstructionTextToken
@@ -1403,6 +1411,8 @@ extern "C"
14031411 size_t resultCount );
14041412 bool (* applyRelocation )(void * ctxt , BNBinaryView * view , BNArchitecture * arch , BNRelocation * reloc , uint8_t * dest ,
14051413 size_t len );
1414+ size_t (* getOperandForExternalRelocation )(void * ctxt , const uint8_t * data , uint64_t addr , size_t length ,
1415+ BNLowLevelILFunction * il , BNRelocation * relocation );
14061416 };
14071417
14081418 struct BNTypeParserResult
@@ -2346,6 +2356,8 @@ extern "C"
23462356 BNArchitecture * arch , BNRelocation * reloc , uint8_t * dest , size_t len );
23472357 BINARYNINJACOREAPI bool BNRelocationHandlerDefaultApplyRelocation (BNRelocationHandler * handler , BNBinaryView * view ,
23482358 BNArchitecture * arch , BNRelocation * reloc , uint8_t * dest , size_t len );
2359+ BINARYNINJACOREAPI size_t BNRelocationHandlerGetOperandForExternalRelocation (BNRelocationHandler * handler ,
2360+ const uint8_t * data , uint64_t addr , size_t length , const BNLowLevelILFunction * il , BNRelocation * relocation );
23492361 // Analysis
23502362 BINARYNINJACOREAPI void BNAddAnalysisOption (BNBinaryView * view , const char * name );
23512363 BINARYNINJACOREAPI void BNAddFunctionForAnalysis (BNBinaryView * view , BNPlatform * platform , uint64_t addr );
0 commit comments