> On Jan 22, 2016, at 9:50 AM, David Blaikie <dblai...@gmail.com> wrote: > > > > On Fri, Jan 22, 2016 at 9:43 AM, Adrian Prantl via cfe-commits > <cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org>> wrote: > Author: adrian > Date: Fri Jan 22 11:43:43 2016 > New Revision: 258507 > > URL: http://llvm.org/viewvc/llvm-project?rev=258507&view=rev > <http://llvm.org/viewvc/llvm-project?rev=258507&view=rev> > Log: > Module Debugging: Use a nonzero DWO id for precompiled headers. > PCH files don't have a module signature and LLVM uses a nonzero DWO id as > an indicator for skeleton / module CUs. This change pins the DWO id for PCH > files to a known constant value. > The correct long-term solution here is to implement a module signature > that is an actual dterministic hash (at the moment module signatures are > just random nonzero numbers) and then enable this for PCH files as well. > > ^ is this on the books/planned at all? >
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. -- adrian > > <rdar://problem/24290667> > > Modified: > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp > cfe/trunk/test/Modules/ExtDebugInfo.cpp > cfe/trunk/test/Modules/ModuleDebugInfo.cpp > > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff > > <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff> > ============================================================================== > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original) > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Jan 22 11:43:43 2016 > @@ -1740,11 +1740,14 @@ CGDebugInfo::getOrCreateModuleRef(Extern > > bool IsRootModule = M ? !M->Parent : true; > if (CreateSkeletonCU && IsRootModule) { > + // PCH files don't have a signature field in the control block, > + // but LLVM detects skeleton CUs by looking for a non-zero DWO id. > + uint64_t Signature = Mod.getSignature() ? Mod.getSignature() : ~1U; > llvm::DIBuilder DIB(CGM.getModule()); > DIB.createCompileUnit(TheCU->getSourceLanguage(), Mod.getModuleName(), > Mod.getPath(), TheCU->getProducer(), true, > StringRef(), 0, Mod.getASTFile(), > - llvm::DIBuilder::FullDebug, Mod.getSignature()); > + llvm::DIBuilder::FullDebug, Signature); > DIB.finalize(); > } > llvm::DIModule *Parent = > > Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=258507&r1=258506&r2=258507&view=diff > > <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=258507&r1=258506&r2=258507&view=diff> > ============================================================================== > --- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original) > +++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Fri Jan 22 > 11:43:43 2016 > @@ -219,7 +219,11 @@ public: > > M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple()); > M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString()); > - Builder->getModuleDebugInfo()->setDwoId(Buffer->Signature); > + > + // PCH files don't have a signature field in the control block, > + // but LLVM detects DWO CUs by looking for a non-zero DWO id. > + uint64_t Signature = Buffer->Signature ? Buffer->Signature : ~1U; > + Builder->getModuleDebugInfo()->setDwoId(Signature); > > // Finalize the Builder. > if (Builder) > > Modified: cfe/trunk/test/Modules/ExtDebugInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff > > <http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ExtDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff> > ============================================================================== > --- cfe/trunk/test/Modules/ExtDebugInfo.cpp (original) > +++ cfe/trunk/test/Modules/ExtDebugInfo.cpp Fri Jan 22 11:43:43 2016 > @@ -102,3 +102,7 @@ void foo() { > > > // CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: !0, > entity: !"_ZTSN8DebugCXX6StructE", line: 24) > + > +// CHECK: !DICompileUnit( > +// CHECK-SAME: splitDebugFilename: > +// CHECK-SAME: dwoId: > > Modified: cfe/trunk/test/Modules/ModuleDebugInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff > > <http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.cpp?rev=258507&r1=258506&r2=258507&view=diff> > ============================================================================== > --- cfe/trunk/test/Modules/ModuleDebugInfo.cpp (original) > +++ cfe/trunk/test/Modules/ModuleDebugInfo.cpp Fri Jan 22 11:43:43 2016 > @@ -8,7 +8,6 @@ > // 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 > // RUN: cat %t-mod.ll | FileCheck %s > // RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s > -// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-DWO %s > > // PCH: > // 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 > @@ -22,7 +21,7 @@ > // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus, > // CHECK-SAME: isOptimized: false, > // CHECK-SAME-NOT: splitDebugFilename: > -// CHECK-DWO: dwoId: > +// CHECK: dwoId: > > // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum" > // CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE") > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org <mailto:cfe-commits@lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits