[PATCH] D33673: [Object/RelocVisitor] - Add support for R_X86_64_DTPOFF32 relocation.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 00:35:17 PDT 2017


>> And run of llvm-dwarfdump tls.o would report "error: failed to compute relocation: R_X86_64_DTPOFF32"
>> error then, because such a relocation is not supported atm.
>>
>> R_X86_64_DTPOFF32 calculates negative offset in the TLS block.
>
>The spec (and the lld source) suggests it computes the offset in the tls
>block, so you don't need the size.
>> Problem that size of TLS segment is not known
>> here. The same applies for PR33173 where we use RelocVisitor as part of DWARFContextInMemory for building .gdb_index.
>> TLS relocations pointing to .debug_info seems useless for index
>> building purposes and we do not care about final value too.
>
>This suggest that it might be better to not compute it at all.
>
>BTW, why was this not failing the link?
>

Because DWARFContextInMemory currently prints a error, but continues parsing object in the case
when something wrong with proccessing of relocations:

      object::RelocVisitor V(Obj, L ? L->getTlsSize() : 0);
      uint64_t Val = V.visit(Reloc.getType(), Reloc, SymInfoOrErr->Address);
      if (V.error()) {
        SmallString<32> Name;
        Reloc.getTypeName(Name);
        errs() << "error: failed to compute relocation: " << Name << "\n";
        continue;
      }

So do you mean we should just teach RelocVisitor to resolve it just to something, like zero or symbol value,
just to stop emiting error ?

>Cheers,
>Rafael

George.


More information about the llvm-commits mailing list