[PATCH] D16092: [Coverage] Do not allocate memory for coverage map data (Linux)

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 23:38:09 PST 2016


davidxl updated this revision to Diff 44605.
davidxl added a comment.

Discussed with bfd linker maintainer: making the section type SHT_NOTE, the GC won't happen for bfd linker either (which also works for gold).

A test case will be added in a separate patch (in compile_rt).


http://reviews.llvm.org/D16092

Files:
  lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp
===================================================================
--- lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ 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 @@
   // section(".eh_frame") gcc will produce:
   //
   //   .section   .eh_frame,"a", at 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 @@
 
 static unsigned getELFSectionType(StringRef Name, SectionKind K) {
 
+  if (Name == getInstrProfCoverageSectionName(false))
+    return ELF::SHT_NOTE;
+
   if (Name == ".init_array")
     return ELF::SHT_INIT_ARRAY;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16092.44605.patch
Type: text/x-patch
Size: 1052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160112/8b7adbd8/attachment.bin>


More information about the llvm-commits mailing list