<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 22, 2016, at 9:50 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jan 22, 2016 at 9:43 AM, Adrian Prantl via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br class="">
Date: Fri Jan 22 11:43:43 2016<br class="">
New Revision: 258507<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=258507&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=258507&view=rev</a><br class="">
Log:<br class="">
Module Debugging: Use a nonzero DWO id for precompiled headers.<br class="">
PCH files don't have a module signature and LLVM uses a nonzero DWO id as<br class="">
an indicator for skeleton / module CUs. This change pins the DWO id for PCH<br class="">
files to a known constant value.<br class="">
The correct long-term solution here is to implement a module signature<br class="">
that is an actual dterministic hash (at the moment module signatures are<br class="">
just random nonzero numbers) and then enable this for PCH files as well.<br class=""></blockquote><div class=""><br class=""></div><div class="">^ is this on the books/planned at all?</div><div class=""> </div></div></div></div></div></blockquote><div><br class=""></div><div>IIRC there was some consensus on the list that this would be the way forward. Back then (~1 year ago) we still had massive problems with PCM files being nondeterministic (Chandler later fixed at least some of that) so it was not immediately possible at the time. But the random ID that we use currently is causing me headaches in dsymutil because it will, e.g., warn about dwoid mismatches for modules that have been rebuilt but haven’t actually changed, so I definitely want to do this.</div><div><br class=""></div><div>-- adrian</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
<<a href="rdar://problem/24290667" class="">rdar://problem/24290667</a>><br class="">
<br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">
    cfe/trunk/test/Modules/ExtDebugInfo.cpp<br class="">
    cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jan 22 11:43:43 2016<br class="">
@@ -1740,11 +1740,14 @@ CGDebugInfo::getOrCreateModuleRef(Extern<br class="">
<br class="">
   bool IsRootModule = M ? !M->Parent : true;<br class="">
   if (CreateSkeletonCU && IsRootModule) {<br class="">
+    // PCH files don't have a signature field in the control block,<br class="">
+    // but LLVM detects skeleton CUs by looking for a non-zero DWO id.<br class="">
+    uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1U;<br class="">
     llvm::DIBuilder DIB(CGM.getModule());<br class="">
     DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(),<br class="">
                           Mod.getPath(), TheCU->getProducer(), true,<br class="">
                           StringRef(), 0, Mod.getASTFile(),<br class="">
-                          llvm::DIBuilder::FullDebug, Mod.getSignature());<br class="">
+                          llvm::DIBuilder::FullDebug, Signature);<br class="">
     DIB.finalize();<br class="">
   }<br class="">
   llvm::DIModule *Parent =<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=258507&r1=258506&r2=258507&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=258507&r1=258506&r2=258507&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Fri Jan 22 11:43:43 2016<br class="">
@@ -219,7 +219,11 @@ public:<br class="">
<br class="">
     M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple());<br class="">
     M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString());<br class="">
-    Builder->getModuleDebugInfo()->setDwoId(Buffer->Signature);<br class="">
+<br class="">
+    // PCH files don't have a signature field in the control block,<br class="">
+    // but LLVM detects DWO CUs by looking for a non-zero DWO id.<br class="">
+    uint64_t Signature = Buffer->Signature ? Buffer->Signature : ~1U;<br class="">
+    Builder->getModuleDebugInfo()->setDwoId(Signature);<br class="">
<br class="">
     // Finalize the Builder.<br class="">
     if (Builder)<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Fri Jan 22 11:43:43 2016<br class="">
@@ -102,3 +102,7 @@ void foo() {<br class="">
<br class="">
<br class="">
 // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, entity: !"_ZTSN8DebugCXX6StructE", line: 24)<br class="">
+<br class="">
+// CHECK: !DICompileUnit(<br class="">
+// CHECK-SAME:           splitDebugFilename:<br class="">
+// CHECK-SAME:           dwoId:<br class="">
<br class="">
Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Fri Jan 22 11:43:43 2016<br class="">
@@ -8,7 +8,6 @@<br class="">
 // RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll<br class="">
 // RUN: cat %t-mod.ll | FileCheck %s<br class="">
 // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s<br class="">
-// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-DWO %s<br class="">
<br class="">
 // PCH:<br class="">
 // RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll<br class="">
@@ -22,7 +21,7 @@<br class="">
 // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,<br class="">
 // CHECK-SAME:                    isOptimized: false,<br class="">
 // CHECK-SAME-NOT:                splitDebugFilename:<br class="">
-// CHECK-DWO:                     dwoId:<br class="">
+// CHECK:                         dwoId:<br class="">
<br class="">
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum"<br class="">
 // CHECK-SAME:             identifier: "_ZTSN8DebugCXX4EnumE")<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>