summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-01-14 18:09:45 +0000
committerXinliang David Li <davidxl@google.com>2016-01-14 18:09:45 +0000
commit5f04f926e9ba769606034a685fe5df3af9dd6bb7 (patch)
treed7c6603366be0a751e96f0e06d9181badb753b41 /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
parent1d9970a5a99937fabee9efb8b057c42d58a3335b (diff)
downloadbcm5719-llvm-5f04f926e9ba769606034a685fe5df3af9dd6bb7.tar.gz
bcm5719-llvm-5f04f926e9ba769606034a685fe5df3af9dd6bb7.zip
[PGO] [Coverage] put covmap into note section with no 'alloc flag' (Linux)
Coverage mapping data is not referenced by runtime, and they won't be dumped into profile data. There is no need to allocate memory for covmap sections. A good side effect of this change is that the coverage map data won't be mistakenly garbage collected by the linker (for Gold linker only, BFD linker has an issue where the a bug is filed). Tested with clang build with instrumentation and -fcoverage-mapping and linker GC. The size of covmap section is ~17.6M so the text segment size will be reduced by this amount with this change. llvm-svn: 257781
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r--llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index 58ae9cc53bd..3c9026e3283 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -33,6 +33,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCValue.h"
+#include "llvm/ProfileData/InstrProf.h"
#include "llvm/Support/COFF.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ELF.h"
@@ -119,6 +120,10 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) {
// section(".eh_frame") gcc will produce:
//
// .section .eh_frame,"a",@progbits
+
+ if (Name == getInstrProfCoverageSectionName(false))
+ return SectionKind::getMetadata();
+
if (Name.empty() || Name[0] != '.') return K;
// Some lame default implementation based on some magic section names.
@@ -150,6 +155,9 @@ getELFKindForNamedSection(StringRef Name, SectionKind K) {
static unsigned getELFSectionType(StringRef Name, SectionKind K) {
+ if (Name == getInstrProfCoverageSectionName(false))
+ return ELF::SHT_NOTE;
+
if (Name == ".init_array")
return ELF::SHT_INIT_ARRAY;
OpenPOWER on IntegriCloud