[llvm] [Coverage] Skip empty profile name section (PR #108480)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 12:30:12 PDT 2024
https://github.com/gulfemsavrun updated https://github.com/llvm/llvm-project/pull/108480
>From e4127fb6304c639933cd8ca36c805c1562d35e64 Mon Sep 17 00:00:00 2001
From: Gulfem Savrun Yeniceri <gulfem at google.com>
Date: Thu, 12 Sep 2024 19:06:54 -0700
Subject: [PATCH] [Coverage] Skip empty profile name section
llvm-cov reads __llvm_prf_names section in an object
file to find the profile names, and it instead reads
__llvm_covnames section in binary profile correlation
mode when __llvm_prf_names section is omitted. This
patch ensures that it still reads __llvm_covnames
section when there is an empty __llvm_prf_names section.
---
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index 445b48067a9755..bc4e780fb67a60 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -1061,9 +1061,11 @@ lookupSections(ObjectFile &OF, InstrProfSectKind IPSK) {
if (!NameOrErr)
return NameOrErr.takeError();
if (stripSuffix(*NameOrErr) == Name) {
+ // Skip empty profile name section.
// COFF profile name section contains two null bytes indicating the
// start/end of the section. If its size is 2 bytes, it's empty.
- if (IsCOFF && IPSK == IPSK_name && Section.getSize() == 2)
+ if (IPSK == IPSK_name &&
+ (Section.getSize() == 0 || (IsCOFF && Section.getSize() == 2)))
continue;
Sections.push_back(Section);
}
More information about the llvm-commits
mailing list