From a7a4115bf3bcbf6f9f8d70909c316f0631b25efb Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Wed, 19 Jan 2022 22:33:32 -0800 Subject: [PATCH] [ELF] Replace .zdebug string comparison with SHF_COMPRESSED check. NFC --- lld/ELF/InputSection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 62db24f..5b62426 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -219,7 +219,8 @@ OutputSection *SectionBase::getOutputSection() { // `uncompressedSize` member and remove the header from `rawData`. template void InputSectionBase::parseCompressedHeader() { // Old-style header - if (name.startswith(".zdebug")) { + if (!(flags & SHF_COMPRESSED)) { + assert(name.startswith(".zdebug")); if (!toStringRef(rawData).startswith("ZLIB")) { error(toString(this) + ": corrupted compressed section header"); return; @@ -240,7 +241,6 @@ template void InputSectionBase::parseCompressedHeader() { return; } - assert(flags & SHF_COMPRESSED); flags &= ~(uint64_t)SHF_COMPRESSED; // New-style header -- 2.7.4