diff options
author | Zequan Wu <zequanwu@google.com> | 2024-01-09 16:58:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 16:58:28 -0500 |
commit | 4e8986fc58dd88cbef9089a9b2841e0a87cbb481 (patch) | |
tree | 3706ab9dc3f7812631c1222f717918b2567c6b51 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | ab590377a371d8099829f77ab4e67c24f8740bd9 (diff) | |
download | llvm-4e8986fc58dd88cbef9089a9b2841e0a87cbb481.zip llvm-4e8986fc58dd88cbef9089a9b2841e0a87cbb481.tar.gz llvm-4e8986fc58dd88cbef9089a9b2841e0a87cbb481.tar.bz2 |
[Coverage] Mark coverage sections as metadata sections on COFF. (#76834)
Mark `.lcovmap$M`, `.lcovfun$M`, `.lcovd` and `.lcovn` as metadata
sections on COFF so they are not loaded into memory.
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 6e69dc6..a69b714 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1669,9 +1669,18 @@ static int getSelectionForCOFF(const GlobalValue *GV) { MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal( const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { + StringRef Name = GO->getSection(); + if (Name == getInstrProfSectionName(IPSK_covmap, Triple::COFF, + /*AddSegmentInfo=*/false) || + Name == getInstrProfSectionName(IPSK_covfun, Triple::COFF, + /*AddSegmentInfo=*/false) || + Name == getInstrProfSectionName(IPSK_covdata, Triple::COFF, + /*AddSegmentInfo=*/false) || + Name == getInstrProfSectionName(IPSK_covname, Triple::COFF, + /*AddSegmentInfo=*/false)) + Kind = SectionKind::getMetadata(); int Selection = 0; unsigned Characteristics = getCOFFSectionFlags(Kind, TM); - StringRef Name = GO->getSection(); StringRef COMDATSymName = ""; if (GO->hasComdat()) { Selection = getSelectionForCOFF(GO); |