[lld] r342298 - Revert r342297: Discard uncompressed buffer after creating .gdb_index contents.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 16:28:13 PDT 2018


Author: ruiu
Date: Fri Sep 14 16:28:13 2018
New Revision: 342298

URL: http://llvm.org/viewvc/llvm-project?rev=342298&view=rev
Log:
Revert r342297: Discard uncompressed buffer after creating .gdb_index contents.

Looks like it broke some local builds that use -gdb-index.

Modified:
    lld/trunk/ELF/InputSection.h
    lld/trunk/ELF/SyntheticSections.cpp

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=342298&r1=342297&r2=342298&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Fri Sep 14 16:28:13 2018
@@ -205,6 +205,7 @@ public:
     return llvm::makeArrayRef<T>((const T *)Data.data(), S / sizeof(T));
   }
 
+private:
   // A pointer that owns decompressed data if a section is compressed by zlib.
   // Since the feature is not used often, this is usually a nullptr.
   std::unique_ptr<char[]> DecompressBuf;

Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=342298&r1=342297&r2=342298&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Fri Sep 14 16:28:13 2018
@@ -2495,6 +2495,13 @@ createSymbols(ArrayRef<std::vector<GdbIn
 template <class ELFT> GdbIndexSection *GdbIndexSection::create() {
   std::vector<InputSection *> Sections = getDebugInfoSections();
 
+  // .debug_gnu_pub{names,types} are useless in executables.
+  // They are present in input object files solely for creating
+  // a .gdb_index. So we can remove them from the output.
+  for (InputSectionBase *S : InputSections)
+    if (S->Name == ".debug_gnu_pubnames" || S->Name == ".debug_gnu_pubtypes")
+      S->Live = false;
+
   std::vector<GdbChunk> Chunks(Sections.size());
   std::vector<std::vector<NameTypeEntry>> NameTypes(Sections.size());
 
@@ -2508,16 +2515,6 @@ template <class ELFT> GdbIndexSection *G
     NameTypes[I] = readPubNamesAndTypes(Dwarf, I);
   });
 
-  // .debug_gnu_pub{names,types} are useless in executables.
-  // They are present in input object files solely for creating
-  // a .gdb_index. So we can remove them from the output.
-  for (InputSectionBase *S : InputSections) {
-    if (S->Name != ".debug_gnu_pubnames" && S->Name != ".debug_gnu_pubtypes")
-      continue;
-    S->Live = false;
-    S->DecompressBuf.reset();
-  }
-
   auto *Ret = make<GdbIndexSection>();
   Ret->Chunks = std::move(Chunks);
   Ret->Symbols = createSymbols(NameTypes);




More information about the llvm-commits mailing list