diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-06-15 00:19:52 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-15 00:19:52 +0000 |
commit | 577be0fed36f4d26e767a39a7838c63e90574e13 (patch) | |
tree | 8afdece13c65d90f0cbc5d5debfca52bc64c2f0e | |
parent | cbf614a93b1d59655e7749df1a31b5cb4ac29972 (diff) | |
download | bcm5719-llvm-577be0fed36f4d26e767a39a7838c63e90574e13.tar.gz bcm5719-llvm-577be0fed36f4d26e767a39a7838c63e90574e13.zip |
[CodeView] Don't emit debuginfo for imported symbols
Emitting symbol information requires us to have a definition for the
symbol. A symbol reference is insufficient.
This fixes PR28123.
llvm-svn: 272738
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 5 | ||||
-rw-r--r-- | llvm/test/DebugInfo/COFF/global-dllimport.ll | 29 |
2 files changed, 32 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index a90ce05249e..3b7815f3e0b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -249,7 +249,8 @@ void CodeViewDebug::endModule() { // Emit per-function debug information. for (auto &P : FnDebugInfo) - emitDebugInfoForFunction(P.first, P.second); + if (!P.first->isDeclarationForLinker()) + emitDebugInfoForFunction(P.first, P.second); // Emit global variable debug information. emitDebugInfoForGlobals(); @@ -1318,7 +1319,7 @@ void CodeViewDebug::emitDebugInfoForGlobals() { MCSymbol *EndLabel = nullptr; for (const DIGlobalVariable *G : CU->getGlobalVariables()) { if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) { - if (!GV->hasComdat()) { + if (!GV->hasComdat() && !GV->isDeclarationForLinker()) { if (!EndLabel) { OS.AddComment("Symbol subsection for globals"); EndLabel = beginCVSubsection(ModuleSubstreamKind::Symbols); diff --git a/llvm/test/DebugInfo/COFF/global-dllimport.ll b/llvm/test/DebugInfo/COFF/global-dllimport.ll new file mode 100644 index 00000000000..9d21a43e5eb --- /dev/null +++ b/llvm/test/DebugInfo/COFF/global-dllimport.ll @@ -0,0 +1,29 @@ +; RUN: llc < %s | FileCheck %s + +; CHECK-NOT: S_GDATA32 + +target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" +target triple = "i686-pc-windows-msvc" + +@"\01?id@?$numpunct@D@@0HA" = available_externally dllimport global i32 0, align 4 + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!13, !14} +!llvm.ident = !{!15} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 272628) (llvm/trunk 272566)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3) +!1 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/<stdin>", directory: "/usr/local/google/home/majnemer/llvm/src") +!2 = !{} +!3 = !{!4} +!4 = distinct !DIGlobalVariable(name: "id", linkageName: "\01?id@?$numpunct@D@@0HA", scope: !0, file: !5, line: 4, type: !6, isLocal: false, isDefinition: true, variable: i32* @"\01?id@?$numpunct@D@@0HA", declaration: !7) +!5 = !DIFile(filename: "/usr/local/google/home/majnemer/Downloads/t.ii", directory: "/usr/local/google/home/majnemer/llvm/src") +!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) +!7 = !DIDerivedType(tag: DW_TAG_member, name: "id", scope: !8, file: !5, line: 2, baseType: !6, flags: DIFlagStaticMember) +!8 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "numpunct<char>", file: !5, line: 2, size: 8, align: 8, elements: !9, templateParams: !10) +!9 = !{!7} +!10 = !{!11} +!11 = !DITemplateTypeParameter(type: !12) +!12 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) +!13 = !{i32 2, !"CodeView", i32 1} +!14 = !{i32 2, !"Debug Info Version", i32 3} +!15 = !{!"clang version 3.9.0 (trunk 272628) (llvm/trunk 272566)"} |