[PATCH] D24342: Compact InputSectionData from 64 to 48 bytes
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 8 06:12:42 PDT 2016
rafael created this revision.
rafael added a reviewer: ruiu.
rafael added a subscriber: llvm-commits.
https://reviews.llvm.org/D24342
Files:
ELF/InputSection.cpp
ELF/InputSection.h
Index: ELF/InputSection.h
===================================================================
--- ELF/InputSection.h
+++ ELF/InputSection.h
@@ -58,8 +58,9 @@
uint32_t Alignment;
- // If a section is compressed, this vector has uncompressed section data.
- SmallVector<char, 0> Uncompressed;
+ // If a section is compressed, this has the uncompressed section data.
+ std::unique_ptr<char> UncompressedData;
+ size_t UncompressedDataSize = 0;
std::vector<Relocation> Relocations;
};
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -53,8 +53,8 @@
template <class ELFT>
ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const {
if (Compressed)
- return ArrayRef<uint8_t>((const uint8_t *)Uncompressed.data(),
- Uncompressed.size());
+ return ArrayRef<uint8_t>((const uint8_t *)UncompressedData.get(),
+ UncompressedDataSize);
return check(this->File->getObj().getSectionContents(this->Header));
}
@@ -109,7 +109,10 @@
fatal(getName(this) + ": unsupported compression type");
StringRef Buf((const char *)Data.data(), Data.size());
- if (zlib::uncompress(Buf, Uncompressed, Hdr->ch_size) != zlib::StatusOK)
+ UncompressedDataSize = Hdr->ch_size;
+ UncompressedData.reset(new char[UncompressedDataSize]);
+ if (zlib::uncompress(Buf, UncompressedData.get(), UncompressedDataSize) !=
+ zlib::StatusOK)
fatal(getName(this) + ": error uncompressing section");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24342.70691.patch
Type: text/x-patch
Size: 1579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160908/e1762e4a/attachment.bin>
More information about the llvm-commits
mailing list