diff --git a/tccelf.c b/tccelf.c index bd210e89..8e78763a 100644 --- a/tccelf.c +++ b/tccelf.c @@ -1584,6 +1584,11 @@ ST_FUNC void tcc_add_btstub(TCCState *s1) section_ptr_add(s, 3 * PTR_SIZE); /* prog_base : local nameless symbol with offset 0 at SHN_ABS */ put_ptr(s1, NULL, 0); +#if defined TCC_TARGET_MACHO + /* adjust for __PAGEZERO */ + write64le(data_section->data + data_section->data_offset - PTR_SIZE, + (uint64_t)1 << 32); +#endif n = 2 * PTR_SIZE; #ifdef CONFIG_TCC_BCHECK if (s1->do_bounds_check) {