[llvm] r185389 - PR16493: DebugInfo with TLS on PPC crashing due to invalid relocation

Ulrich Weigand Ulrich.Weigand at de.ibm.com
Tue Jul 2 05:08:33 PDT 2013


David Blaikie <dblaikie at gmail.com> wrote on 02.07.2013 02:28:08:

> On Mon, Jul 1, 2013 at 5:23 PM, Ulrich Weigand
> <Ulrich.Weigand at de.ibm.com> wrote:
> > Could this be changed to a full MCExpr, or at least allow
> > symbol + offset ?
>
> I don't see any reason this wouldn't be reasonable - you'll have to
> plumb it through similar to how I have done so already, including for
> fission (-gsplit-dwarf, see my recent commit to add support for this),
> but it should be fairly obvious/mechanical.

OK, so I've changed the return value of getDebugThreadLocalSymbol to
be a MCExpr.  This flows into either a DIELabel or an AddrPool.
The latter can simply be likewise changed from holding MCSymbolRefExpr
to holding full MCExpr, but the former is a bit of a problem,
due to code DwarfDebug::emitDIE that explicitly expects labels:

    case dwarf::DW_AT_location: {
      if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {
        if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
          Asm->EmitLabelReference(&L->getValue()->getSymbol(), 4);
        else
          Asm->EmitLabelDifference(&L->getValue()->getSymbol(),
DwarfDebugLocSectionSym, 4);
      } else {
        Values[i]->EmitValue(Asm, Form);
      }
      break;
    }

Now I guess the special handling does make sense if we're
dealing with a label refering to other places within
debug info.  But when refering to code/data elements,
I think allowing a full MCExpr is more useful.

Thus I've split the current DIELabel into two variants:
a DIELabel that now really only handles MCSymbol, and a
new DIEExpr that handles arbitrary MCExpr expressions.

With all those changes in place, I was able to add
support for describing TLS variables on PowerPC in
a straightforward manner.

The attached patch hold all these changes.  Does this
look reasonable?

Thanks,
Ulrich

(See attached file: diff-llvm-ppc-tls)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff-llvm-ppc-tls
Type: application/octet-stream
Size: 18160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130702/01a88973/attachment.obj>


More information about the llvm-commits mailing list