From 787918d333d3cd52713bd04fc2f04dfb9e7c69ae Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Sat, 19 Aug 2023 18:41:38 +0300 Subject: [PATCH 1/3] Fix illumos-x64 build --- src/coreclr/gc/env/gcenv.base.h | 4 ---- src/coreclr/pal/inc/pal.h | 1 + src/coreclr/vm/amd64/asmhelpers.S | 2 +- src/native/minipal/cpuid.h | 3 +++ src/native/minipal/utils.h | 4 ++++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/coreclr/gc/env/gcenv.base.h b/src/coreclr/gc/env/gcenv.base.h index 31a602863215fa..cbbf358fac3cd2 100644 --- a/src/coreclr/gc/env/gcenv.base.h +++ b/src/coreclr/gc/env/gcenv.base.h @@ -45,10 +45,6 @@ #define SSIZE_T_MAX ((ptrdiff_t)(SIZE_T_MAX / 2)) #endif -#ifndef __has_builtin -#define __has_builtin(x) 0 -#endif - #ifndef _INC_WINDOWS // ----------------------------------------------------------------------------------------------------------- // diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h index e691ee5e06d352..fcbe9d6dc5b8a2 100644 --- a/src/coreclr/pal/inc/pal.h +++ b/src/coreclr/pal/inc/pal.h @@ -69,6 +69,7 @@ extern "C" { #include #include +#include // Native system libray handle. // On Unix systems, NATIVE_LIBRARY_HANDLE type represents a library handle not registered with the PAL. diff --git a/src/coreclr/vm/amd64/asmhelpers.S b/src/coreclr/vm/amd64/asmhelpers.S index a8cdb06237eb55..9f45f9f39d5996 100644 --- a/src/coreclr/vm/amd64/asmhelpers.S +++ b/src/coreclr/vm/amd64/asmhelpers.S @@ -344,7 +344,7 @@ LEAF_ENTRY GetTlsIndexObjectDescOffset, _TEXT .byte 0x66 .byte 0x66 .byte 0x48 # rex.W prefix for padding - call __tls_get_addr # dummy call to have linker see the code pattern to replace the offset + call EXTERNAL_C_FUNC(__tls_get_addr) # dummy call to have linker see the code pattern to replace the offset int 3 LEAF_END GetTlsIndexObjectDescOffset, _TEXT #endif diff --git a/src/native/minipal/cpuid.h b/src/native/minipal/cpuid.h index f6d39ba6783d87..8020775dd6df33 100644 --- a/src/native/minipal/cpuid.h +++ b/src/native/minipal/cpuid.h @@ -13,6 +13,9 @@ #endif // HOST_WINDOWS #if defined(HOST_UNIX) + +#include + // MSVC directly defines intrinsics for __cpuid and __cpuidex matching the below signatures // We define matching signatures for use on Unix platforms. // diff --git a/src/native/minipal/utils.h b/src/native/minipal/utils.h index 9dcb4a8b6620c9..644ed21f2714fb 100644 --- a/src/native/minipal/utils.h +++ b/src/native/minipal/utils.h @@ -9,6 +9,10 @@ // Number of characters in a string literal. Excludes terminating NULL. #define STRING_LENGTH(str) (ARRAY_SIZE(str) - 1) +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + #if defined(_MSC_VER) # if defined(__SANITIZE_ADDRESS__) # define HAS_ADDRESS_SANITIZER From c2b38b6c0c3b49d0a236c611866e7367e8c421fa Mon Sep 17 00:00:00 2001 From: Adeel <3840695+am11@users.noreply.github.com> Date: Sat, 19 Aug 2023 19:03:28 +0300 Subject: [PATCH 2/3] Rename macro in tests --- .../native/metadatagetdispenser/metadatagetdispenser.cpp | 4 ++-- src/tests/profiler/native/profiler.cpp | 8 ++++---- src/tests/profiler/native/profiler.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tests/profiler/native/metadatagetdispenser/metadatagetdispenser.cpp b/src/tests/profiler/native/metadatagetdispenser/metadatagetdispenser.cpp index 1fd8a191deeaee..e492edfa37732d 100644 --- a/src/tests/profiler/native/metadatagetdispenser/metadatagetdispenser.cpp +++ b/src/tests/profiler/native/metadatagetdispenser/metadatagetdispenser.cpp @@ -93,11 +93,11 @@ HRESULT MetaDataGetDispenser::ModuleLoadStarted(ModuleID moduleId) return E_FAIL; } - WCHAR filePath[STRING_LENGTH]; + WCHAR filePath[STR_LENGTH]; ULONG filePathLength; hr = pCorProfilerInfo->GetModuleInfo2(moduleId, NULL, - STRING_LENGTH, + STR_LENGTH, &filePathLength, filePath, NULL, diff --git a/src/tests/profiler/native/profiler.cpp b/src/tests/profiler/native/profiler.cpp index 4eff2428b99d55..57540d79864256 100644 --- a/src/tests/profiler/native/profiler.cpp +++ b/src/tests/profiler/native/profiler.cpp @@ -625,11 +625,11 @@ String Profiler::GetFunctionIDName(FunctionID funcId) return WCHAR("FuncNameLookupFailed"); } - WCHAR funcName[STRING_LENGTH]; + WCHAR funcName[STR_LENGTH]; hr = pIMDImport->GetMethodProps(token, NULL, funcName, - STRING_LENGTH, + STR_LENGTH, 0, 0, NULL, @@ -753,7 +753,7 @@ String Profiler::GetClassIDName(ClassID classId) String Profiler::GetModuleIDName(ModuleID modId) { - WCHAR moduleName[STRING_LENGTH]; + WCHAR moduleName[STR_LENGTH]; ULONG nameLength = 0; AssemblyID assemID; @@ -765,7 +765,7 @@ String Profiler::GetModuleIDName(ModuleID modId) HRESULT hr = pCorProfilerInfo->GetModuleInfo(modId, NULL, - STRING_LENGTH, + STR_LENGTH, &nameLength, moduleName, &assemID); diff --git a/src/tests/profiler/native/profiler.h b/src/tests/profiler/native/profiler.h index 00c64a1d950038..2e64a5ab8de6e7 100644 --- a/src/tests/profiler/native/profiler.h +++ b/src/tests/profiler/native/profiler.h @@ -22,7 +22,7 @@ #endif // WIN32 #define SHORT_LENGTH 32 -#define STRING_LENGTH 256 +#define STR_LENGTH 256 #define LONG_LENGTH 1024 typedef void (*ProfilerCallback) (void); From 5866962565d987b9f63fdc79d2d00a14f0315b2a Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sat, 19 Aug 2023 11:40:46 -0700 Subject: [PATCH 3/3] Update src/tests/profiler/native/profiler.h --- src/tests/profiler/native/profiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/profiler/native/profiler.h b/src/tests/profiler/native/profiler.h index 2e64a5ab8de6e7..a49290b3ba249a 100644 --- a/src/tests/profiler/native/profiler.h +++ b/src/tests/profiler/native/profiler.h @@ -22,7 +22,7 @@ #endif // WIN32 #define SHORT_LENGTH 32 -#define STR_LENGTH 256 +#define STR_LENGTH 256 #define LONG_LENGTH 1024 typedef void (*ProfilerCallback) (void);