19using namespace object;
22 bool IsLE,
bool Is64Bit) {
24 if (
Error Err =
D.consumeCompressedHeader(Is64Bit, IsLE))
25 return std::move(Err);
30 : SectionData(
Data), DecompressedSize(0) {}
32Error Decompressor::consumeCompressedHeader(
bool Is64Bit,
bool IsLittleEndian) {
34 uint64_t HdrSize = Is64Bit ?
sizeof(Elf64_Chdr) :
sizeof(Elf32_Chdr);
35 if (SectionData.
size() < HdrSize)
36 return createError(
"corrupted compressed section header");
40 auto ChType = Extractor.getUnsigned(&
Offset, Is64Bit ?
sizeof(Elf64_Word)
41 :
sizeof(Elf32_Word));
43 case ELFCOMPRESS_ZLIB:
46 case ELFCOMPRESS_ZSTD:
58 Offset +=
sizeof(Elf64_Word);
60 DecompressedSize = Extractor.getUnsigned(
61 &
Offset, Is64Bit ?
sizeof(Elf64_Xword) :
sizeof(Elf32_Word));
62 SectionData = SectionData.
substr(HdrSize);
68 arrayRefFromStringRef(SectionData),
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
size_t size() const
size - Get the array size.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
StringRef - Represent a constant reference to a string, i.e.
constexpr StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
constexpr size_t size() const
size - Get the string size.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Decompressor helps to handle decompression of compressed sections.
Error decompress(MutableArrayRef< uint8_t > Output)
Uncompress section data to raw buffer provided.
static Expected< Decompressor > create(StringRef Name, StringRef Data, bool IsLE, bool Is64Bit)
Create decompressor object.
const char * getReasonIfUnsupported(Format F)
Error decompress(DebugCompressionType T, ArrayRef< uint8_t > Input, uint8_t *Output, size_t UncompressedSize)
Format formatFor(DebugCompressionType Type)
Error createError(const Twine &Err)
This is an optimization pass for GlobalISel generic memory operations.