From e9247ab6d6227f72af93bd021227efda49185b42 Mon Sep 17 00:00:00 2001 From: Swaroop Sridhar Date: Thu, 25 Jun 2015 00:28:42 +0000 Subject: [PATCH] Enable StackMap Serialization for COFF 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 llvm-svn: 240613 --- llvm/lib/MC/MCObjectFileInfo.cpp | 5 +++++ llvm/lib/Target/X86/X86AsmPrinter.cpp | 2 ++ llvm/test/CodeGen/X86/statepoint-stackmap-format.ll | 5 +++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index aa3d965..576827a 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -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, diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp index 2051401..0557582 100644 --- a/llvm/lib/Target/X86/X86AsmPrinter.cpp +++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp @@ -725,6 +725,8 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) { for (auto & Symbol : DLLExportedFns) GenerateExportDirective(Symbol, /*IsData=*/false); } + + SM.serializeToStackMapSection(); } if (TT.isOSBinFormatELF()) { diff --git a/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll b/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll index 6bb0d89..e18476c 100644 --- a/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll +++ b/llvm/test/CodeGen/X86/statepoint-stackmap-format.ll @@ -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() -- 2.7.4