I just tried to recompile with HAVE_MMAP_SHARED_CAN_EXEC = 1 and HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC = 0 but it doesn't work.
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000197786a60 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x000000010074abe8 libsystem_pthread.dylib`pthread_kill + 288
frame #2: 0x00000001976cba30 libsystem_c.dylib`abort + 180
* frame #3: 0x00000001004c3370 libffcall.0.dylib`callback_trampoline_alloc.cold.2 at trampoline.c:448:67 [opt]
frame #4: 0x00000001004c0474 libffcall.0.dylib`callback_trampoline_alloc(address=(libffcall.0.dylib`callback_receiver), data0=0x0000000100002eb4, data1=0x0000600001ae8060) at trampoline.c:448:19 [opt]
frame #5: 0x0000000100002ea8 CTest`alloc_void_call_void(the_this=0x000000011f604880, the_func=0x000000010000386c) at callback.c:73:12
frame #6: 0x0000000100002a5c CTest`create_deck at deck.c:15:27
frame #7: 0x0000000100002694 CTest`init_game(n_players='\x02') at game.c:12:18
frame #8: 0x0000000100002640 CTest`main(argc=1, argv=0x000000016fdff528) at main.c:14:20
frame #9: 0x00000001974360e0 dyld`start + 2360
page = (char*)mmap(NULL,pagesize,PROT_READ|PROT_WRITE,MAP_SHARED,file_fd,file_length);
page_x = (char*)mmap(NULL,pagesize,PROT_READ|PROT_EXEC,MAP_SHARED,file_fd,file_length);
The second mmap is not working.