1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/lib/CodeGen/AsmPrinter/WinCFGuard.h
Adrian McCarthy de2d0196a2 Reland "Emit Function IDs table for Control Flow Guard"
Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs
of functions that have their address taken into a section named .gfids$y for
compatibility with Microsoft's Control Flow Guard feature.

The original patch didn't have the lit.local.cfg file that restricts the new
test to x86, thus the new test was failing on the non-x86 bots.

Differential Revision: https://reviews.llvm.org/D40531

The reverts r322008, which was a revert of r322005.

This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba.

llvm-svn: 322136
2018-01-09 23:49:30 +00:00

55 lines
1.6 KiB
C++

//===-- WinCFGuard.h - Windows Control Flow Guard Handling ----*- C++ -*--===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains support for writing windows exception info into asm files.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_WINCFGUARD_H
#include "AsmPrinterHandler.h"
#include "llvm/Support/Compiler.h"
namespace llvm {
class LLVM_LIBRARY_VISIBILITY WinCFGuard : public AsmPrinterHandler {
/// Target of directive emission.
AsmPrinter *Asm;
public:
WinCFGuard(AsmPrinter *A);
~WinCFGuard() override;
void setSymbolSize(const MCSymbol *Sym, uint64_t Size) override {}
/// \brief Emit the Control Flow Guard function ID table
void endModule() override;
/// \brief Gather pre-function debug information.
/// Every beginFunction(MF) call should be followed by an endFunction(MF)
/// call.
void beginFunction(const MachineFunction *MF) override {}
/// \brief Gather post-function debug information.
/// Please note that some AsmPrinter implementations may not call
/// beginFunction at all.
void endFunction(const MachineFunction *MF) override {}
/// \brief Process beginning of an instruction.
void beginInstruction(const MachineInstr *MI) override {}
/// \brief Process end of an instruction.
void endInstruction() override {}
};
} // namespace llvm
#endif