MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / GetRelocationInfo

Method GetRelocationInfo

arch/x86/arch_x86.cpp:4221–4290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4219
4220
4221 virtual bool GetRelocationInfo(Ref<BinaryView> view, Ref<Architecture> arch, vector<BNRelocationInfo>& result) override
4222 {
4223 (void)view; (void)arch;
4224 set<uint64_t> relocTypes;
4225 for (size_t i = 0; i < result.size(); i++)
4226 {
4227 result[i].type = StandardRelocationType;
4228 switch (result[i].nativeType)
4229 {
4230 case X86_64_RELOC_UNSIGNED:
4231 result[i].hasSign = false;
4232 break;
4233 case X86_64_RELOC_BRANCH:
4234 result[i].pcRelative = true;
4235 result[i].size = 4;
4236 result[i].implicitAddend = true;
4237 break;
4238 case X86_64_RELOC_GOT:
4239 case X86_64_RELOC_GOT_LOAD:
4240 result[i].pcRelative = true;
4241 result[i].size = 4;
4242 result[i].implicitAddend = true;
4243 break;
4244 case X86_64_RELOC_SIGNED:
4245 result[i].implicitAddend = true;
4246 result[i].size = 4;
4247 result[i].hasSign = true;
4248 break;
4249 case X86_64_RELOC_SIGNED_1:
4250 result[i].implicitAddend = true;
4251 result[i].addend = 1;
4252 result[i].size = 4;
4253 result[i].hasSign = true;
4254 break;
4255 case X86_64_RELOC_SIGNED_2:
4256 result[i].implicitAddend = true;
4257 result[i].addend = 2;
4258 result[i].size = 4;
4259 result[i].hasSign = true;
4260 break;
4261 case X86_64_RELOC_SIGNED_4:
4262 result[i].implicitAddend = true;
4263 result[i].addend = 4;
4264 result[i].size = 4;
4265 result[i].hasSign = true;
4266 break;
4267 case X86_64_RELOC_SUBTRACTOR:
4268 // X86_64_RELOC_SUBTRACTOR should always be followed by a X86_64_RELOC_UNSIGNED
4269 if (i == result.size() - 1)
4270 result[i].type = IgnoredRelocation;
4271 else if ((Machox64RelocationType)result[i + 1].type != X86_64_RELOC_UNSIGNED)
4272 result[i].type = IgnoredRelocation;
4273 else
4274 {
4275 result[i + 1].type = IgnoredRelocation;
4276 result[i].next = new BNRelocationInfo(result[i + 1]);
4277 i++;
4278 }

Callers

nothing calls this directly

Calls 3

GetRelocationStringFunction · 0.70
sizeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected