[llvm] r192118 - Formally added an explicit enum for DWARF TLS support. No functionality change.

Eric Christopher echristo at gmail.com
Tue Jan 7 15:23:18 PST 2014


On Tue, Jan 7, 2014 at 3:09 PM, Adrian Prantl <aprantl at apple.com> wrote:
> Hi Richard,
>
> [Apologies for replying to age-old commits]

Heh. I've got 1 from June or something I still need to look at :)

> I’m wondering why we are using the custom DW_OP_GNU_push_tls_address when there is a DW_OP_form_tls_address since DWARF 3. Are there historical or technical reasons why we do this? Could we change it to use the DWARF version?
>

We can. My guess is that there are pre-dwarf3 readers that understand
the OP_GNU one and not the other, but I'm not very sympathetic. Could
just pick it as < dwarf3 use the OP_GNU one, otherwise use the
standard one.

-eric

> -- adrian
>
> On Oct 7, 2013, at 11:39, Richard Mitton <richard at codersnotes.com> wrote:
>
>> Author: rmitton
>> Date: Mon Oct  7 13:39:18 2013
>> New Revision: 192118
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=192118&view=rev
>> Log:
>> Formally added an explicit enum for DWARF TLS support. No functionality change.
>>
>> Modified:
>>    llvm/trunk/include/llvm/Support/Dwarf.h
>>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>>    llvm/trunk/lib/Support/Dwarf.cpp
>>
>> Modified: llvm/trunk/include/llvm/Support/Dwarf.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=192118&r1=192117&r2=192118&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/Dwarf.h (original)
>> +++ llvm/trunk/include/llvm/Support/Dwarf.h Mon Oct  7 13:39:18 2013
>> @@ -486,6 +486,9 @@ enum Constants {
>>   DW_OP_lo_user = 0xe0,
>>   DW_OP_hi_user = 0xff,
>>
>> +  // Extensions for GNU-style thread-local storage.
>> +  DW_OP_GNU_push_tls_address = 0xe0,
>> +
>>   // Extensions for Fission proposal.
>>   DW_OP_GNU_addr_index = 0xfb,
>>   DW_OP_GNU_const_index = 0xfc,
>>
>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=192118&r1=192117&r2=192118&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Oct  7 13:39:18 2013
>> @@ -1505,14 +1505,15 @@ void CompileUnit::createGlobalVariableDI
>>         // 1) Start with a constNu of the appropriate pointer size
>>         addUInt(Block, 0, dwarf::DW_FORM_data1,
>>                 PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);
>> -        // 2) containing the (relocated) address of the TLS variable
>> +        // 2) containing the (relocated) offset of the TLS variable
>> +        //    within the module's TLS block.
>>         addExpr(Block, 0, dwarf::DW_FORM_udata, Expr);
>>       } else {
>>         addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
>>         addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));
>>       }
>> -      // 3) followed by a custom OP to tell the debugger about TLS (presumably)
>> -      addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_lo_user);
>> +      // 3) followed by a custom OP to make the debugger do a TLS lookup.
>> +      addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_push_tls_address);
>>     } else
>>       addOpAddress(Block, Sym);
>>     // Do not create specification DIE if context is either compile unit
>>
>> Modified: llvm/trunk/lib/Support/Dwarf.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=192118&r1=192117&r2=192118&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Dwarf.cpp (original)
>> +++ llvm/trunk/lib/Support/Dwarf.cpp Mon Oct  7 13:39:18 2013
>> @@ -456,10 +456,11 @@ const char *llvm::dwarf::OperationEncodi
>>   case DW_OP_bit_piece:                  return "DW_OP_bit_piece";
>>   case DW_OP_implicit_value:             return "DW_OP_implicit_value";
>>   case DW_OP_stack_value:                return "DW_OP_stack_value";
>> -  case DW_OP_lo_user:                    return "DW_OP_lo_user";
>> -  case DW_OP_hi_user:                    return "DW_OP_hi_user";
>>
>> -    // DWARF5 Fission Proposal Op Extensions
>> +  // GNU thread-local storage
>> +  case DW_OP_GNU_push_tls_address:       return "DW_OP_GNU_push_tls_address";
>> +
>> +  // DWARF5 Fission Proposal Op Extensions
>>   case DW_OP_GNU_addr_index:             return "DW_OP_GNU_addr_index";
>>   case DW_OP_GNU_const_index:            return "DW_OP_GNU_const_index";
>>   }
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list