Skip to content

Commit

Permalink
Add support for building CoreCLR for MacCatalyst/iOS simulator (#109928)
Browse files Browse the repository at this point in the history
* Make it possible to compile CoreCLR on iOS-like platforms with './build.sh clr+clr.nativeaotlibs+libs+packs -os [iossimulator/maccatalyst/ios] -arch arm64 -cross'

Build the singlefilehost even if we don't currently use it

Make coreclrhost.h compatible v C(not++)

Fix TargetOS::IsMacOS

WIP: AppleAppBuilder support for CoreCLR

Make the sample app working: dotnet publish src/mono/sample/iOS/Program.csproj -c Release /p:TargetOS=iossimulator /p:TargetArchitecture=arm64 /p:AppleAppBuilderRuntime=CoreCLR /p:DeployAndRun=true /p:UseMonoRuntime=false /p:RunAOTCompilation=false /p:MonoForceInterpreter=false

Cleanup

Update src/tasks/AppleAppBuilder/AppleAppBuilder.csproj

Co-authored-by: Adeel Mujahid <[email protected]>

Use sys_icache_invalidate for all iOS-like platforms

Consolidate macOS-only entrypoints in a single #if block

Apply feedback

Fix jitinterface cross-build

Infer AppleAppBuilderRuntime from UseMonoRuntime and UseNativeAOTRuntime

Minor changes to test infrastructure

Add basic documentation

Add nearly complete support for building runtime tests

Fix building seh-unwind with older iOS SDK

Use enum for TargetRuntime in AppleAppBuilder

Fix LibraryBuilder build

Cleanup

Fix after rebase

Revert accidental change

Fix tvOS build

Drop CoreCLR tvOS Simulator support for now

* Fix rpath on MacCatalyst

* Apply suggestions from code review

Co-authored-by: Aaron Robinson <[email protected]>

* Use CORECLR_HOSTING_API_LINKAGE for extern 'C'

* Remove extra #include

* Drop ICU linkage (not needed with Hybrid Globalization)

* Move jit_write_protect_np initialization

* Use __APPLE__ in PAL instead of TARGET_APPLE for consistency

* Revert changes to native libs and exclude singlefilehost

* Revert more singlefilehost changes

* Remove excessive -D_XOPEN_SOURCE

* Fix build with FEATURE_PERFTRACING_STANDALONE_PAL (debug libs)

* Build with FEATURE_STANDALONE_GC=0

* Remove extra NativeDependencies property (bad merge)

* Add back the UseNativeAOTRuntime property to unblock CI

---------

Co-authored-by: Aaron Robinson <[email protected]>
Co-authored-by: Milos Kotlar <[email protected]>
  • Loading branch information
3 people authored Jan 24, 2025
1 parent 0a477a8 commit 717d3b1
Show file tree
Hide file tree
Showing 55 changed files with 568 additions and 203 deletions.
33 changes: 33 additions & 0 deletions docs/workflow/building/coreclr/ios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Cross Compilation for iOS Simulator on macOS

## Requirements

Build requirements are the same as for building native CoreCLR on macOS. iPhone SDK has to be enabled in Xcode installation.

## Cross compiling CoreCLR

Build the runtime pack and tools with

```
./build.sh clr+clr.runtime+libs+packs -os [iossimulator/maccatalyst] -arch [x64/arm64] -cross -c Release
```

## Running the sample iOS app

Build and run the sample app with

```
./dotnet.sh publish src/mono/sample/iOS/Program.csproj -c Release /p:TargetOS=iossimulator /p:TargetArchitecture=arm64 /p:DeployAndRun=true /p:UseMonoRuntime=false /p:RunAOTCompilation=false /p:MonoForceInterpreter=false
```

The command also produces an XCode project that can be opened with `open ./src/mono/sample/iOS/bin/iossimulator-arm64/Bundle/HelloiOS/HelloiOS.xcodeproj` and debugged in Xcode.

## Running the runtime tests

Build the runtime tests with

```
./src/tests/build.sh -os iossimulator arm64 Release -p:UseMonoRuntime=false
```

Running the tests is not implemented yet. It will likely need similar app bundle infrastructure as NativeAOT/iOS uses.
6 changes: 3 additions & 3 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeFlavor)' == ''">
<RuntimeFlavor Condition="'$(TargetsMobile)' == 'true' and !$(_subset.Contains('+clr.nativeaotlibs+'))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="('$(TargetsMobile)' == 'true' or '$(TargetsLinuxBionic)' == 'true') and $(_subset.Contains('+clr.nativeaotlibs+'))">CoreCLR</RuntimeFlavor>
<RuntimeFlavor Condition="('$(TargetsMobile)' == 'true' or '$(TargetsLinuxBionic)' == 'true') and ($(_subset.Contains('+clr.nativeaotlibs+')) or $(_subset.Contains('+clr.runtime+')))">CoreCLR</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and '$(TargetsMobile)' == 'true'">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == '' and ($(_subset.Contains('+mono+')) or $(_subset.Contains('+mono.runtime+'))) and (!$(_subset.Contains('+clr+')) and !$(_subset.Contains('+clr.runtime+')) and !$(_subset.Contains('+clr.corelib+')))">Mono</RuntimeFlavor>
<RuntimeFlavor Condition="'$(RuntimeFlavor)' == ''">$(PrimaryRuntimeFlavor)</RuntimeFlavor>
</PropertyGroup>
Expand All @@ -92,7 +92,7 @@
<DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools+host.native</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets Condition="'$(PackageRID)' == 'linux-armel'">clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.crossarchtools</DefaultCoreClrSubsets>
<!-- Even on platforms that do not support the CoreCLR runtime, we still want to build ilasm/ildasm. -->
<DefaultCoreClrSubsets Condition="'$(PrimaryRuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets>
<DefaultCoreClrSubsets Condition="'$(RuntimeFlavor)' != 'CoreCLR'">clr.iltools+clr.packages</DefaultCoreClrSubsets>

