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

David Blaikie dblaikie at gmail.com
Mon Jul 1 17:28:08 PDT 2013


On Mon, Jul 1, 2013 at 5:23 PM, Ulrich Weigand
<Ulrich.Weigand at de.ibm.com> wrote:
> David Blaikie <dblaikie at gmail.com> wrote:
>
>> Restrict the current TLS support to X86 ELF for now. Test that we don't
>> produce it on PPC & we can flesh that test case out with the right thing
>> once someone implements it.
>
> I've now added the missing relocation types.  However, I'm not sure how
> to implement the rest of the TLS DWARF support, because on PowerPC, we
> need to add a bias of 0x8000 to the @dtprel value.  GCC outputs assembler
> code along these lines:
>
>         .uleb128 0x2     # (DIE (0x2d) DW_TAG_variable)
>         .ascii "x\0"     # DW_AT_name
>         .byte   0x1      # DW_AT_decl_file (test.c)
>         .byte   0x2      # DW_AT_decl_line
>         .4byte  0x42     # DW_AT_type
>         .byte   0x1      # DW_AT_external
>         .byte   0xa      # DW_AT_location
>         .byte   0x3      # DW_OP_addr
>         .quad   x at dtprel+0x8000
>         .byte   0xe0     # DW_OP_GNU_push_tls_address
>
> I'm not sure how to represent the +0x8000, since the
> getDebugThreadLocalSymbol
> routine must return a plain MCExprSymbolRef.

That was just a simple pragmatic choice allowing just enough
expressive power as I needed to implement the case I knew about (X86
ELF)

> 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.

- David



More information about the llvm-commits mailing list