summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/main.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-08-04 15:08:30 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-08-04 15:08:30 +0800
commite14473dcce910959a3f6a3c0c683456ab0f9dd1a (patch)
tree9463451f3f755bee4bcd2e652c3b04a8daa88dc5 /tools/standalone_miri/main.cpp
parent982826e4b309979bee8fe10f6ff537b4922e6316 (diff)
downloadmrust-e14473dcce910959a3f6a3c0c683456ab0f9dd1a.tar.gz
Standalone MIRI - Restructure so `0` is never a valid pointer value
Diffstat (limited to 'tools/standalone_miri/main.cpp')
-rw-r--r--tools/standalone_miri/main.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/standalone_miri/main.cpp b/tools/standalone_miri/main.cpp
index c603d5f1..ad5a978e 100644
--- a/tools/standalone_miri/main.cpp
+++ b/tools/standalone_miri/main.cpp
@@ -73,18 +73,18 @@ int main(int argc, const char* argv[])
// Create argc/argv based on input arguments
auto argv_alloc = Allocation::new_alloc((1 + opts.args.size()) * POINTER_SIZE, "argv");
- argv_alloc->write_usize(0 * POINTER_SIZE, 0);
+ argv_alloc->write_usize(0 * POINTER_SIZE, Allocation::PTR_BASE);
argv_alloc->relocations.push_back({ 0 * POINTER_SIZE, RelocationPtr::new_ffi(FFIPointer::new_const_bytes(opts.infile.c_str(), opts.infile.size() + 1)) });
for(size_t i = 0; i < opts.args.size(); i ++)
{
- argv_alloc->write_usize((1 + i) * POINTER_SIZE, 0);
+ argv_alloc->write_usize((1 + i) * POINTER_SIZE, Allocation::PTR_BASE);
argv_alloc->relocations.push_back({ (1 + i) * POINTER_SIZE, RelocationPtr::new_ffi(FFIPointer::new_const_bytes(opts.args[0], ::std::strlen(opts.args[0]) + 1)) });
}
// Construct argc/argv values
auto val_argc = Value::new_isize(1 + opts.args.size());
auto argv_ty = ::HIR::TypeRef(RawType::I8).wrap(TypeWrapper::Ty::Pointer, 0 ).wrap(TypeWrapper::Ty::Pointer, 0);
- auto val_argv = Value::new_pointer(argv_ty, 0, RelocationPtr::new_alloc(argv_alloc));
+ auto val_argv = Value::new_pointer(argv_ty, Allocation::PTR_BASE, RelocationPtr::new_alloc(argv_alloc));
// Catch various exceptions from the interpreter
try