From a54fe1acdc2df47c80f1eb319d7f8bcd65018aa9 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 7 Jul 2016 05:14:21 +0000 Subject: [CodeView] Implement support for thread-local variables llvm-svn: 274734 --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 6e6a76e..bb959e2 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1998,12 +1998,23 @@ void CodeViewDebug::emitDebugInfoForGlobal(const DIGlobalVariable *DIGV, OS.AddComment("Record length"); OS.emitAbsoluteSymbolDiff(DataEnd, DataBegin, 2); OS.EmitLabel(DataBegin); + const auto *GV = cast(DIGV->getVariable()); if (DIGV->isLocalToUnit()) { - OS.AddComment("Record kind: S_LDATA32"); - OS.EmitIntValue(unsigned(SymbolKind::S_LDATA32), 2); + if (GV->isThreadLocal()) { + OS.AddComment("Record kind: S_LTHREAD32"); + OS.EmitIntValue(unsigned(SymbolKind::S_LTHREAD32), 2); + } else { + OS.AddComment("Record kind: S_LDATA32"); + OS.EmitIntValue(unsigned(SymbolKind::S_LDATA32), 2); + } } else { - OS.AddComment("Record kind: S_GDATA32"); - OS.EmitIntValue(unsigned(SymbolKind::S_GDATA32), 2); + if (GV->isThreadLocal()) { + OS.AddComment("Record kind: S_GTHREAD32"); + OS.EmitIntValue(unsigned(SymbolKind::S_GTHREAD32), 2); + } else { + OS.AddComment("Record kind: S_GDATA32"); + OS.EmitIntValue(unsigned(SymbolKind::S_GDATA32), 2); + } } OS.AddComment("Type"); OS.EmitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4); -- cgit v1.1