[llvm] r355501 - [llvm-objcopy] - Fix incorrect CompressedSection creation.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 06:01:54 PST 2019
Author: grimar
Date: Wed Mar 6 06:01:54 2019
New Revision: 355501
URL: http://llvm.org/viewvc/llvm-project?rev=355501&view=rev
Log:
[llvm-objcopy] - Fix incorrect CompressedSection creation.
We should create CompressedSection only if the section has SHF_COMPRESSED flag
or it's name starts from '.zdebug'.
Currently, we create it if section's data starts from ZLIB signature.
Differential revision: https://reviews.llvm.org/D59018
Modified:
llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
Modified: llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp?rev=355501&r1=355500&r2=355501&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp Wed Mar 6 06:01:54 2019
@@ -1111,7 +1111,8 @@ SectionBase &ELFBuilder<ELFT>::makeSecti
default: {
Data = unwrapOrError(ElfFile.getSectionContents(&Shdr));
- if (isDataGnuCompressed(Data) || (Shdr.sh_flags & ELF::SHF_COMPRESSED)) {
+ StringRef Name = unwrapOrError(ElfFile.getSectionName(&Shdr));
+ if (Name.startswith(".zdebug") || (Shdr.sh_flags & ELF::SHF_COMPRESSED)) {
uint64_t DecompressedSize, DecompressedAlign;
std::tie(DecompressedSize, DecompressedAlign) =
getDecompressedSizeAndAlignment<ELFT>(Data);
More information about the llvm-commits
mailing list