diff options
-rw-r--r-- | include/llvm/MC/MCNaCl.h | 11 | ||||
-rw-r--r-- | lib/MC/MCNaCl.cpp | 18 | ||||
-rw-r--r-- | lib/Target/ARM/ARMNaClRewritePass.cpp | 20 | ||||
-rw-r--r-- | lib/Target/ARM/ARMNaClRewritePass.h | 11 | ||||
-rw-r--r-- | lib/Target/Mips/MipsNaClHeaders.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mips/MipsNaClRewritePass.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mips/MipsNaClRewritePass.h | 21 |
7 files changed, 32 insertions, 53 deletions
diff --git a/include/llvm/MC/MCNaCl.h b/include/llvm/MC/MCNaCl.h index cf9b23ec1c..654131bc04 100644 --- a/include/llvm/MC/MCNaCl.h +++ b/include/llvm/MC/MCNaCl.h @@ -7,7 +7,17 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Support/CommandLine.h" + namespace llvm { + +extern cl::opt<bool> FlagSfiZeroMask; +extern cl::opt<bool> FlagSfiData; +extern cl::opt<bool> FlagSfiLoad; +extern cl::opt<bool> FlagSfiStore; +extern cl::opt<bool> FlagSfiStack; +extern cl::opt<bool> FlagSfiBranch; + class MCContext; class MCStreamer; class Triple; @@ -15,4 +25,5 @@ class Triple; /// ELF note sections. void initializeNaClMCStreamer(MCStreamer &Streamer, MCContext &Ctx, const Triple &TheTriple); + } diff --git a/lib/MC/MCNaCl.cpp b/lib/MC/MCNaCl.cpp index 4a6363d6c0..4385910cf3 100644 --- a/lib/MC/MCNaCl.cpp +++ b/lib/MC/MCNaCl.cpp @@ -12,11 +12,28 @@ #include "llvm/MC/MCContext.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCStreamer.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/ELF.h" static const char NoteNamespace[] = "NaCl"; namespace llvm { + +cl::opt<bool> +FlagSfiData("sfi-data", cl::desc("use illegal at data bundle beginning")); + +cl::opt<bool> +FlagSfiLoad("sfi-load", cl::desc("enable sandboxing for load")); + +cl::opt<bool> +FlagSfiStore("sfi-store", cl::desc("enable sandboxing for stores")); + +cl::opt<bool> +FlagSfiStack("sfi-stack", cl::desc("enable sandboxing for stack changes")); + +cl::opt<bool> +FlagSfiBranch("sfi-branch", cl::desc("enable sandboxing for branches")); + void initializeNaClMCStreamer(MCStreamer &Streamer, MCContext &Ctx, const Triple &TheTriple) { assert(TheTriple.isOSNaCl()); @@ -71,4 +88,5 @@ void initializeNaClMCStreamer(MCStreamer &Streamer, MCContext &Ctx, Streamer.EmitIntValue(0, 1); // NUL terminator Streamer.EmitValueToAlignment(4); } + } // namespace llvm diff --git a/lib/Target/ARM/ARMNaClRewritePass.cpp b/lib/Target/ARM/ARMNaClRewritePass.cpp index 2644357320..26e54d8f77 100644 --- a/lib/Target/ARM/ARMNaClRewritePass.cpp +++ b/lib/Target/ARM/ARMNaClRewritePass.cpp @@ -30,31 +30,11 @@ #include "llvm/IR/Function.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Support/CommandLine.h" #include <set> #include <stdio.h> using namespace llvm; -namespace llvm { - -cl::opt<bool> -FlagSfiData("sfi-data", cl::desc("use illegal at data bundle beginning")); - -cl::opt<bool> -FlagSfiLoad("sfi-load", cl::desc("enable sandboxing for load")); - -cl::opt<bool> -FlagSfiStore("sfi-store", cl::desc("enable sandboxing for stores")); - -cl::opt<bool> -FlagSfiStack("sfi-stack", cl::desc("enable sandboxing for stack changes")); - -cl::opt<bool> -FlagSfiBranch("sfi-branch", cl::desc("enable sandboxing for branches")); - -} - namespace { class ARMNaClRewritePass : public MachineFunctionPass { public: diff --git a/lib/Target/ARM/ARMNaClRewritePass.h b/lib/Target/ARM/ARMNaClRewritePass.h index c8854a54fc..20e48308ac 100644 --- a/lib/Target/ARM/ARMNaClRewritePass.h +++ b/lib/Target/ARM/ARMNaClRewritePass.h @@ -10,18 +10,9 @@ #ifndef TARGET_ARMNACLREWRITEPASS_H #define TARGET_ARMNACLREWRITEPASS_H +#include "llvm/MC/MCNaCl.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/Support/CommandLine.h" - -namespace llvm { - extern cl::opt<bool> FlagSfiZeroMask; - extern cl::opt<bool> FlagSfiData; - extern cl::opt<bool> FlagSfiLoad; - extern cl::opt<bool> FlagSfiStore; - extern cl::opt<bool> FlagSfiStack; - extern cl::opt<bool> FlagSfiBranch; -} namespace ARM_SFI { diff --git a/lib/Target/Mips/MipsNaClHeaders.cpp b/lib/Target/Mips/MipsNaClHeaders.cpp index 375c287d67..ac4ffc2803 100644 --- a/lib/Target/Mips/MipsNaClHeaders.cpp +++ b/lib/Target/Mips/MipsNaClHeaders.cpp @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// +#include "llvm/MC/MCNaCl.h" #include "llvm/Support/raw_ostream.h" -#include "MipsNaClRewritePass.h" #include <string> using namespace llvm; diff --git a/lib/Target/Mips/MipsNaClRewritePass.cpp b/lib/Target/Mips/MipsNaClRewritePass.cpp index 6ab95109e9..c6b94041df 100644 --- a/lib/Target/Mips/MipsNaClRewritePass.cpp +++ b/lib/Target/Mips/MipsNaClRewritePass.cpp @@ -24,10 +24,10 @@ #define DEBUG_TYPE "mips-sfi" #include "Mips.h" #include "MipsInstrInfo.h" -#include "MipsNaClRewritePass.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" +#include "llvm/MC/MCNaCl.h" #include "llvm/IR/Function.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" diff --git a/lib/Target/Mips/MipsNaClRewritePass.h b/lib/Target/Mips/MipsNaClRewritePass.h deleted file mode 100644 index 4e729ec985..0000000000 --- a/lib/Target/Mips/MipsNaClRewritePass.h +++ /dev/null @@ -1,21 +0,0 @@ -//===-- MipsNaClRewritePass.h - NaCl Sandboxing Pass ---------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -//===----------------------------------------------------------------------===// - -#ifndef TARGET_MIPSNACLREWRITEPASS_H -#define TARGET_MIPSNACLREWRITEPASS_H - -#include "llvm/Target/TargetRegisterInfo.h" -#include "llvm/CodeGen/MachineInstr.h" -#include "llvm/Support/CommandLine.h" - -namespace llvm { - extern cl::opt<bool> FlagSfiLoad; - extern cl::opt<bool> FlagSfiStore; - extern cl::opt<bool> FlagSfiStack; - extern cl::opt<bool> FlagSfiBranch; -} - -#endif |