diff options
| author | George Rimar <grimar@accesssoftek.com> | 2019-03-05 13:07:43 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2019-03-05 13:07:43 +0000 |
| commit | ade3c70537e105029ba600fcb56099c434a9ba0c (patch) | |
| tree | 0cda96fc301b3bbeaa819bdcbd0ac7286e8f9b6c /llvm/tools | |
| parent | a55999301e2169905ff2359fa17584df05378a01 (diff) | |
| download | bcm5719-llvm-ade3c70537e105029ba600fcb56099c434a9ba0c.tar.gz bcm5719-llvm-ade3c70537e105029ba600fcb56099c434a9ba0c.zip | |
[llvm-objcopy] - Simplify `isCompressable` and fix the issue relative.
When --compress-debug-sections is given, llvm-objcopy do not compress
sections that have "ZLIB" header in data. Normally this signature is used
in zlib-gnu compression format. But if zlib-gnu used then the name of the compressed
section should start from .z* (e.g .zdebug_info). If it does not, then it is not
a zlib-gnu format and section should be treated as a normal uncompressed section.
Differential revision: https://reviews.llvm.org/D58908
llvm-svn: 355399
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp index 1132aa18589..6f21db9db60 100644 --- a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp +++ b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp @@ -223,18 +223,9 @@ static Error dumpSectionToFile(StringRef SecName, StringRef Filename, return createStringError(object_error::parse_failed, "Section not found"); } -static bool isCompressed(const SectionBase &Section) { - const char *Magic = "ZLIB"; - return StringRef(Section.Name).startswith(".zdebug") || - (Section.OriginalData.size() > strlen(Magic) && - !strncmp(reinterpret_cast<const char *>(Section.OriginalData.data()), - Magic, strlen(Magic))) || - (Section.Flags & ELF::SHF_COMPRESSED); -} - static bool isCompressable(const SectionBase &Section) { - return !isCompressed(Section) && isDebugSection(Section) && - Section.Name != ".gdb_index"; + return !(Section.Flags & ELF::SHF_COMPRESSED) && + StringRef(Section.Name).startswith(".debug"); } static void replaceDebugSections( |

