[llvm] r274734 - [CodeView] Implement support for thread-local variables
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 6 22:14:21 PDT 2016
Author: majnemer
Date: Thu Jul 7 00:14:21 2016
New Revision: 274734
URL: http://llvm.org/viewvc/llvm-project?rev=274734&view=rev
Log:
[CodeView] Implement support for thread-local variables
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/trunk/test/DebugInfo/COFF/globals.ll
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=274734&r1=274733&r2=274734&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Thu Jul 7 00:14:21 2016
@@ -1998,12 +1998,23 @@ void CodeViewDebug::emitDebugInfoForGlob
OS.AddComment("Record length");
OS.emitAbsoluteSymbolDiff(DataEnd, DataBegin, 2);
OS.EmitLabel(DataBegin);
+ const auto *GV = cast<GlobalVariable>(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);
Modified: llvm/trunk/test/DebugInfo/COFF/globals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/globals.ll?rev=274734&r1=274733&r2=274734&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/globals.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/globals.ll Thu Jul 7 00:14:21 2016
@@ -21,7 +21,7 @@
; ASM: .asciz "first" # Name
; ASM: .short {{.*-.*}} # Record length
-; ASM: .short 4365 # Record kind: S_GDATA32
+; ASM: .short 4371 # Record kind: S_GTHREAD32
; ASM: .long 4097 # Type
; ASM: .secrel32 "?middle@@3PEBHEB" # DataOffset
; ASM: .secidx "?middle@@3PEBHEB" # Segment
@@ -80,8 +80,7 @@
; OBJ: DisplayName: first
; OBJ: LinkageName: ?first@@3HA
; OBJ: }
-; OBJ: DataSym {
-; OBJ: Kind: S_GDATA32 (0x110D)
+; OBJ: ThreadLocalDataSym {
; OBJ: DataOffset: ?middle@@3PEBHEB+0x0
; OBJ: Type: const int* (0x1001)
; OBJ: DisplayName: middle
@@ -97,7 +96,7 @@
; OBJ: ]
; OBJ: ]
; OBJ: CodeViewDebugInfo [
-; OBJ: Section: .debug$S (6)
+; OBJ: Section: .debug$S (7)
; OBJ: Magic: 0x4
; OBJ: Subsection [
; OBJ: SubSectionType: Symbols (0xF1)
@@ -120,7 +119,7 @@ $"\01?comdat@?$A at X@@2HB" = comdat any
@"\01?first@@3HA" = internal global i32 0, align 4
@"\01?comdat@?$A at X@@2HB" = linkonce_odr constant i32 3, comdat, align 4
-@"\01?middle@@3PEBHEB" = global i32* @"\01?comdat@?$A at X@@2HB", align 8
+@"\01?middle@@3PEBHEB" = thread_local global i32* @"\01?comdat@?$A at X@@2HB", align 8
@"\01?last@@3HA" = global i32 0, align 4
!llvm.dbg.cu = !{!0}
More information about the llvm-commits
mailing list