[LLVMbugs] [Bug 18423] New: LLVM should emit DW_OP_form_tls_address instead of DW_OP_GNU_push_tls_address

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 8 09:58:33 PST 2014


            Bug ID: 18423
           Summary: LLVM should emit DW_OP_form_tls_address instead of
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For thread-local storage, LLVM currently uses the custom DWARF expression
DW_OP_GNU_push_tls_address. There is a DW_OP_form_tls_address that has been
part of the DWARF spec since version 3.


According to
the reason for this is that GDB up to 7.5 does not support

Here is a patch we can apply once GDB supports the official DWARF expression:

diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 04a2573..bfe1524 100644
--- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1595,7 +1595,9 @@ void
        addUInt(Block, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));
      // 3) followed by a custom OP to make the debugger do a TLS lookup.
-      addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_push_tls_address);
+      addUInt(Block, dwarf::DW_FORM_data1,
+              DD->getDwarfVersion() <= 2 ? dwarf::DW_OP_GNU_push_tls_address
+                                         : dwarf::DW_OP_form_tls_address);
    } else {
      DD->addArangeLabel(SymbolCU(this, Sym));
      addOpAddress(Block, Sym);

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140108/5d2c5d57/attachment.html>

More information about the llvm-bugs mailing list