Disable PIE, add sanity check for >4GB

This commit is contained in:
uyjulian 2020-01-12 09:45:10 -06:00
parent 03fc337242
commit 67dd2e6676
No known key found for this signature in database
GPG Key ID: FEA459A8CA14685B
2 changed files with 8 additions and 1 deletions

View File

@ -196,6 +196,13 @@ void * vm_acquire(size_t size, int options)
errno = vm_error(ret_code);
return VM_MAP_FAILED;
}
// Sanity checks for 64-bit platforms
if (sizeof(void *) > 4 && (options & VM_MAP_32BIT) && !(((char *)addr + size) <= (char *)0xffffffff))
{
vm_release(addr, size);
return VM_MAP_FAILED;
}
#elif defined(HAVE_MMAP_VM)
int fd = zero_fd;
int the_map_flags = translate_map_flags(options) | map_flags;

View File

@ -110,7 +110,7 @@ target_link_libraries(BasiliskII ${COREFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} ${SD
# set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 0x2000" )
SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 0x2000 -Wl,-no_pie" )
add_definitions(-march=native)