Remove a member from InputSectionData and use the pool instead.
authorRui Ueyama <ruiu@google.com>
Fri, 11 Nov 2016 03:54:59 +0000 (03:54 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 11 Nov 2016 03:54:59 +0000 (03:54 +0000)
llvm-svn: 286557

lld/ELF/InputSection.cpp
lld/ELF/InputSection.h

index 83fb3aa601b76afa95d557e991afc8c2383ddd51..9823f4adfd108975c79f5f125ff82b3f8db2740d 100644 (file)
@@ -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 InputSectionBase<ELFT>::uncompress() {
     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>
index d39ee4c6189f9520c2ec36a9f4363302f5e91947..0d16bd50d68803f169925ead790f1ca1a75b661c 100644 (file)
@@ -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;
 };