[llvm] r181167 - Add EH support to the MCJIT.

Lang Hames lhames at gmail.com
Tue Aug 13 17:54:30 PDT 2013


Hi Rafael,

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.

Apologies if I'm missing something obvious - I'm still trying to wrap my
head around a lot of the details of RuntimeDyld.

Cheers,
Lang.

-  if (Arch == Triple::arm && (RelType & 0xf) ==
> macho::RIT_ARM_Branch24Bit) {
> +  if (Arch == Triple::x86_64 && RelType == macho::RIT_X86_64_GOT) {
> +    assert(IsPCRel);
> +    assert(Size == 2);
> +    StubMap::const_iterator i = Stubs.find(Value);
> +    uint8_t *Addr;
> +    if (i != Stubs.end()) {
> +      Addr = Section.Address + i->second;
> +    } else {
> +      Stubs[Value] = Section.StubOffset;
> +      uint8_t *GOTEntry = Section.Address + Section.StubOffset;
> +      RelocationEntry RE(SectionID, Section.StubOffset,
> +                         macho::RIT_X86_64_Unsigned, Value.Addend - 4,
> false,
> +                         3);
> +      if (Value.SymbolName)
> +        addRelocationForSymbol(RE, Value.SymbolName);
> +      else
> +        addRelocationForSection(RE, Value.SectionID);
> +      Section.StubOffset += 8;
> +      Addr = GOTEntry;
> +    }
> +    resolveRelocation(Section, Offset, (uint64_t)Addr,
> +                      macho::RIT_X86_64_Unsigned, 4, true, 2);
> +  } else if (Arch == Triple::arm &&
> +             (RelType & 0xf) == macho::RIT_ARM_Branch24Bit) {
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130813/841b8f08/attachment.html>


More information about the llvm-commits mailing list