Enable StackMap Serialization for COFF
authorSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Thu, 25 Jun 2015 00:28:42 +0000 (00:28 +0000)
committerSwaroop Sridhar <Swaroop.Sridhar@microsoft.com>
Thu, 25 Jun 2015 00:28:42 +0000 (00:28 +0000)
Summary

This change turns on the emission of
__LLVM_Stackmaps section when generating COFF binaries.

Test Plan

Added a scenario to the test case:
test\CodeGen\X86\statepoint-stackmap-format.ll.

Code Review:

http://reviews.llvm.org/D10680

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240613 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCObjectFileInfo.cpp
lib/Target/X86/X86AsmPrinter.cpp
test/CodeGen/X86/statepoint-stackmap-format.ll

index aa3d965bbce14681df1a3ebd76ee8e9943fa7880..576827a72d56f372d0cc096697addcd8c5c20e3b 100644 (file)
@@ -733,6 +733,11 @@ void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) {
       ".tls$", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ |
                    COFF::IMAGE_SCN_MEM_WRITE,
       SectionKind::getDataRel());
+         
+  StackMapSection = Ctx->getCOFFSection(".llvm_stackmaps",
+                                        COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
+                                            COFF::IMAGE_SCN_MEM_READ,
+                                        SectionKind::getReadOnly());   
 }
 
 void MCObjectFileInfo::InitMCObjectFileInfo(const Triple &TheTriple,
index 205140144ab5ac478508b12fd9d078214a52223e..0557582b50df6a98c0bfeabd5e03121d6726307a 100644 (file)
@@ -725,6 +725,8 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
       for (auto & Symbol : DLLExportedFns)
         GenerateExportDirective(Symbol, /*IsData=*/false);
     }
+
+    SM.serializeToStackMapSection();
   }
 
   if (TT.isOSBinFormatELF()) {
index 6bb0d8980e5bd31408182d42f9d60554d757d44d..e18476cee53c50c756c0d5ac6bad68fc1a6d93b7 100644 (file)
@@ -1,10 +1,11 @@
-; RUN: llc < %s | FileCheck %s
+; RUN: llc < %s -mtriple="x86_64-pc-linux-gnu" | FileCheck %s
+; RUN: llc < %s -mtriple="x86_64-pc-win64-coff" | FileCheck %s
+
 ; This test is a sanity check to ensure statepoints are generating StackMap
 ; sections correctly.  This is not intended to be a rigorous test of the 
 ; StackMap format (see the stackmap tests for that).
 
 target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-linux-gnu"
 
 declare zeroext i1 @return_i1()