OS.emitAbsoluteSymbolDiff(ProcRecordEnd, ProcRecordBegin, 2);
OS.EmitLabel(ProcRecordBegin);
+ if (GV->hasLocalLinkage()) {
+ OS.AddComment("Record kind: S_LPROC32_ID");
+ OS.EmitIntValue(unsigned(SymbolKind::S_LPROC32_ID), 2);
+ } else {
OS.AddComment("Record kind: S_GPROC32_ID");
OS.EmitIntValue(unsigned(SymbolKind::S_GPROC32_ID), 2);
+ }
// These fields are filled in by tools like CVPACK which run after the fact.
OS.AddComment("PtrParent");
OS.AddComment("Record length");
OS.emitAbsoluteSymbolDiff(DataEnd, DataBegin, 2);
OS.EmitLabel(DataBegin);
- OS.AddComment("Record kind: S_GDATA32");
- OS.EmitIntValue(unsigned(SymbolKind::S_GDATA32), 2);
+ if (DIGV->isLocalToUnit()) {
+ 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);
+ }
OS.AddComment("Type");
OS.EmitIntValue(getCompleteTypeIndex(DIGV->getType()).getIndex(), 4);
OS.AddComment("DataOffset");
void CVSymbolDumperImpl::visitDataSym(SymbolKind Kind, DataSym &Data) {
DictScope S(W, "DataSym");
+ W.printEnum("Kind", uint16_t(Kind), getSymbolTypeNames());
StringRef LinkageName;
if (ObjDelegate) {
ObjDelegate->printRelocatedField("DataOffset", Data.getRelocationOffset(),
InFunctionScope = true;
StringRef LinkageName;
+ W.printEnum("Kind", uint16_t(Kind), getSymbolTypeNames());
W.printHex("PtrParent", Proc.Header.PtrParent);
W.printHex("PtrEnd", Proc.Header.PtrEnd);
W.printHex("PtrNext", Proc.Header.PtrNext);
; This tests that we don't emit information about globals that were discarded
; during optimization. We should only see one global symbol record.
-; CHECK: .short 4365 # Record kind: S_GDATA32
+; CHECK: .short 4364 # Record kind: S_LDATA32
; CHECK: .long 117 # Type
; CHECK: .secrel32 x # DataOffset
; CHECK: .secidx x # Segment
; ASM: .long 4 # Debug section magic
; ASM: .short {{.*-.*}} # Record length
-; ASM: .short 4365 # Record kind: S_GDATA32
+; ASM: .short 4364 # Record kind: S_LDATA32
; ASM: .long 116 # Type
; ASM: .secrel32 "?first@@3HA" # DataOffset
; ASM: .secidx "?first@@3HA" # Segment
; OBJ: Subsection [
; OBJ: SubSectionType: Symbols (0xF1)
; OBJ: DataSym {
+; OBJ: Kind: S_LDATA32 (0x110C)
; OBJ: DataOffset: ?first@@3HA+0x0
; OBJ: Type: int (0x74)
; OBJ: DisplayName: first
; OBJ: LinkageName: ?first@@3HA
; OBJ: }
; OBJ: DataSym {
+; OBJ: Kind: S_GDATA32 (0x110D)
; OBJ: DataOffset: ?middle@@3PEBHEB+0x0
; OBJ: Type: const int* (0x1001)
; OBJ: DisplayName: middle
; OBJ: LinkageName: ?middle@@3PEBHEB
; OBJ: }
; OBJ: DataSym {
+; OBJ: Kind: S_GDATA32 (0x110D)
; OBJ: DataOffset: ?last@@3HA+0x0
; OBJ: Type: int (0x74)
; OBJ: DisplayName: last
$"\01?comdat@?$A@X@@2HB" = comdat any
-@"\01?first@@3HA" = global i32 0, align 4
+@"\01?first@@3HA" = internal global i32 0, align 4
@"\01?comdat@?$A@X@@2HB" = linkonce_odr constant i32 3, comdat, align 4
@"\01?middle@@3PEBHEB" = global i32* @"\01?comdat@?$A@X@@2HB", align 8
@"\01?last@@3HA" = global i32 0, align 4
!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
!2 = !{}
!3 = !{!4, !6, !13, !15}
-!4 = distinct !DIGlobalVariable(name: "first", linkageName: "\01?first@@3HA", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32* @"\01?first@@3HA")
+!4 = distinct !DIGlobalVariable(name: "first", linkageName: "\01?first@@3HA", scope: !0, file: !1, line: 1, type: !5, isLocal: true, isDefinition: true, variable: i32* @"\01?first@@3HA")
!5 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!6 = distinct !DIGlobalVariable(name: "comdat", linkageName: "\01?comdat@?$A@X@@2HB", scope: !0, file: !1, line: 2, type: !7, isLocal: false, isDefinition: true, variable: i32* @"\01?comdat@?$A@X@@2HB", declaration: !8)
!7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !5)
; X86-NEXT: [[F1_START]]:
; X86-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]] #
; X86-NEXT: [[PROC_SEGMENT_START]]:
-; X86-NEXT: .short 4423
+; X86-NEXT: .short 4422
; X86-NEXT: .long 0
; X86-NEXT: .long 0
; X86-NEXT: .long 0
; OBJ32-NEXT: SubSectionType: Symbols (0xF1)
; OBJ32-NOT: ]
; OBJ32: ProcStart {
+; OBJ32: Kind: S_LPROC32_ID (0x1146)
; OBJ32: CodeSize: 0x6
; OBJ32: DisplayName: x
; OBJ32: LinkageName: _x
; OBJ32-NEXT: SubSectionType: Symbols (0xF1)
; OBJ32-NOT: ]
; OBJ32: ProcStart {
+; OBJ32: Kind: S_GPROC32_ID (0x1147)
; OBJ32: CodeSize: 0x6
; OBJ32: DisplayName: y
; OBJ32: LinkageName: _y
; OBJ32-NEXT: SubSectionType: Symbols (0xF1)
; OBJ32-NOT: ]
; OBJ32: ProcStart {
+; OBJ32: Kind: S_GPROC32_ID (0x1147)
; OBJ32: CodeSize: 0x10
; OBJ32: DisplayName: f
; OBJ32: LinkageName: _f
; X64-NEXT: [[F1_START]]:
; X64-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]] #
; X64-NEXT: [[PROC_SEGMENT_START]]:
-; X64-NEXT: .short 4423
+; X64-NEXT: .short 4422
; X64-NEXT: .long 0
; X64-NEXT: .long 0
; X64-NEXT: .long 0
; OBJ64-NEXT: SubSectionType: Symbols (0xF1)
; OBJ64-NOT: ]
; OBJ64: ProcStart {
+; OBJ64: Kind: S_LPROC32_ID (0x1146)
; OBJ64: CodeSize: 0xE
; OBJ64: DisplayName: x
; OBJ64: LinkageName: x
; OBJ64-NEXT: SubSectionType: Symbols (0xF1)
; OBJ64-NOT: ]
; OBJ64: ProcStart {
+; OBJ64: Kind: S_GPROC32_ID (0x1147)
; OBJ64: CodeSize: 0xE
; OBJ64: DisplayName: y
; OBJ64: LinkageName: y
; OBJ64-NEXT: SubSectionType: Symbols (0xF1)
; OBJ64-NOT: ]
; OBJ64: ProcStart {
+; OBJ64: Kind: S_GPROC32_ID (0x1147)
; OBJ64: CodeSize: 0x18
; OBJ64: DisplayName: f
; OBJ64: LinkageName: f
; OBJ64-NEXT: ]
; Function Attrs: nounwind
-define void @x() #0 !dbg !4 {
+define internal void @x() #0 !dbg !4 {
entry:
call void @z(), !dbg !14
ret void, !dbg !15
; EMPTY-NEXT: }
; EMPTY-NEXT: {
; EMPTY-NEXT: ProcStart {
+; EMPTY-NEXT: Kind: S_GPROC32 (0x1110)
; EMPTY-NEXT: PtrParent: 0x0
; EMPTY-NEXT: PtrEnd: 0xC4
; EMPTY-NEXT: PtrNext: 0x0
; EMPTY-NEXT: }
; EMPTY-NEXT: {
; EMPTY-NEXT: DataSym {
+; EMPTY-NEXT: Kind: S_GDATA32 (0x110D)
; EMPTY-NEXT: Type: void* (0x403)
; EMPTY-NEXT: DisplayName: __purecall
; EMPTY-NEXT: }