mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 18:25:16 +01:00
Shift segments in Mach-O to outside of required AS
Mach-O defaults to having .text segment starting at 0x1000 RVA, which clashes with the address space required for mmap to work properly. This change tells linker to move the segment outside of required AS, and then some, so that mmap can properly allocate required addresses without evicting anything else.
This commit is contained in:
committed by
LRFLEW
parent
ce56b2c7f7
commit
1bafbde113
@@ -63,7 +63,10 @@ if (UNIX)
|
||||
# force 32bit build for now and set necessary flags to compile code as is
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -std=gnu99 -fno-omit-frame-pointer")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -std=gnu++11 -fno-omit-frame-pointer")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-m32")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
|
||||
if (APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-image_base,0x3401000")
|
||||
endif (APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
|
||||
endif (UNIX)
|
||||
|
||||
|
||||
@@ -566,7 +566,7 @@ static bool openrct2_setup_rct2_segment()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void *fbase = mmap(NULL, file_size, PROT_READ, MAP_PRIVATE, gExeFd, 0);
|
||||
void *fbase = mmap(NULL, file_size, PROT_READ, MAP_PRIVATE | MAP_FILE, gExeFd, 0);
|
||||
err = errno;
|
||||
log_warning("mmapped file to %p", fbase);
|
||||
if (fbase == MAP_FAILED)
|
||||
|
||||
Reference in New Issue
Block a user