| Index: lib/Transforms/MinSFI/Utils.cpp
|
| diff --git a/lib/Transforms/MinSFI/Utils.cpp b/lib/Transforms/MinSFI/Utils.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a1f02e2c05ff3c1e0d7d91a180bb903d8659241d
|
| --- /dev/null
|
| +++ b/lib/Transforms/MinSFI/Utils.cpp
|
| @@ -0,0 +1,28 @@
|
| +//===-- Utils.cpp - Helper functions for MinSFI passes --------------------===//
|
| +//
|
| +// The LLVM Compiler Infrastructure
|
| +//
|
| +// This file is distributed under the University of Illinois Open Source
|
| +// License. See LICENSE.TXT for details.
|
| +//
|
| +//===----------------------------------------------------------------------===//
|
| +
|
| +#include "llvm/Support/CommandLine.h"
|
| +#include "llvm/Transforms/MinSFI.h"
|
| +
|
| +using namespace llvm;
|
| +
|
| +static cl::opt<uint32_t>
|
| +PointerSizeInBits("minsfi-ptrsize", cl::init(32),
|
| + cl::desc("Size of the address subspace in bits"));
|
| +
|
| +uint32_t minsfi::GetPointerSizeInBits() {
|
| + if (PointerSizeInBits < 20 || PointerSizeInBits > 32)
|
| + report_fatal_error("MinSFI: Size of the sandboxed pointers is out of "
|
| + "bounds (20-32)");
|
| + return PointerSizeInBits;
|
| +}
|
| +
|
| +uint64_t minsfi::GetAddressSubspaceSize() {
|
| + return 1LL << GetPointerSizeInBits();
|
| +}
|
|
|