Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 19a3bfe

Browse files
committed
Fix constant alignment on macOS
1 parent bd7c119 commit 19a3bfe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/constant.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,12 @@ fn define_all_allocs(
281281

282282
let mut data_ctx = DataContext::new();
283283

284-
data_ctx.define(alloc.bytes.to_vec().into_boxed_slice());
284+
let mut bytes = alloc.bytes.to_vec();
285+
// The machO backend of faerie doesn't align data objects correctly unless we do this.
286+
while bytes.len() as u64 % 16 != 0 {
287+
bytes.push(0xde);
288+
}
289+
data_ctx.define(bytes.into_boxed_slice());
285290

286291
for &(offset, (_tag, reloc)) in alloc.relocations.iter() {
287292
let addend = {

0 commit comments

Comments
 (0)