<div dir="ltr">Hi Rafael,<div><br></div><div>In the section below, why did you subtract 4 from Value.Addend? It seems like that will result in the value that is eventually written into the GOT being off-by-negative-four? I have a test case where that's happening to an external symbol.</div>
<div><br></div><div>Apologies if I'm missing something obvious - I'm still trying to wrap my head around a lot of the details of RuntimeDyld.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div><div><br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- if (Arch == Triple::arm && (RelType & 0xf) == macho::RIT_ARM_Branch24Bit) {<br>
+ if (Arch == Triple::x86_64 && RelType == macho::RIT_X86_64_GOT) {<br>
+ assert(IsPCRel);<br>
+ assert(Size == 2);<br>
+ StubMap::const_iterator i = Stubs.find(Value);<br>
+ uint8_t *Addr;<br>
+ if (i != Stubs.end()) {<br>
+ Addr = Section.Address + i->second;<br>
+ } else {<br>
+ Stubs[Value] = Section.StubOffset;<br>
+ uint8_t *GOTEntry = Section.Address + Section.StubOffset;<br>
+ RelocationEntry RE(SectionID, Section.StubOffset,<br>
+ macho::RIT_X86_64_Unsigned, Value.Addend - 4, false,<br>
+ 3);<br>
+ if (Value.SymbolName)<br>
+ addRelocationForSymbol(RE, Value.SymbolName);<br>
+ else<br>
+ addRelocationForSection(RE, Value.SectionID);<br>
+ Section.StubOffset += 8;<br>
+ Addr = GOTEntry;<br>
+ }<br>
+ resolveRelocation(Section, Offset, (uint64_t)Addr,<br>
+ macho::RIT_X86_64_Unsigned, 4, true, 2);<br>
+ } else if (Arch == Triple::arm &&<br>
+ (RelType & 0xf) == macho::RIT_ARM_Branch24Bit) {<br> </blockquote></div></div></div></div></div>