r205261 - DebugInfo compression: Enable compression before any sections are created.

David Blaikie dblaikie at gmail.com
Mon Mar 31 16:13:30 PDT 2014


Author: dblaikie
Date: Mon Mar 31 18:13:30 2014
New Revision: 205261

URL: http://llvm.org/viewvc/llvm-project?rev=205261&view=rev
Log:
DebugInfo compression: Enable compression before any sections are created.

For those playing at home this produced some fairly subtle behavior. The
sections created in InitMCObjectFileInfo were created without compressed
debug info (a mistake, but not necessarily /broken). Since these
sections were almost always referenced by the existing MCSection object,
this almost worked.

This got weird when we got to handling the relocations for a section.
See ELFObjectWriter::WriteSection where we compute the true section for
a relocation section by simply stripping the ".rela" prefix and then
looking up that section - doing so hit the compression codepath, looked
up .zdebug_blah and found a newly constructed empty section... thus,
things got weird.

This is untestable without a cross-project test (let me know if people
would prefer that to no testing).

Modified:
    cfe/trunk/tools/driver/cc1as_main.cpp

Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=205261&r1=205260&r2=205261&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Mon Mar 31 18:13:30 2014
@@ -304,6 +304,10 @@ static bool ExecuteAssembler(AssemblerIn
   // FIXME: This is not pretty. MCContext has a ptr to MCObjectFileInfo and
   // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
   std::unique_ptr<MCObjectFileInfo> MOFI(new MCObjectFileInfo());
+
+  if (Opts.CompressDebugSections)
+    MAI->setCompressDebugSections(true);
+
   MCContext Ctx(MAI.get(), MRI.get(), MOFI.get(), &SrcMgr);
   // FIXME: Assembler behavior can change with -static.
   MOFI->InitMCObjectFileInfo(Opts.Triple,
@@ -320,8 +324,6 @@ static bool ExecuteAssembler(AssemblerIn
     Ctx.setCompilationDir(Opts.DebugCompilationDir);
   if (!Opts.MainFileName.empty())
     Ctx.setMainFileName(StringRef(Opts.MainFileName));
-  if (Opts.CompressDebugSections)
-    MAI->setCompressDebugSections(true);
 
   // Build up the feature string from the target feature list.
   std::string FS;





More information about the cfe-commits mailing list