diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2018-09-04 11:55:57 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2018-09-04 11:55:57 +0000 |
commit | 163222f56970b19947a99cd9c4d36fa0791200a2 (patch) | |
tree | 95982a0fc5d8a04a857a9298e9a9412403997fe5 /llvm/tools/llvm-objcopy/Object.cpp | |
parent | 219888d1b2ade782a8aedb9dea7f1421c852b80c (diff) | |
download | bcm5719-llvm-163222f56970b19947a99cd9c4d36fa0791200a2.tar.gz bcm5719-llvm-163222f56970b19947a99cd9c4d36fa0791200a2.zip |
Revert r341342: Dwarf .debug section compression support (zlib, zlib-gnu).
Also reverts follow-up commits r341343 and r341344.
The primary commit continues to break some build bots even after the
fixes in r341343 for UBSan issues:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/5823
It is also failing for me locally (linux, x86-64).
llvm-svn: 341360
Diffstat (limited to 'llvm/tools/llvm-objcopy/Object.cpp')
-rw-r--r-- | llvm/tools/llvm-objcopy/Object.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/llvm/tools/llvm-objcopy/Object.cpp b/llvm/tools/llvm-objcopy/Object.cpp index 3893c0e2c53..12fd80228bf 100644 --- a/llvm/tools/llvm-objcopy/Object.cpp +++ b/llvm/tools/llvm-objcopy/Object.cpp @@ -15,9 +15,7 @@ #include "llvm/ADT/Twine.h" #include "llvm/ADT/iterator_range.h" #include "llvm/BinaryFormat/ELF.h" -#include "llvm/MC/MCTargetOptions.h" #include "llvm/Object/ELFObjectFile.h" -#include "llvm/Support/Compression.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileOutputBuffer.h" #include "llvm/Support/Path.h" @@ -140,65 +138,6 @@ void OwnedDataSection::accept(SectionVisitor &Visitor) const { Visitor.visit(*this); } -void BinarySectionWriter::visit(const CompressedSection &Sec) { - error("Cannot write compressed section '" + Sec.Name + "' "); -} - -template <class ELFT> -void ELFSectionWriter<ELFT>::visit(const CompressedSection &Sec) { - uint8_t *Buf = Out.getBufferStart(); - Buf += Sec.Offset; - - if (Sec.CompressionType == DebugCompressionType::GNU) { - ArrayRef<uint8_t> Magic = {'Z', 'L', 'I', 'B'}; - std::copy(Magic.begin(), Magic.end(), Buf); - Buf += Magic.size(); - const uint64_t DecompressedSize = - support::endian::read64be(&Sec.DecompressedSize); - memcpy(Buf, &DecompressedSize, sizeof(DecompressedSize)); - Buf += sizeof(DecompressedSize); - } else { - auto Chdr = reinterpret_cast<Elf_Chdr_Impl<ELFT> *>(Buf); - Chdr->ch_type = ELF::ELFCOMPRESS_ZLIB; - Chdr->ch_size = Sec.DecompressedSize; - Chdr->ch_addralign = Sec.DecompressedAlign; - Buf += sizeof(*Chdr); - } - - std::copy(Sec.CompressedData.begin(), Sec.CompressedData.end(), Buf); -} - -CompressedSection::CompressedSection(const SectionBase &Sec, - DebugCompressionType CompressionType) - : SectionBase(Sec), CompressionType(CompressionType), - DecompressedSize(Sec.OriginalData.size()), DecompressedAlign(Sec.Align) { - - if (Error E = zlib::compress( - StringRef(reinterpret_cast<const char *>(OriginalData.data()), - OriginalData.size()), - CompressedData)) - reportError(Name, std::move(E)); - - size_t ChdrSize; - if (CompressionType == DebugCompressionType::GNU) { - Name = ".z" + Sec.Name.substr(1); - ChdrSize = sizeof("ZLIB") - 1 + sizeof(uint64_t); - } else { - Flags |= ELF::SHF_COMPRESSED; - ChdrSize = - std::max(std::max(sizeof(object::Elf_Chdr_Impl<object::ELF64LE>), - sizeof(object::Elf_Chdr_Impl<object::ELF64BE>)), - std::max(sizeof(object::Elf_Chdr_Impl<object::ELF32LE>), - sizeof(object::Elf_Chdr_Impl<object::ELF32BE>))); - } - Size = ChdrSize + CompressedData.size(); - Align = 8; -} - -void CompressedSection::accept(SectionVisitor &Visitor) const { - Visitor.visit(*this); -} - void StringTableSection::addString(StringRef Name) { StrTabBuilder.add(Name); Size = StrTabBuilder.getSize(); |