diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake index ff2dfdb4a5bf60..99d6dfe82dde38 100644 --- a/eng/common/cross/toolchain.cmake +++ b/eng/common/cross/toolchain.cmake @@ -225,13 +225,19 @@ elseif(ILLUMOS) locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) elseif(HAIKU) set(CMAKE_SYSROOT "${CROSS_ROOTFS}") - set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") set(CMAKE_SYSTEM_PREFIX_PATH "${CROSS_ROOTFS}") set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lssp") set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lssp") - locate_toolchain_exec(gcc CMAKE_C_COMPILER) - locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) + if ($ENV{CCC_CC} MATCHES ".*gcc.*") + set(CMAKE_PROGRAM_PATH "${CMAKE_PROGRAM_PATH};${CROSS_ROOTFS}/cross-tools-x86_64/bin") + locate_toolchain_exec(gcc CMAKE_C_COMPILER) + locate_toolchain_exec(g++ CMAKE_CXX_COMPILER) + else() + set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64") + set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64") + set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/cross-tools-x86_64") + endif() # let CMake set up the correct search paths include(Platform/Haiku) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 18952687829684..db3a2a2f065ee5 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -494,7 +494,11 @@ if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI) # The default linker on Solaris also does not support PIE. if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_APPLE AND NOT MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") - add_compile_options($<$,EXECUTABLE>:-fPIE>) + if(CLR_CMAKE_TARGET_HAIKU) + add_compile_options($<$,EXECUTABLE>:-fPIC>) + else() + add_compile_options($<$,EXECUTABLE>:-fPIE>) + endif() add_compile_options($<$,SHARED_LIBRARY>:-fPIC>) endif() diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp index f4b5cb7dfb7f7b..42b73e0611241a 100644 --- a/src/coreclr/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/gc/unix/gcenv.unix.cpp @@ -208,7 +208,7 @@ bool GCToOSInterface::Initialize() #else // HAVE_SCHED_GETAFFINITY - for (size_t i = 0; i < configuredCpuCount; i++) + for (int i = 0; i < configuredCpuCount; i++) { g_processAffinitySet.Add(i); } diff --git a/src/native/libs/System.Native/pal_environment.c b/src/native/libs/System.Native/pal_environment.c index 76ad3a807eec1e..b61c8fab6c8751 100644 --- a/src/native/libs/System.Native/pal_environment.c +++ b/src/native/libs/System.Native/pal_environment.c @@ -25,8 +25,8 @@ char** SystemNative_GetEnviron(void) #endif } -void SystemNative_FreeEnviron(char** environ) +void SystemNative_FreeEnviron(char** environment) { // no op - (void)environ; + (void)environment; } diff --git a/src/native/libs/System.Native/pal_mount.c b/src/native/libs/System.Native/pal_mount.c index 69ae5ca7a29f85..b7fe6fa55bccb2 100644 --- a/src/native/libs/System.Native/pal_mount.c +++ b/src/native/libs/System.Native/pal_mount.c @@ -34,7 +34,7 @@ #endif // __HAIKU__ // Android does not define MNTOPT_RO -#ifndef MNTOPT_RO +#if !defined(MNTOPT_RO) && (HAVE_SYS_MNTENT_H || HAVE_MNTENT_H) #define MNTOPT_RO "r" #endif #endif diff --git a/src/native/libs/System.Native/pal_networking.c b/src/native/libs/System.Native/pal_networking.c index 7f13890ca61fe3..ac1650519e96e7 100644 --- a/src/native/libs/System.Native/pal_networking.c +++ b/src/native/libs/System.Native/pal_networking.c @@ -3681,6 +3681,7 @@ int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, i // Emulate sendfile using a simple read/send loop. *sent = 0; char* buffer = NULL; + size_t bufferLength = Min((size_t)count, 80 * 1024 * sizeof(char)); // Save the original input file position and seek to the offset position off_t inputFileOrigOffset = lseek(infd, 0, SEEK_CUR); @@ -3690,7 +3691,6 @@ int32_t SystemNative_SendFile(intptr_t out_fd, intptr_t in_fd, int64_t offset, i } // Allocate a buffer - size_t bufferLength = Min((size_t)count, 80 * 1024 * sizeof(char)); buffer = (char*)malloc(bufferLength); if (buffer == NULL) { diff --git a/src/native/libs/System.Native/pal_process.c b/src/native/libs/System.Native/pal_process.c index bc2a713849c1b7..6249f8821bce8d 100644 --- a/src/native/libs/System.Native/pal_process.c +++ b/src/native/libs/System.Native/pal_process.c @@ -784,6 +784,9 @@ static int32_t ConvertRLimitResourcesPalToPlatform(RLimitResources value) #elif defined(RLIMIT_VMEM) case PAL_RLIMIT_RSS: return RLIMIT_VMEM; +#else + case PAL_RLIMIT_RSS: + break; #endif #ifdef RLIMIT_MEMLOCK case PAL_RLIMIT_MEMLOCK: @@ -791,17 +794,19 @@ static int32_t ConvertRLimitResourcesPalToPlatform(RLimitResources value) #elif defined(RLIMIT_VMEM) case PAL_RLIMIT_MEMLOCK: return RLIMIT_VMEM; +#else + case PAL_RLIMIT_MEMLOCK: + break; #endif #ifdef RLIMIT_NPROC case PAL_RLIMIT_NPROC: return RLIMIT_NPROC; +#else + case PAL_RLIMIT_NPROC: + break; #endif case PAL_RLIMIT_NOFILE: return RLIMIT_NOFILE; -#if !defined(RLIMIT_RSS) || !(defined(RLIMIT_MEMLOCK) || defined(RLIMIT_VMEM)) || !defined(RLIMIT_NPROC) - default: - break; -#endif } assert_msg(false, "Unknown RLIMIT value", (int)value); diff --git a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c index c3dc67713f12d0..941e8363a8a97c 100644 --- a/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c +++ b/src/native/libs/System.Security.Cryptography.Native/pal_evp_pkey.c @@ -1005,7 +1005,11 @@ EVP_PKEY* CryptoNative_LoadKeyFromProvider(const char* providerName, const char* EvpPKeyExtraHandle* extra = (EvpPKeyExtraHandle*)malloc(sizeof(EvpPKeyExtraHandle)); extra->prov = prov; extra->libCtx = libCtx; +#if defined(TARGET_HAIKU) && defined(__clang__) + __c11_atomic_init(&extra->refCount, 1); +#else atomic_init(&extra->refCount, 1); +#endif *extraHandle = extra; }