forked from OSchip/llvm-project
Revert "Revert "Compact InputSectionData from 64 to 48 bytes. NFC.""
This reverts commit r281096. The previous link errors should be fixed by r281208. llvm-svn: 281209
This commit is contained in:
parent
74941239d8
commit
54f1614ec1
|
@ -50,8 +50,8 @@ template <class ELFT> size_t InputSectionBase<ELFT>::getSize() const {
|
|||
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));
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,10 @@ template <class ELFT> void InputSectionBase<ELFT>::uncompress() {
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,9 @@ public:
|
|||
|
||||
StringRef Name;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue