[lld] a7a4115 - [ELF] Replace .zdebug string comparison with SHF_COMPRESSED check. NFC
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 22:33:37 PST 2022
Author: Fangrui Song
Date: 2022-01-19T22:33:32-08:00
New Revision: a7a4115bf3bcbf6f9f8d70909c316f0631b25efb
URL: https://github.com/llvm/llvm-project/commit/a7a4115bf3bcbf6f9f8d70909c316f0631b25efb
DIFF: https://github.com/llvm/llvm-project/commit/a7a4115bf3bcbf6f9f8d70909c316f0631b25efb.diff
LOG: [ELF] Replace .zdebug string comparison with SHF_COMPRESSED check. NFC
Added:
Modified:
lld/ELF/InputSection.cpp
Removed:
################################################################################
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp
index 62db24fe099e4..5b6242646605f 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 <typename ELFT> 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 <typename ELFT> void InputSectionBase::parseCompressedHeader() {
return;
}
- assert(flags & SHF_COMPRESSED);
flags &= ~(uint64_t)SHF_COMPRESSED;
// New-style header
More information about the llvm-commits
mailing list