diff options
| author | Mitch Phillips <mitchphillips@outlook.com> | 2017-11-10 21:00:22 +0000 | 
|---|---|---|
| committer | Mitch Phillips <mitchphillips@outlook.com> | 2017-11-10 21:00:22 +0000 | 
| commit | 3b9ea32ef83247090205891af305d98a3aa5c975 (patch) | |
| tree | db95d9de57ea5c37668ac3abb87d181a56b10b7c /llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp | |
| parent | 3f0f650f498d97516745678b304a1649c3b2450f (diff) | |
| download | bcm5719-llvm-3b9ea32ef83247090205891af305d98a3aa5c975.tar.gz bcm5719-llvm-3b9ea32ef83247090205891af305d98a3aa5c975.zip | |
[cfi-verify] Made FileAnalysis operate on a GraphResult rather than build one and validate it.
Refactors the behaviour of building graphs out of FileAnalysis, allowing for analysis of the GraphResult by the callee without having to rebuild the graph. Means when we want to analyse the constructed graph (planned for later revisions), we don't do repeated work.
Also makes CFI verification in FileAnalysis now return an enum that allows us to differentiate why something failed, not just that it did/didn't fail.
Reviewers: vlad.tsyrklevich
Subscribers: kcc, pcc, llvm-commits
Differential Revision: https://reviews.llvm.org/D39764
llvm-svn: 317927
Diffstat (limited to 'llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp')
| -rw-r--r-- | llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp index 01f03158d6b..8ae905e2636 100644 --- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp +++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp @@ -18,6 +18,7 @@  //===----------------------------------------------------------------------===//  #include "lib/FileAnalysis.h" +#include "lib/GraphBuilder.h"  #include "llvm/BinaryFormat/ELF.h"  #include "llvm/Support/CommandLine.h" @@ -46,13 +47,15 @@ void printIndirectCFInstructions(FileAnalysis &Analysis,    uint64_t ExpectedUnprotected = 0;    uint64_t UnexpectedUnprotected = 0; -  symbolize::LLVMSymbolizer &Symbolizer = Analysis.getSymbolizer();    std::map<unsigned, uint64_t> BlameCounter;    for (uint64_t Address : Analysis.getIndirectInstructions()) {      const auto &InstrMeta = Analysis.getInstructionOrDie(Address); +    GraphResult Graph = GraphBuilder::buildFlowGraph(Analysis, Address); -    bool CFIProtected = Analysis.isIndirectInstructionCFIProtected(Address); +    CFIProtectionStatus ProtectionStatus = +        Analysis.validateCFIProtection(Graph); +    bool CFIProtected = (ProtectionStatus == CFIProtectionStatus::PROTECTED);      if (CFIProtected)        outs() << "P "; @@ -72,7 +75,7 @@ void printIndirectCFInstructions(FileAnalysis &Analysis,        continue;      } -    auto InliningInfo = Symbolizer.symbolizeInlinedCode(InputFilename, Address); +    auto InliningInfo = Analysis.symbolizeInlinedCode(Address);      if (!InliningInfo || InliningInfo->getNumberOfFrames() == 0) {        errs() << "Failed to symbolise " << format_hex(Address, 2)               << " with line tables from " << InputFilename << "\n"; | 

