[lld] r286557 - Remove a member from InputSectionData and use the pool instead.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 19:54:59 PST 2016


Author: ruiu
Date: Thu Nov 10 21:54:59 2016
New Revision: 286557

URL: http://llvm.org/viewvc/llvm-project?rev=286557&view=rev
Log:
Remove a member from InputSectionData and use the pool instead.

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

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=286557&r1=286556&r2=286557&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Nov 10 21:54:59 2016
@@ -13,6 +13,7 @@
 #include "Error.h"
 #include "InputFiles.h"
 #include "LinkerScript.h"
+#include "Memory.h"
 #include "OutputSections.h"
 #include "SyntheticSections.h"
 #include "Target.h"
@@ -167,11 +168,10 @@ template <class ELFT> void InputSectionB
     std::tie(Buf, Size) = getRawCompressedData(Data);
 
   // Uncompress Buf.
-  UncompressedData.reset(new uint8_t[Size]);
-  if (zlib::uncompress(toStringRef(Buf), (char *)UncompressedData.get(),
-                       Size) != zlib::StatusOK)
+  char *OutputBuf = BAlloc.Allocate<char>(Size);
+  if (zlib::uncompress(toStringRef(Buf), OutputBuf, Size) != zlib::StatusOK)
     fatal(getName(this) + ": error while uncompressing section");
-  Data = ArrayRef<uint8_t>(UncompressedData.get(), Size);
+  Data = ArrayRef<uint8_t>((uint8_t *)OutputBuf, Size);
 }
 
 template <class ELFT>

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=286557&r1=286556&r2=286557&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Nov 10 21:54:59 2016
@@ -66,9 +66,6 @@ public:
     return llvm::makeArrayRef<T>((const T *)Data.data(), S / sizeof(T));
   }
 
-  // If a section is compressed, this has the uncompressed section data.
-  std::unique_ptr<uint8_t[]> UncompressedData;
-
   std::vector<Relocation> Relocations;
 };
 




More information about the llvm-commits mailing list