<DefaultNativeAotSubsets>clr.alljits+clr.tools+clr.nativeaotlibs+clr.nativeaotruntime</DefaultNativeAotSubsets>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageFile Include="$(RuntimeBinDir)R2RDump\ILCompiler.Reflection.ReadyToRun.dll">
<PackageFile Include="$(RuntimeBinDir)ILCompiler.Reflection.ReadyToRun.dll">
<TargetPath>\lib\netstandard2.0\</TargetPath>
</PackageFile>
<Dependency Include="System.Reflection.Metadata">
Expand Down
21 changes: 13 additions & 8 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ include(components.cmake)
#---------------------------
# Build the single file host
#---------------------------
if(NOT CLR_CROSS_COMPONENTS_BUILD)
if(NOT CLR_CROSS_COMPONENTS_BUILD AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
set(CLR_SINGLE_FILE_HOST_ONLY 1)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static)
add_dependencies(runtime singlefilehost)
Expand Down Expand Up @@ -101,8 +101,10 @@ if(CLR_CMAKE_HOST_UNIX)
add_linker_flag(-Wl,-z,notext)
endif()

if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
if(NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(pal)
endif()
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(hosts)
endif()
else()
Expand All @@ -129,7 +131,7 @@ add_subdirectory(${CLR_SRC_NATIVE_DIR}/containers containers)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/eventpipe eventpipe)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/minipal shared_minipal)

