From 19a3bfec3bc159eb9b25c44c889474a61d419d8f Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 7 Aug 2019 15:26:29 +0200 Subject: [PATCH] Fix constant alignment on macOS --- src/constant.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/constant.rs b/src/constant.rs index 6e087f8ca5e..3ccd0f97dc5 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -281,7 +281,12 @@ fn define_all_allocs( let mut data_ctx = DataContext::new(); - data_ctx.define(alloc.bytes.to_vec().into_boxed_slice()); + let mut bytes = alloc.bytes.to_vec(); + // The machO backend of faerie doesn't align data objects correctly unless we do this. + while bytes.len() as u64 % 16 != 0 { + bytes.push(0xde); + } + data_ctx.define(bytes.into_boxed_slice()); for &(offset, (_tag, reloc)) in alloc.relocations.iter() { let addend = {