if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
if(NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(debug/debug-pal)
endif()

Expand Down Expand Up @@ -243,7 +245,7 @@ if(CLR_CMAKE_HOST_UNIX)
add_subdirectory(nativeresources)
endif(CLR_CMAKE_HOST_UNIX)

if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
if(NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(utilcode)
add_subdirectory(inc)

Expand All @@ -257,11 +259,14 @@ if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_H
add_subdirectory(binder)
add_subdirectory(classlibnative)
add_subdirectory(dlls)
add_subdirectory(tools)
add_subdirectory(unwinder)
add_subdirectory(interop)
endif()

if(CLR_CMAKE_HOST_WIN32)
add_subdirectory(hosts)
endif(CLR_CMAKE_HOST_WIN32)
if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(tools)
endif(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)

if(CLR_CMAKE_HOST_WIN32)
add_subdirectory(hosts)
endif(CLR_CMAKE_HOST_WIN32)
6 changes: 3 additions & 3 deletions src/coreclr/debug/daccess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ target_link_libraries(daccess PRIVATE cdacreader_api)

add_dependencies(daccess eventing_headers)

if(CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
if(CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_APPLE)
add_definitions(-DUSE_DAC_TABLE_RVA)

set(args $<$<NOT:$<BOOL:${CLR_CMAKE_HOST_OSX}>>:--dynamic> $<TARGET_FILE:coreclr> ${GENERATED_INCLUDE_DIR}/dactablerva.h)
set(args $<$<NOT:$<BOOL:${CLR_CMAKE_HOST_APPLE}>>:--dynamic> $<TARGET_FILE:coreclr> ${GENERATED_INCLUDE_DIR}/dactablerva.h)

add_custom_command(
OUTPUT ${GENERATED_INCLUDE_DIR}/dactablerva.h
Expand All @@ -72,4 +72,4 @@ if(CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
)

add_dependencies(daccess dactablerva_header)
endif(CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS)
endif(CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_APPLE)
4 changes: 2 additions & 2 deletions src/coreclr/dlls/mscordac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ else(CLR_CMAKE_HOST_WIN32)
# Add dependency on export file
add_custom_target(mscordaccore_exports DEPENDS ${EXPORTS_FILE})

if(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU)
if(CLR_CMAKE_HOST_APPLE OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU)
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
endif(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU)
endif(CLR_CMAKE_HOST_APPLE OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU)

if(CORECLR_SET_RPATH AND CLR_CMAKE_HOST_OSX AND CLR_CMAKE_HOST_ARCH_ARM64)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ endif(CLR_CMAKE_TARGET_WIN32)

# add the install targets
install_clr(TARGETS coreclr DESTINATIONS . sharedFramework COMPONENT runtime)
if(CLR_CMAKE_HOST_MACCATALYST OR CLR_CMAKE_HOST_IOS)
install_clr(TARGETS coreclr_static DESTINATIONS . sharedFramework COMPONENT runtime)
endif()

# Enable profile guided optimization
add_pgo(coreclr)
8 changes: 7 additions & 1 deletion src/coreclr/hosts/inc/coreclrhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@
#define CORECLR_CALLING_CONVENTION
#endif

#ifdef __cplusplus
#define CORECLR_HOSTING_API_LINKAGE extern "C"
#else
#define CORECLR_HOSTING_API_LINKAGE
#endif

#include <stdint.h>

// For each hosting API, we define a function prototype and a function pointer
// The prototype is useful for implicit linking against the dynamic coreclr
// library and the pointer for explicit dynamic loading (dlopen, LoadLibrary)
#define CORECLR_HOSTING_API(function, ...) \
extern "C" int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \
CORECLR_HOSTING_API_LINKAGE int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \
typedef int (CORECLR_CALLING_CONVENTION *function##_ptr)(__VA_ARGS__)

//
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/inc/crosscomp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define MAKE_TARGET_DLLNAME_W(name) name W(".dll")
#define MAKE_TARGET_DLLNAME_A(name) name ".dll"
#else // TARGET_WINDOWS
#ifdef TARGET_OSX
#ifdef TARGET_APPLE
#define MAKE_TARGET_DLLNAME_W(name) W("lib") name W(".dylib")
#define MAKE_TARGET_DLLNAME_A(name) "lib" name ".dylib"
#else
Expand Down Expand Up @@ -686,9 +686,9 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS {

#if defined(TARGET_OSX) && defined(TARGET_X86)
#define DAC_CS_NATIVE_DATA_SIZE 76
#elif defined(TARGET_OSX) && defined(TARGET_AMD64)
#elif defined(TARGET_APPLE) && defined(TARGET_AMD64)
#define DAC_CS_NATIVE_DATA_SIZE 120
#elif defined(TARGET_OSX) && defined(TARGET_ARM64)
#elif defined(TARGET_APPLE) && defined(TARGET_ARM64)
#define DAC_CS_NATIVE_DATA_SIZE 120
#elif defined(TARGET_FREEBSD) && defined(TARGET_X86)
#define DAC_CS_NATIVE_DATA_SIZE 12
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/executableallocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ class ExecutableWriterHolder

void Unmap()
{
#if defined(HOST_OSX) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE)
#if defined(HOST_APPLE) && defined(HOST_ARM64) && !defined(DACCESS_COMPILE)
if (m_addressRX != NULL)
{
PAL_JitWriteProtect(false);
Expand Down Expand Up @@ -321,7 +321,7 @@ class ExecutableWriterHolder
ExecutableWriterHolder(T* addressRX, size_t size, ExecutableAllocator::CacheableMapping cacheMapping = ExecutableAllocator::AddToCache)
{
m_addressRX = addressRX;
#if defined(HOST_OSX) && defined(HOST_ARM64)
#if defined(HOST_APPLE) && defined(HOST_ARM64)
m_addressRW = addressRX;
PAL_JitWriteProtect(true);
#else
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/targetosarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TargetOS
static bool OSSettingConfigured;
static bool IsApplePlatform;
#else
#if defined(TARGET_OSX)
#if defined(TARGET_APPLE)
static const bool IsApplePlatform = true;
#else
static const bool IsApplePlatform = false;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# Creates a static library "clrjit_static" to link into the VM.
add_subdirectory(static)

if (CLR_CMAKE_TARGET_OSX)
if (CLR_CMAKE_TARGET_APPLE)
set(TARGET_OS_NAME unix_osx)
elseif (CLR_CMAKE_TARGET_UNIX)
set(TARGET_OS_NAME unix)
Expand Down
34 changes: 17 additions & 17 deletions src/coreclr/minipal/Unix/doublemapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
#include "minipal.h"
#include "minipal/cpufeatures.h"

#ifdef TARGET_OSX
#ifdef TARGET_APPLE

#include <mach/mach.h>

#else // TARGET_OSX
#else // TARGET_APPLE

#ifdef TARGET_64BIT
static const off_t MaxDoubleMappedSize = 2048ULL*1024*1024*1024;
#else
static const off_t MaxDoubleMappedSize = UINT_MAX;
#endif

#endif // TARGET_OSX
#endif // TARGET_APPLE

bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecutableCodeSize)
{
Expand All @@ -44,7 +44,7 @@ bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecu
return false;
}

#ifndef TARGET_OSX
#ifndef TARGET_APPLE

#ifdef TARGET_FREEBSD
int fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, S_IRWXU);
Expand Down Expand Up @@ -78,25 +78,25 @@ bool VMToOSInterface::CreateDoubleMemoryMapper(void** pHandle, size_t *pMaxExecu

*pMaxExecutableCodeSize = MaxDoubleMappedSize;
*pHandle = (void*)(size_t)fd;
#else // !TARGET_OSX
#else // !TARGET_APPLE

*pMaxExecutableCodeSize = SIZE_MAX;
*pHandle = NULL;
#endif // !TARGET_OSX
#endif // !TARGET_APPLE

return true;
}

void VMToOSInterface::DestroyDoubleMemoryMapper(void *mapperHandle)
{
#ifndef TARGET_OSX
#ifndef TARGET_APPLE
close((int)(size_t)mapperHandle);
#endif
}

extern "C" void* PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange(const void* lpBeginAddress, const void* lpEndAddress, size_t dwSize, int fStoreAllocationInfo);

#ifdef TARGET_OSX
#ifdef TARGET_APPLE
bool IsMapJitFlagNeeded()
{
static volatile int isMapJitFlagNeeded = -1;
Expand Down Expand Up @@ -127,7 +127,7 @@ bool IsMapJitFlagNeeded()

return (bool)isMapJitFlagNeeded;
}
#endif // TARGET_OSX
#endif // TARGET_APPLE

void* VMToOSInterface::ReserveDoubleMappedMemory(void *mapperHandle, size_t offset, size_t size, const void *rangeStart, const void* rangeEnd)
{
Expand All @@ -141,7 +141,7 @@ void* VMToOSInterface::ReserveDoubleMappedMemory(void *mapperHandle, size_t offs
}

void* result = PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange(rangeStart, rangeEnd, size, 0 /* fStoreAllocationInfo */);
#ifndef TARGET_OSX
#ifndef TARGET_APPLE
int mmapFlags = MAP_SHARED;
#ifdef TARGET_HAIKU
mmapFlags |= MAP_NORESERVE;
Expand All @@ -156,15 +156,15 @@ void* VMToOSInterface::ReserveDoubleMappedMemory(void *mapperHandle, size_t offs
result = NULL;
}
}
#endif // TARGET_OSX
#endif // TARGET_APPLE

// For requests with limited range, don't try to fall back to reserving at any address
if ((result != NULL) || !isUnlimitedRange)
{
return result;
}

#ifndef TARGET_OSX
#ifndef TARGET_APPLE
result = mmap(NULL, size, PROT_NONE, mmapFlags, fd, offset);
#else
int mmapFlags = MAP_ANON | MAP_PRIVATE;
Expand Down Expand Up @@ -194,28 +194,28 @@ void *VMToOSInterface::CommitDoubleMappedMemory(void* pStart, size_t size, bool

bool VMToOSInterface::ReleaseDoubleMappedMemory(void *mapperHandle, void* pStart, size_t offset, size_t size)
{
#ifndef TARGET_OSX
#ifndef TARGET_APPLE
int fd = (int)(size_t)mapperHandle;
if (mmap(pStart, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fd, offset) == MAP_FAILED)
{
return false;
}
memset(pStart, 0, size);
#endif // TARGET_OSX
#endif // TARGET_APPLE
return munmap(pStart, size) != -1;
}

void* VMToOSInterface::GetRWMapping(void *mapperHandle, void* pStart, size_t offset, size_t size)
{
#ifndef TARGET_OSX
#ifndef TARGET_APPLE
int fd = (int)(size_t)mapperHandle;
void* result = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, offset);
if (result == MAP_FAILED)
{
result = NULL;
}
return result;
#else // TARGET_OSX
#else // TARGET_APPLE
#ifdef TARGET_AMD64
vm_address_t startRW;
vm_prot_t curProtection, maxProtection;
Expand All @@ -240,7 +240,7 @@ void* VMToOSInterface::GetRWMapping(void *mapperHandle, void* pStart, size_t off
assert(false);
return NULL;
#endif // TARGET_AMD64
#endif // TARGET_OSX
#endif // TARGET_APPLE
}

bool VMToOSInterface::ReleaseRWMapping(void* pStart, size_t size)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -2871,14 +2871,14 @@ VirtualFree(
IN DWORD dwFreeType);


#if defined(HOST_OSX) && defined(HOST_ARM64)
#if defined(HOST_APPLE) && defined(HOST_ARM64)

PALIMPORT
VOID
PALAPI
PAL_JitWriteProtect(bool writeEnable);

#endif // defined(HOST_OSX) && defined(HOST_ARM64)
#endif // defined(HOST_APPLE) && defined(HOST_ARM64)


PALIMPORT
Expand Down
Loading

0 comments on commit 717d3b1

Please sign in to comment.