From 08ad8346087e1caac04d1ca61bfe0ce7fd5977ad Mon Sep 17 00:00:00 2001 From: Vladimir Sadov Date: Sun, 6 Dec 2020 20:08:41 -0800 Subject: [PATCH] Static linking of native libs (#44505) * from prototype * fix OSX * fix for Android * treat "libSystem.Globalization.Native" as QCall in mono too (for now). * fix for wasm * fix pedantic errors on GCC * delete gPalGlobalizationNative * pass overrider from the host * default override * default PInvoke override runs after optional host-provided overrider. * Some PR feedback (mostly related to code, not the CMake stuff). * more coding PR feedback * Deleted "libraries-native" folder. * unifying tryrun.cmake into 1 common file * factor out adding lib-specific dependencies into one place (per native library) * cleanup: entirely remove tryrun.cmake propagation in eng, gen-buildsys, build-commons, and build scripts * remove "clrcompression.dll" and "libSystem.IO.Compression.Native.dylib" from single-file host packaging * mono: refactor Globalization lookup into `default_resolve_dllimport`. * set FEATURE_DISTRO_AGNOSTIC_SSL according to __PortableBuild * CORECLR_CALLING_CONVENTION for the host callback types * refactor common parts of entrypoints.c into entrypoints.h * rename OverrideEntry --> DllImportEntry * extra libs as CMake functions * use macros instead of functions in extra_libs.cmake * mono formatting style in src/mono/mono/metadata/native-library.c Co-authored-by: Ryan Lucia * mono: Remaining stylistic nits. Co-authored-by: Ryan Lucia * do not set DFEATURE_DISTRO_AGNOSTIC_SSL on iOS, Android, tvOS Co-authored-by: Ryan Lucia --- eng/native/build-commons.sh | 25 ++++-- eng/native/configurecompiler.cmake | 1 - eng/native/gen-buildsys.sh | 20 ++--- {src/coreclr => eng/native}/tryrun.cmake | 8 ++ src/coreclr/CMakeLists.txt | 8 +- src/coreclr/build-runtime.sh | 4 +- src/coreclr/src/CMakeLists.txt | 1 + src/coreclr/src/dlls/mscoree/unixinterface.cpp | 21 ++++- src/coreclr/src/hosts/inc/coreclrhost.h | 9 ++ src/coreclr/src/inc/bundle.h | 10 +-- src/coreclr/src/inc/cor.h | 1 - src/coreclr/src/inc/corpriv.h | 1 - src/coreclr/src/inc/pinvokeoverride.h | 22 +++++ src/coreclr/src/libraries-native/CMakeLists.txt | 11 --- src/coreclr/src/vm/CMakeLists.txt | 1 + src/coreclr/src/vm/bundle.cpp | 2 +- src/coreclr/src/vm/corelib.cpp | 3 - src/coreclr/src/vm/dllimport.cpp | 13 ++- src/coreclr/src/vm/ecalllist.h | 3 - src/coreclr/src/vm/pinvokeoverride.cpp | 46 +++++++++++ src/installer/corehost/build.sh | 2 +- .../corehost/cli/apphost/static/CMakeLists.txt | 96 ++++++---------------- src/installer/corehost/cli/hostpolicy/coreclr.cpp | 3 +- src/installer/corehost/cli/hostpolicy/coreclr.h | 1 + .../corehost/cli/hostpolicy/hostpolicy_context.cpp | 38 +++++++++ src/installer/corehost/tryrun.cmake | 28 ------- .../Microsoft.NETCore.App/Directory.Build.props | 2 - .../Common/src/Interop/Interop.Libraries.cs | 2 +- .../src/Interop/Windows/Interop.Libraries.cs | 2 +- .../System.IO.Compression.Native/entrypoints.c | 42 ++++++++++ src/libraries/Native/AnyOS/entrypoints.h | 34 ++++++++ src/libraries/Native/Unix/CMakeLists.txt | 18 +++- .../Unix/System.Globalization.Native/entrypoints.c | 84 ++++++++++--------- .../System.IO.Compression.Native/CMakeLists.txt | 19 ++--- .../System.IO.Compression.Native/extra_libs.cmake | 14 ++++ .../Unix/System.IO.Ports.Native/CMakeLists.txt | 21 +++-- .../Native/Unix/System.Native/CMakeLists.txt | 27 +++--- .../Native/Unix/System.Native/extra_libs.cmake | 18 ++++ .../Unix/System.Net.Security.Native/CMakeLists.txt | 47 +++++------ .../System.Net.Security.Native/extra_libs.cmake | 23 ++++++ .../Unix/System.Net.Security.Native/pal_gssapi.h | 1 + .../CMakeLists.txt | 29 ++++--- .../CMakeLists.txt | 85 +++++++------------ .../extra_libs.cmake | 39 +++++++++ src/libraries/Native/Unix/tryrun.cmake | 42 ---------- src/libraries/Native/Windows/CMakeLists.txt | 16 ++++ .../Native/Windows/clrcompression/CMakeLists.txt | 51 +++++++----- src/libraries/Native/build-native.sh | 2 +- src/mono/mono/metadata/native-library-qcall.c | 6 -- src/mono/mono/metadata/native-library.c | 24 ++++++ src/mono/mono/metadata/qcall-def.h | 2 +- src/mono/wasm/wasm.proj | 2 +- src/tests/build.sh | 3 +- 53 files changed, 632 insertions(+), 401 deletions(-) rename {src/coreclr => eng/native}/tryrun.cmake (93%) create mode 100644 src/coreclr/src/inc/pinvokeoverride.h delete mode 100644 src/coreclr/src/libraries-native/CMakeLists.txt create mode 100644 src/coreclr/src/vm/pinvokeoverride.cpp delete mode 100644 src/installer/corehost/tryrun.cmake create mode 100644 src/libraries/Native/AnyOS/System.IO.Compression.Native/entrypoints.c create mode 100644 src/libraries/Native/AnyOS/entrypoints.h create mode 100644 src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake create mode 100644 src/libraries/Native/Unix/System.Native/extra_libs.cmake create mode 100644 src/libraries/Native/Unix/System.Net.Security.Native/extra_libs.cmake create mode 100644 src/libraries/Native/Unix/System.Security.Cryptography.Native/extra_libs.cmake delete mode 100644 src/libraries/Native/Unix/tryrun.cmake diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 0b2caf9..e77d219 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -71,10 +71,9 @@ build_native() targetOS="$1" platformArch="$2" cmakeDir="$3" - tryrunDir="$4" - intermediatesDir="$5" - cmakeArgs="$6" - message="$7" + intermediatesDir="$4" + cmakeArgs="$5" + message="$6" # All set to commence the build echo "Commencing build of \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir" @@ -146,7 +145,7 @@ EOF scan_build=scan-build fi - nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$tryrunDir\" \"$intermediatesDir\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType \"$generator\" $scan_build $cmakeArgs" + nextCommand="\"$__RepoRootDir/eng/native/gen-buildsys.sh\" \"$cmakeDir\" \"$intermediatesDir\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType \"$generator\" $scan_build $cmakeArgs" echo "Invoking $nextCommand" eval $nextCommand @@ -455,6 +454,22 @@ if [[ "$__PortableBuild" == 0 ]]; then __CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false" fi +if [[ "$__BuildArch" == wasm ]]; then + # nothing to do here + true +elif [[ "$__TargetOS" == iOS ]]; then + # nothing to do here + true +elif [[ "$__TargetOS" == tvOS ]]; then + # nothing to do here + true +elif [[ "$__TargetOS" == Android ]]; then + # nothing to do here + true +else + __CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs" +fi + # Configure environment if we are doing a cross compile. if [[ "$__CrossBuild" == 1 ]]; then CROSSCOMPILE=1 diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 7adc24d..4daa6fe 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -451,7 +451,6 @@ endif(CLR_CMAKE_HOST_UNIX) if (MSVC) # Compile options for targeting windows - add_compile_options($<$:/TP>) # compile all files as C++ add_compile_options($<$:/nologo>) # Suppress Startup Banner add_compile_options($<$:/W3>) # set warning level to 3 add_compile_options($<$:/WX>) # treat warnings as errors diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh index 6ecc2d8..5588b50 100755 --- a/eng/native/gen-buildsys.sh +++ b/eng/native/gen-buildsys.sh @@ -7,10 +7,9 @@ scriptroot="$( cd -P "$( dirname "$0" )" && pwd )" if [[ "$#" -lt 4 ]]; then echo "Usage..." - echo "gen-buildsys.sh [build flavor] [ninja] [scan-build] [cmakeargs]" + echo "gen-buildsys.sh [build flavor] [ninja] [scan-build] [cmakeargs]" echo "Specify the path to the top level CMake file." echo "Specify the path that the build system files are generated in." - echo "Specify the path to the directory with tryrun.cmake file." echo "Specify the target architecture." echo "Specify the name of compiler (clang or gcc)." echo "Specify the major version of compiler." @@ -22,11 +21,10 @@ if [[ "$#" -lt 4 ]]; then exit 1 fi -tryrun_dir="$2" -build_arch="$4" -compiler="$5" -majorVersion="$6" -minorVersion="$7" +build_arch="$3" +compiler="$4" +majorVersion="$5" +minorVersion="$6" source "$scriptroot/init-compiler.sh" "$build_arch" "$compiler" "$majorVersion" "$minorVersion" @@ -42,7 +40,7 @@ scan_build=OFF generator="Unix Makefiles" __UnprocessedCMakeArgs="" -for i in "${@:8}"; do +for i in "${@:7}"; do upperI="$(echo "$i" | awk '{print toupper($0)}')" case "$upperI" in # Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO. @@ -73,9 +71,7 @@ if [[ "$CROSSCOMPILE" == "1" ]]; then TARGET_BUILD_ARCH="$build_arch" export TARGET_BUILD_ARCH - if [[ -n "$tryrun_dir" ]]; then - cmake_extra_defines="$cmake_extra_defines -C $tryrun_dir/tryrun.cmake" - fi + cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake" if [[ "$platform" == "Darwin" ]]; then cmake_extra_defines="$cmake_extra_defines -DCMAKE_SYSTEM_NAME=Darwin" @@ -99,7 +95,7 @@ if [[ "$build_arch" == "wasm" ]]; then fi # We have to be able to build with CMake 3.6.2, so we can't use the -S or -B options -pushd "$3" +pushd "$2" # Include CMAKE_USER_MAKE_RULES_OVERRIDE as uninitialized since it will hold its value in the CMake cache otherwise can cause issues when branch switching $cmake_command \ diff --git a/src/coreclr/tryrun.cmake b/eng/native/tryrun.cmake similarity index 93% rename from src/coreclr/tryrun.cmake rename to eng/native/tryrun.cmake index 4b23122..2cfd798 100644 --- a/src/coreclr/tryrun.cmake +++ b/eng/native/tryrun.cmake @@ -31,6 +31,7 @@ if(DARWIN) set_cache_value(HAVE_BROKEN_FIFO_SELECT_EXITCODE 1) set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 1) set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0) + set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0) set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0) set_cache_value(HAVE_CLOCK_GETTIME_NSEC_NP_EXITCODE 0) set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0) @@ -63,6 +64,7 @@ if(DARWIN) set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1) set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 0) set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1) + set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0) else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!") endif() @@ -72,6 +74,7 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS) set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0) set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 0) set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0) + set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0) set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0) set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0) set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0) @@ -100,16 +103,21 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS) if(ALPINE_LINUX) + set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1) set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 0) set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 1) set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1) else() + set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0) set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1) set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 0) set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 0) endif() if (FREEBSD) + set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP 1) + set_cache_value(HAVE_CLOCK_MONOTONIC 1) + set_cache_value(HAVE_CLOCK_REALTIME 1) set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1) set_cache_value(HAVE_PROCFS_MAPS 0) set_cache_value(HAVE_PROCFS_STAT 0) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index ddd5734..b7cb9e9 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -52,7 +52,13 @@ include(pgosupport.cmake) # Include libraries native shims #------------------------------- if(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) - add_subdirectory(src/libraries-native) + set(STATIC_LIBS_ONLY 1) + + if(CLR_CMAKE_TARGET_WIN32) + add_subdirectory(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Windows Native.Windows) + else() + add_subdirectory(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix Native.Unix) + endif() endif(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) #----------------------------------------- diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 91c0b44..f8129a7 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -99,7 +99,7 @@ build_cross_architecture_components() export __CMakeBinDir CROSSCOMPILE __CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CROSS_COMPONENTS_BUILD=1 $__CMakeArgs" - build_native "$__TargetOS" "$__CrossArch" "$__ProjectRoot" "$__ProjectRoot" "$intermediatesForBuild" "$__CMakeArgs" "cross-architecture components" + build_native "$__TargetOS" "$__CrossArch" "$__ProjectRoot" "$intermediatesForBuild" "$__CMakeArgs" "cross-architecture components" CROSSCOMPILE=1 export CROSSCOMPILE @@ -257,7 +257,7 @@ fi if [[ "$__SkipNative" == 1 ]]; then echo "Skipping CoreCLR component build." else - build_native "$__TargetOS" "$__BuildArch" "$__ProjectRoot" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeArgs" "CoreCLR component" + build_native "$__TargetOS" "$__BuildArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeArgs" "CoreCLR component" # Build cross-architecture components if [[ "$__SkipCrossArchNative" != 1 ]]; then diff --git a/src/coreclr/src/CMakeLists.txt b/src/coreclr/src/CMakeLists.txt index 5f74a58..9285c57 100644 --- a/src/coreclr/src/CMakeLists.txt +++ b/src/coreclr/src/CMakeLists.txt @@ -7,6 +7,7 @@ include_directories("classlibnative/bcltype") include_directories("classlibnative/cryptography") include_directories("classlibnative/inc") include_directories("${GENERATED_INCLUDE_DIR}") +include_directories("hosts/inc") if(CLR_CMAKE_TARGET_WIN32 AND FEATURE_EVENT_TRACE) include_directories("${GENERATED_INCLUDE_DIR}/etw") diff --git a/src/coreclr/src/dlls/mscoree/unixinterface.cpp b/src/coreclr/src/dlls/mscoree/unixinterface.cpp index fd8cf50..73ed20a 100644 --- a/src/coreclr/src/dlls/mscoree/unixinterface.cpp +++ b/src/coreclr/src/dlls/mscoree/unixinterface.cpp @@ -18,6 +18,7 @@ #include "../../vm/gdbjithelpers.h" #endif // FEATURE_GDBJIT #include "bundle.h" +#include "pinvokeoverride.h" #define ASSERTE_ALL_BUILDS(expr) _ASSERTE_ALL_BUILDS(__FILE__, (expr)) @@ -119,7 +120,8 @@ static void ConvertConfigPropertiesToUnicode( int propertyCount, LPCWSTR** propertyKeysWRef, LPCWSTR** propertyValuesWRef, - BundleProbe** bundleProbe, + BundleProbeFn** bundleProbe, + PInvokeOverrideFn** pinvokeOverride, bool* hostPolicyEmbedded) { LPCWSTR* propertyKeysW = new (nothrow) LPCWSTR[propertyCount]; @@ -137,7 +139,13 @@ static void ConvertConfigPropertiesToUnicode( { // If this application is a single-file bundle, the bundle-probe callback // is passed in as the value of "BUNDLE_PROBE" property (encoded as a string). - *bundleProbe = (BundleProbe*)_wcstoui64(propertyValuesW[propertyIndex], nullptr, 0); + *bundleProbe = (BundleProbeFn*)_wcstoui64(propertyValuesW[propertyIndex], nullptr, 0); + } + else if (strcmp(propertyKeys[propertyIndex], "PINVOKE_OVERRIDE") == 0) + { + // If host provides a PInvoke override (typically in a single-file bundle), + // the override callback is passed in as the value of "PINVOKE_OVERRIDE" property (encoded as a string). + *pinvokeOverride = (PInvokeOverrideFn*)_wcstoui64(propertyValuesW[propertyIndex], nullptr, 0); } else if (strcmp(propertyKeys[propertyIndex], "HOSTPOLICY_EMBEDDED") == 0) { @@ -185,8 +193,9 @@ int coreclr_initialize( LPCWSTR* propertyKeysW; LPCWSTR* propertyValuesW; - BundleProbe* bundleProbe = nullptr; + BundleProbeFn* bundleProbe = nullptr; bool hostPolicyEmbedded = false; + PInvokeOverrideFn* pinvokeOverride = nullptr; ConvertConfigPropertiesToUnicode( propertyKeys, @@ -195,6 +204,7 @@ int coreclr_initialize( &propertyKeysW, &propertyValuesW, &bundleProbe, + &pinvokeOverride, &hostPolicyEmbedded); #ifdef TARGET_UNIX @@ -211,6 +221,11 @@ int coreclr_initialize( g_hostpolicy_embedded = hostPolicyEmbedded; + if (pinvokeOverride != nullptr) + { + PInvokeOverride::SetPInvokeOverride(pinvokeOverride); + } + ReleaseHolder host; hr = CorHost2::CreateObject(IID_ICLRRuntimeHost4, (void**)&host); diff --git a/src/coreclr/src/hosts/inc/coreclrhost.h b/src/coreclr/src/hosts/inc/coreclrhost.h index 4cb04b9..f1d6c00 100644 --- a/src/coreclr/src/hosts/inc/coreclrhost.h +++ b/src/coreclr/src/hosts/inc/coreclrhost.h @@ -14,6 +14,8 @@ #define CORECLR_CALLING_CONVENTION #endif +#include + // 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) @@ -121,4 +123,11 @@ CORECLR_HOSTING_API(coreclr_execute_assembly, #undef CORECLR_HOSTING_API +// +// Callback types used by the hosts +// +typedef bool(CORECLR_CALLING_CONVENTION BundleProbeFn)(const char* path, int64_t* offset, int64_t* size); +typedef const void* (CORECLR_CALLING_CONVENTION PInvokeOverrideFn)(const char* libraryName, const char* entrypointName); + + #endif // __CORECLR_HOST_H__ diff --git a/src/coreclr/src/inc/bundle.h b/src/coreclr/src/inc/bundle.h index e6c7a0a..ab3ece2 100644 --- a/src/coreclr/src/inc/bundle.h +++ b/src/coreclr/src/inc/bundle.h @@ -3,7 +3,7 @@ /***************************************************************************** ** ** - ** bundle.h - Information about applications bundled as a single-file ** + ** bundle.h - Information about applications bundled as a single-file ** ** ** *****************************************************************************/ @@ -11,6 +11,7 @@ #define _BUNDLE_H_ #include +#include "coreclrhost.h" class Bundle; @@ -34,12 +35,10 @@ struct BundleFileLocation bool IsValid() const { LIMITED_METHOD_CONTRACT; return Offset != 0; } }; -typedef bool(__stdcall BundleProbe)(LPCSTR, INT64*, INT64*); - class Bundle { public: - Bundle(LPCSTR bundlePath, BundleProbe *probe); + Bundle(LPCSTR bundlePath, BundleProbeFn *probe); BundleFileLocation Probe(const SString& path, bool pathIsBundleRelative = false) const; const SString &Path() const { LIMITED_METHOD_CONTRACT; return m_path; } @@ -52,11 +51,10 @@ public: private: SString m_path; // The path to single-file executable - BundleProbe *m_probe; + BundleProbeFn *m_probe; SString m_basePath; // The prefix to denote a path within the bundle COUNT_T m_basePathLength; }; #endif // _BUNDLE_H_ -// EOF ======================================================================= diff --git a/src/coreclr/src/inc/cor.h b/src/coreclr/src/inc/cor.h index 7b9bf9c..9101bcd 100644 --- a/src/coreclr/src/inc/cor.h +++ b/src/coreclr/src/inc/cor.h @@ -2388,4 +2388,3 @@ inline ULONG CorSigUncompressPointer( // return number of bytes of that compre #endif // __cplusplus #endif // _COR_H_ -// EOF ======================================================================= diff --git a/src/coreclr/src/inc/corpriv.h b/src/coreclr/src/inc/corpriv.h index 003386c..4905633 100644 --- a/src/coreclr/src/inc/corpriv.h +++ b/src/coreclr/src/inc/corpriv.h @@ -383,5 +383,4 @@ struct CORCOMPILE_DEPENDENCY; typedef GUID CORCOMPILE_NGEN_SIGNATURE; #endif // _CORPRIV_H_ -// EOF ======================================================================= diff --git a/src/coreclr/src/inc/pinvokeoverride.h b/src/coreclr/src/inc/pinvokeoverride.h new file mode 100644 index 0000000..525f976 --- /dev/null +++ b/src/coreclr/src/inc/pinvokeoverride.h @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +/***************************************************************************** + ** ** + ** pinvokeoverride.h - PInvoke binding override ** + ** ** + *****************************************************************************/ + +#ifndef _PINVOKEOVERRIDE_H_ +#define _PINVOKEOVERRIDE_H_ + +#include "coreclrhost.h" + +class PInvokeOverride +{ +public: + static void SetPInvokeOverride(PInvokeOverrideFn* overrideImpl); + static const void* GetMethodImpl(const char* libraryName, const char* entrypointName); +}; + +#endif // _PINVOKEOVERRIDE_H_ diff --git a/src/coreclr/src/libraries-native/CMakeLists.txt b/src/coreclr/src/libraries-native/CMakeLists.txt deleted file mode 100644 index 65b0d06..0000000 --- a/src/coreclr/src/libraries-native/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(GLOBALIZATION_NATIVE_DIR ${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Globalization.Native) - -# Suppress exporting of the PAL APIs -add_definitions(-DPALEXPORT=EXTERN_C) - -include_directories("${GLOBALIZATION_NATIVE_DIR}") -include_directories("${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/Common") - -add_subdirectory(${GLOBALIZATION_NATIVE_DIR} System.Globalization.Native) - diff --git a/src/coreclr/src/vm/CMakeLists.txt b/src/coreclr/src/vm/CMakeLists.txt index 42da88e..3f2600a 100644 --- a/src/coreclr/src/vm/CMakeLists.txt +++ b/src/coreclr/src/vm/CMakeLists.txt @@ -102,6 +102,7 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON perfmap.cpp perfinfo.cpp pgo.cpp + pinvokeoverride.cpp precode.cpp prestub.cpp profilerdiagnosticprotocolhelper.cpp diff --git a/src/coreclr/src/vm/bundle.cpp b/src/coreclr/src/vm/bundle.cpp index 373ab59..64994aa 100644 --- a/src/coreclr/src/vm/bundle.cpp +++ b/src/coreclr/src/vm/bundle.cpp @@ -30,7 +30,7 @@ const SString &BundleFileLocation::Path() const return Bundle::AppBundle->Path(); } -Bundle::Bundle(LPCSTR bundlePath, BundleProbe *probe) +Bundle::Bundle(LPCSTR bundlePath, BundleProbeFn *probe) { STANDARD_VM_CONTRACT; diff --git a/src/coreclr/src/vm/corelib.cpp b/src/coreclr/src/vm/corelib.cpp index 4562e2e..aaf9bc9 100644 --- a/src/coreclr/src/vm/corelib.cpp +++ b/src/coreclr/src/vm/corelib.cpp @@ -371,9 +371,6 @@ const USHORT c_nCoreLibFieldDescriptions = NumItems(c_rgCoreLibFieldDescriptions // ECalls // -// ECalls defined by libraries-native shims -EXTERN_C const LPVOID gPalGlobalizationNative[]; - // When compiling crossgen, we only need the target version of the ecall tables #if !defined(CROSSGEN_COMPILE) || defined(CROSSGEN_CORELIB) diff --git a/src/coreclr/src/vm/dllimport.cpp b/src/coreclr/src/vm/dllimport.cpp index d9a003f..4cae383 100644 --- a/src/coreclr/src/vm/dllimport.cpp +++ b/src/coreclr/src/vm/dllimport.cpp @@ -34,6 +34,7 @@ #include "strongnameholders.h" #include "ecall.h" #include "fieldmarshaler.h" +#include "pinvokeoverride.h" #include #include "../md/compiler/custattr.h" @@ -4230,7 +4231,7 @@ void NDirect::PopulateNDirectMethodDesc(NDirectMethodDesc* pNMD, PInvokeStaticSi if (callConv == pmCallConvThiscall) ndirectflags |= NDirectMethodDesc::kThisCall; - if (pNMD->GetLoaderModule()->IsSystem() && strcmp(szLibName, "QCall") == 0) + if (pNMD->GetLoaderModule()->IsSystem() && (strcmp(szLibName, "QCall") == 0)) { ndirectflags |= NDirectMethodDesc::kIsQCall; } @@ -6224,7 +6225,6 @@ namespace // this matches exactly the names in Interop.Libraries.cs static const LPCWSTR toRedirect[] = { W("libSystem.Native"), - W("libSystem.IO.Compression.Native"), W("libSystem.Net.Security.Native"), W("libSystem.Security.Cryptography.Native.OpenSsl") }; @@ -6509,6 +6509,15 @@ VOID NDirect::NDirectLink(NDirectMethodDesc *pMD) // Loading unmanaged dlls can trigger dllmains which certainly count as code execution! pMD->EnsureActive(); + { + LPVOID pvTarget = (LPVOID)PInvokeOverride::GetMethodImpl(pMD->GetLibNameRaw(), pMD->GetEntrypointName()); + if (pvTarget != NULL) + { + pMD->SetNDirectTarget(pvTarget); + return; + } + } + LoadLibErrorTracker errorTracker; BOOL fSuccess = FALSE; diff --git a/src/coreclr/src/vm/ecalllist.h b/src/coreclr/src/vm/ecalllist.h index 1546872..3602c02 100644 --- a/src/coreclr/src/vm/ecalllist.h +++ b/src/coreclr/src/vm/ecalllist.h @@ -1139,9 +1139,6 @@ FCClassElement("FileLoadException", "System.IO", gFileLoadExceptionFuncs) FCClassElement("GC", "System", gGCInterfaceFuncs) FCClassElement("GCHandle", "System.Runtime.InteropServices", gGCHandleFuncs) FCClassElement("GCSettings", "System.Runtime", gGCSettingsFuncs) -#ifndef CROSSGEN_COMPILE -FCClassElement("Globalization", "", gPalGlobalizationNative) -#endif #ifdef FEATURE_COMINTEROP FCClassElement("IEnumerable", "System.Collections", gStdMngIEnumerableFuncs) FCClassElement("IEnumerator", "System.Collections", gStdMngIEnumeratorFuncs) diff --git a/src/coreclr/src/vm/pinvokeoverride.cpp b/src/coreclr/src/vm/pinvokeoverride.cpp new file mode 100644 index 0000000..07af650 --- /dev/null +++ b/src/coreclr/src/vm/pinvokeoverride.cpp @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +//***************************************************************************** +// pinvokeoverride.cpp +// +// Helpers to implement PInvoke overriding +// +//***************************************************************************** + +#include "common.h" +#include "pinvokeoverride.h" + +extern "C" const void* GlobalizationResolveDllImport(const char* name); + +static PInvokeOverrideFn* s_overrideImpl = nullptr; + +// here we handle PInvokes whose implementation is always statically linked (even in .so/.dll case) +static const void* DefaultResolveDllImport(const char* libraryName, const char* entrypointName) +{ + if (strcmp(libraryName, "libSystem.Globalization.Native") == 0) + { + return GlobalizationResolveDllImport(entrypointName); + } + + return nullptr; +} + +void PInvokeOverride::SetPInvokeOverride(PInvokeOverrideFn* overrideImpl) +{ + s_overrideImpl = overrideImpl; +} + +const void* PInvokeOverride::GetMethodImpl(const char* libraryName, const char* entrypointName) +{ + if (s_overrideImpl != nullptr) + { + const void* result = s_overrideImpl(libraryName, entrypointName); + if (result != nullptr) + { + LOG((LF_INTEROP, LL_INFO1000, "PInvoke overriden for: lib: %s, entry: %s \n", libraryName, entrypointName)); + return result; + } + } + + return DefaultResolveDllImport(libraryName, entrypointName); +} diff --git a/src/installer/corehost/build.sh b/src/installer/corehost/build.sh index 9766753..d807a9c 100755 --- a/src/installer/corehost/build.sh +++ b/src/installer/corehost/build.sh @@ -116,4 +116,4 @@ setup_dirs check_prereqs # Build the installer native components. -build_native "$__TargetOS" "$__BuildArch" "$__scriptpath" "$__scriptpath" "$__IntermediatesDir" "$__CMakeArgs" "installer component" +build_native "$__TargetOS" "$__BuildArch" "$__scriptpath" "$__IntermediatesDir" "$__CMakeArgs" "installer component" diff --git a/src/installer/corehost/cli/apphost/static/CMakeLists.txt b/src/installer/corehost/cli/apphost/static/CMakeLists.txt index bc91c6f..cf100a7 100644 --- a/src/installer/corehost/cli/apphost/static/CMakeLists.txt +++ b/src/installer/corehost/cli/apphost/static/CMakeLists.txt @@ -35,6 +35,7 @@ add_definitions(-D_NO_ASYNCRTIMP) add_definitions(-D_NO_PPLXIMP) add_definitions(-DEXPORT_SHARED_API=1) add_definitions(-DHOSTPOLICY_EMBEDDED) +add_definitions(-DNATIVE_LIBS_EMBEDDED) include(../../fxr/files.cmake) @@ -106,6 +107,8 @@ if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_AR target_link_libraries(singlefilehost Advapi32.lib shell32.lib) endif() +set(NATIVE_LIBS_EXTRA) + # Path like: artifacts/bin/coreclr/windows.x64.Release/lib or # /root/runtime/artifacts/transport/coreclr/lib set(CORECLR_STATIC_LIB_LOCATION "${CORECLR_ARTIFACTS}/lib") @@ -116,6 +119,7 @@ if(CLR_CMAKE_TARGET_WIN32) set(CORECLR_LIBRARIES ${CORECLR_STATIC_LIB_LOCATION}/coreclr_static.lib ${CORECLR_STATIC_LIB_LOCATION}/System.Globalization.Native.lib + ${CORECLR_STATIC_LIB_LOCATION}/libclrcompression.lib kernel32.lib advapi32.lib ole32.lib @@ -131,11 +135,16 @@ else() set(CORECLR_LIBRARIES ${CORECLR_STATIC_LIB_LOCATION}/libcoreclr_static.a ${CORECLR_STATIC_LIB_LOCATION}/libSystem.Globalization.Native.a + ${CORECLR_STATIC_LIB_LOCATION}/libSystem.IO.Compression.Native.a ${CORECLR_STATIC_LIB_LOCATION}/libpalrt.a ${CORECLR_STATIC_LIB_LOCATION}/libcoreclrpal.a ${CORECLR_STATIC_LIB_LOCATION}/libeventprovider.a ${CORECLR_STATIC_LIB_LOCATION}/libnativeresourcestring.a ) + + # additional requirements for System.IO.Compression.Native + include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake) + append_extra_compression_libs(NATIVE_LIBS_EXTRA) endif() if(CLR_CMAKE_TARGET_OSX) @@ -179,79 +188,32 @@ endif() set(NATIVE_LIBS_LOCATION "${NATIVE_LIBS_ARTIFACTS}") message ("Looking for native libs at location: '${NATIVE_LIBS_LOCATION}'.") -if(NOT CLR_CMAKE_TARGET_LINUX) - set(NATIVE_LIBS - # Native libs linked into singlefilehost is supported only on Linux for now. - # if/when BSD and OSX are supported too, consider the commented code sections below. - ) -else() +# These native libs are linked into singlefilehost only on Linux (for now). +if(CLR_CMAKE_TARGET_LINUX) set(NATIVE_LIBS - ${NATIVE_LIBS_LOCATION}/libSystem.IO.Compression.Native.a ${NATIVE_LIBS_LOCATION}/libSystem.Native.a ${NATIVE_LIBS_LOCATION}/libSystem.Net.Security.Native.a ${NATIVE_LIBS_LOCATION}/libSystem.Security.Cryptography.Native.OpenSsl.a ) - find_package(ZLIB REQUIRED) - - # Additional requirements for System.System.IO.Compression.Native - # - # if (CLR_CMAKE_TARGET_SUNOS) - # set(ZLIB_LIBRARIES z m) - # elseif (CLR_CMAKE_TARGET_UNIX) - # find_package(ZLIB REQUIRED) - # endif () + # Additional requirements for System.Native + include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Native/extra_libs.cmake) + append_extra_system_libs(NATIVE_LIBS_EXTRA) # Additional requirements for System.Net.Security.Native - if (HAVE_GSSFW_HEADERS) - find_library(LIBGSS NAMES GSS) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find GSS.Framework and System.Net.Security.Native cannot build without it. Try installing GSS.Framework (or the appropriate package for your platform)") - endif() - elseif(HAVE_HEIMDAL_HEADERS) - find_library(LIBGSS NAMES gssapi) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find libgssapi and System.Net.Security.Native cannot build without it. Try installing heimdal (or the appropriate package for your platform)") - endif() - else() - find_library(LIBGSS NAMES gssapi_krb5) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find libgssapi_krb5 and System.Net.Security.Native cannot build without it. Try installing libkrb5-dev (or the appropriate package for your platform)") - endif() - endif() - - # Additional requirements for System.Native - if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID) - set(NATIVE_LIBS_EXTRA - rt - ) - # elseif (CLR_CMAKE_TARGET_FREEBSD) - # set(NATIVE_LIBS_EXTRA - # pthread - # ) - # find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) - # if(NOT (INOTIFY_LIBRARY STREQUAL INOTIFY_LIBRARY-NOTFOUND)) - # LIST(APPEND NATIVE_LIBS_EXTRA - # ${INOTIFY_LIBRARY} - # ) - # endif () - # elseif (CLR_CMAKE_TARGET_SUNOS) - # set(NATIVE_LIBS_EXTRA - # socket - # ) - endif () + include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Net.Security.Native/extra_libs.cmake) + append_extra_security_libs(NATIVE_LIBS_EXTRA) # Additional requirements for System.Security.Cryptography.Native.OpenSsl - if(NOT FEATURE_DISTRO_AGNOSTIC_SSL) - find_package(OpenSSL) - endif() + include(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix/System.Security.Cryptography.Native/extra_libs.cmake) + append_extra_cryptography_libs(NATIVE_LIBS_EXTRA) +endif() - if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -Wl,--whole-archive) - set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) - endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) -endif(NOT CLR_CMAKE_TARGET_LINUX) +if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) + # These options are used to force every object to be included even if it's unused. + set(START_WHOLE_ARCHIVE -Wl,--whole-archive) + set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) +endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) set_property(TARGET singlefilehost PROPERTY ENABLE_EXPORTS 1) @@ -262,15 +224,5 @@ target_link_libraries(singlefilehost ${NATIVE_LIBS} ${END_WHOLE_ARCHIVE} - ${ZLIB_LIBRARIES} - ${LIBGSS} ${NATIVE_LIBS_EXTRA} - ) - -if(NOT FEATURE_DISTRO_AGNOSTIC_SSL) - target_link_libraries(singlefilehost - ${OPENSSL_CRYPTO_LIBRARY} - ${OPENSSL_SSL_LIBRARY} - ) -endif() diff --git a/src/installer/corehost/cli/hostpolicy/coreclr.cpp b/src/installer/corehost/cli/hostpolicy/coreclr.cpp index d9564ac..0046d66 100644 --- a/src/installer/corehost/cli/hostpolicy/coreclr.cpp +++ b/src/installer/corehost/cli/hostpolicy/coreclr.cpp @@ -148,7 +148,8 @@ namespace _X("APP_NI_PATHS"), _X("RUNTIME_IDENTIFIER"), _X("BUNDLE_PROBE"), - _X("HOSTPOLICY_EMBEDDED") + _X("HOSTPOLICY_EMBEDDED"), + _X("PINVOKE_OVERRIDE") }; static_assert((sizeof(PropertyNameMapping) / sizeof(*PropertyNameMapping)) == static_cast(common_property::Last), "Invalid property count"); diff --git a/src/installer/corehost/cli/hostpolicy/coreclr.h b/src/installer/corehost/cli/hostpolicy/coreclr.h index c086ba5..72b6742 100644 --- a/src/installer/corehost/cli/hostpolicy/coreclr.h +++ b/src/installer/corehost/cli/hostpolicy/coreclr.h @@ -67,6 +67,7 @@ enum class common_property RuntimeIdentifier, BundleProbe, HostPolicyEmbedded, + PInvokeOverride, // Sentinel value - new values should be defined above Last }; diff --git a/src/installer/corehost/cli/hostpolicy/hostpolicy_context.cpp b/src/installer/corehost/cli/hostpolicy/hostpolicy_context.cpp index 48d7cd3..aba6272 100644 --- a/src/installer/corehost/cli/hostpolicy/hostpolicy_context.cpp +++ b/src/installer/corehost/cli/hostpolicy/hostpolicy_context.cpp @@ -42,6 +42,28 @@ namespace return bundle::runner_t::app()->probe(file_path, offset, size); } + +#if defined(NATIVE_LIBS_EMBEDDED) + extern "C" const void* CompressionResolveDllImport(const char* name); + +#if defined(_WIN32) +#define COMPRESSION_DLL_NAME "clrcompression" +#else +#define COMPRESSION_DLL_NAME "libSystem.IO.Compression.Native" +#endif + + // pinvoke_override: + // Check if given function belongs to one of statically linked libraries and return a pointer if found. + const void* STDMETHODCALLTYPE pinvoke_override(const char* libraryName, const char* entrypointName) + { + if (strcmp(libraryName, COMPRESSION_DLL_NAME) == 0) + { + return CompressionResolveDllImport(entrypointName); + } + + return nullptr; + } +#endif } int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const arguments_t &args, bool enable_breadcrumbs) @@ -241,6 +263,22 @@ int hostpolicy_context_t::initialize(hostpolicy_init_t &hostpolicy_init, const a } } +#if defined(NATIVE_LIBS_EMBEDDED) + // PInvoke Override + if (bundle::info_t::is_single_file_bundle()) + { + // Encode the pinvoke_override function pointer as a string, and pass it to the runtime. + pal::stringstream_t ptr_stream; + ptr_stream << "0x" << std::hex << (size_t)(&pinvoke_override); + + if (!coreclr_properties.add(common_property::PInvokeOverride, ptr_stream.str().c_str())) + { + log_duplicate_property_error(coreclr_property_bag_t::common_property_to_string(common_property::StartUpHooks)); + return StatusCode::LibHostDuplicateProperty; + } + } +#endif + #if defined(HOSTPOLICY_EMBEDDED) if (!coreclr_properties.add(common_property::HostPolicyEmbedded, _X("true"))) { diff --git a/src/installer/corehost/tryrun.cmake b/src/installer/corehost/tryrun.cmake deleted file mode 100644 index eba94ae..0000000 --- a/src/installer/corehost/tryrun.cmake +++ /dev/null @@ -1,28 +0,0 @@ -set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) -set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) - -macro(set_cache_value) - set(${ARGV0} ${ARGV1} CACHE STRING "Result from TRY_RUN" FORCE) - set(${ARGV0}__TRYRUN_OUTPUT "dummy output" CACHE STRING "Output from TRY_RUN" FORCE) -endmacro() - -if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR - EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR - EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) - - set(ALPINE_LINUX 1) -elseif(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) - set(FREEBSD 1) - set(CMAKE_SYSTEM_NAME FreeBSD) - set(CLR_CMAKE_TARGET_OS FreeBSD) -elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc) - set(ILLUMOS 1) -endif() - -if(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS) - if(ILLUMOS) - set_cache_value(COMPILER_SUPPORTS_W_CLASS_MEMACCESS 0) - endif() -else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") -endif() diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props index 7d742fd..036716c 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props @@ -15,14 +15,12 @@ - - diff --git a/src/libraries/Common/src/Interop/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Interop.Libraries.cs index 2178527..e57d591 100644 --- a/src/libraries/Common/src/Interop/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Interop.Libraries.cs @@ -5,6 +5,6 @@ internal static partial class Interop { internal static partial class Libraries { - internal const string GlobalizationNative = "QCall"; + internal const string GlobalizationNative = "libSystem.Globalization.Native"; } } diff --git a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs index 6b1006c..4893a28 100644 --- a/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs +++ b/src/libraries/Common/src/Interop/Windows/Interop.Libraries.cs @@ -31,7 +31,7 @@ internal static partial class Interop internal const string Wldap32 = "wldap32.dll"; internal const string Ws2_32 = "ws2_32.dll"; internal const string Wtsapi32 = "wtsapi32.dll"; - internal const string CompressionNative = "clrcompression.dll"; + internal const string CompressionNative = "clrcompression"; internal const string MsQuic = "msquic.dll"; internal const string HostPolicy = "hostpolicy.dll"; } diff --git a/src/libraries/Native/AnyOS/System.IO.Compression.Native/entrypoints.c b/src/libraries/Native/AnyOS/System.IO.Compression.Native/entrypoints.c new file mode 100644 index 0000000..b194b97 --- /dev/null +++ b/src/libraries/Native/AnyOS/System.IO.Compression.Native/entrypoints.c @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#include "../../AnyOS/entrypoints.h" + +// Include System.IO.Compression.Native headers +#include "../zlib/pal_zlib.h" +#include "../brotli/include/brotli/decode.h" +#include "../brotli/include/brotli/encode.h" +#include "../brotli/include/brotli/port.h" +#include "../brotli/include/brotli/types.h" + +#include "../../AnyOS/entrypoints.h" + +static const Entry s_compressionNative[] = +{ + DllImportEntry(BrotliDecoderCreateInstance) + DllImportEntry(BrotliDecoderDecompress) + DllImportEntry(BrotliDecoderDecompressStream) + DllImportEntry(BrotliDecoderDestroyInstance) + DllImportEntry(BrotliDecoderIsFinished) + DllImportEntry(BrotliEncoderCompress) + DllImportEntry(BrotliEncoderCompressStream) + DllImportEntry(BrotliEncoderCreateInstance) + DllImportEntry(BrotliEncoderDestroyInstance) + DllImportEntry(BrotliEncoderHasMoreOutput) + DllImportEntry(BrotliEncoderSetParameter) + DllImportEntry(CompressionNative_Crc32) + DllImportEntry(CompressionNative_Deflate) + DllImportEntry(CompressionNative_DeflateEnd) + DllImportEntry(CompressionNative_DeflateInit2_) + DllImportEntry(CompressionNative_Inflate) + DllImportEntry(CompressionNative_InflateEnd) + DllImportEntry(CompressionNative_InflateInit2_) +}; + +EXTERN_C const void* CompressionResolveDllImport(const char* name); + +EXTERN_C const void* CompressionResolveDllImport(const char* name) +{ + return ResolveDllImport(s_compressionNative, lengthof(s_compressionNative), name); +} diff --git a/src/libraries/Native/AnyOS/entrypoints.h b/src/libraries/Native/AnyOS/entrypoints.h new file mode 100644 index 0000000..ce7a7e2 --- /dev/null +++ b/src/libraries/Native/AnyOS/entrypoints.h @@ -0,0 +1,34 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +#pragma once + +#include +#include + +#ifndef lengthof +#define lengthof(rg) (sizeof(rg)/sizeof(rg[0])) +#endif + +typedef struct +{ + const char* name; + const void* method; +} Entry; + +// expands to: {"impl", (void*)impl}, +#define DllImportEntry(impl) \ + {#impl, (void*)impl}, + +static const void* ResolveDllImport(const Entry* resolutionTable, size_t tableLength, const char* name) +{ + for (size_t i = 0; i < tableLength; i++) + { + if (strcmp(name, resolutionTable[i].name) == 0) + { + return resolutionTable[i].method; + } + } + + return NULL; +} diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 3bc41e4..ebc9ff3 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -54,15 +54,27 @@ if (PRERELEASE) add_compile_options(-Werror) endif() +if(STATIC_LIBS_ONLY) + # Suppress exporting of the PAL APIs + add_definitions(-DPALEXPORT=EXTERN_C) + + set(STATIC_LIB_DESTINATION lib) + set(GEN_SHARED_LIB 0) +else() + set(STATIC_LIB_DESTINATION .) + set(GEN_SHARED_LIB 1) +endif() + if(CLR_CMAKE_TARGET_BROWSER) # The emscripten build has additional warnings so -Werror breaks add_compile_options(-Wno-unused-parameter) add_compile_options(-Wno-unused-function) add_compile_options(-Wno-alloca) add_compile_options(-Wno-implicit-int-float-conversion) -else() - set(GEN_SHARED_LIB 1) -endif(CLR_CMAKE_TARGET_BROWSER) + + set(GEN_SHARED_LIB 0) + set(STATIC_LIB_DESTINATION .) +endif() if (CLR_CMAKE_TARGET_ARCH_AMD64) add_definitions(-DTARGET_64BIT=1) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/entrypoints.c b/src/libraries/Native/Unix/System.Globalization.Native/entrypoints.c index 7a7f5ea..85a3908 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/entrypoints.c +++ b/src/libraries/Native/Unix/System.Globalization.Native/entrypoints.c @@ -1,7 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#include +#include "../../AnyOS/entrypoints.h" typedef uint16_t UChar; @@ -17,45 +17,47 @@ typedef uint16_t UChar; #include "pal_normalization.h" #include "pal_timeZoneInfo.h" -#define FCFuncStart(name) EXTERN_C const void* name[]; const void* name[] = { -#define FCFuncEnd() (void*)0x01 /* FCFuncFlag_EndOfArray */ }; +static const Entry s_globalizationNative[] = +{ + DllImportEntry(GlobalizationNative_ChangeCase) + DllImportEntry(GlobalizationNative_ChangeCaseInvariant) + DllImportEntry(GlobalizationNative_ChangeCaseTurkish) + DllImportEntry(GlobalizationNative_CloseSortHandle) + DllImportEntry(GlobalizationNative_CompareString) + DllImportEntry(GlobalizationNative_EndsWith) + DllImportEntry(GlobalizationNative_EnumCalendarInfo) + DllImportEntry(GlobalizationNative_GetCalendarInfo) + DllImportEntry(GlobalizationNative_GetCalendars) + DllImportEntry(GlobalizationNative_GetDefaultLocaleName) + DllImportEntry(GlobalizationNative_GetICUVersion) + DllImportEntry(GlobalizationNative_GetJapaneseEraStartDate) + DllImportEntry(GlobalizationNative_GetLatestJapaneseEra) + DllImportEntry(GlobalizationNative_GetLocaleInfoGroupingSizes) + DllImportEntry(GlobalizationNative_GetLocaleInfoInt) + DllImportEntry(GlobalizationNative_GetLocaleInfoString) + DllImportEntry(GlobalizationNative_GetLocaleName) + DllImportEntry(GlobalizationNative_GetLocales) + DllImportEntry(GlobalizationNative_GetLocaleTimeFormat) + DllImportEntry(GlobalizationNative_GetSortHandle) + DllImportEntry(GlobalizationNative_GetSortKey) + DllImportEntry(GlobalizationNative_GetSortVersion) + DllImportEntry(GlobalizationNative_GetTimeZoneDisplayName) + DllImportEntry(GlobalizationNative_IndexOf) + DllImportEntry(GlobalizationNative_InitICUFunctions) + DllImportEntry(GlobalizationNative_InitOrdinalCasingPage) + DllImportEntry(GlobalizationNative_IsNormalized) + DllImportEntry(GlobalizationNative_IsPredefinedLocale) + DllImportEntry(GlobalizationNative_LastIndexOf) + DllImportEntry(GlobalizationNative_LoadICU) + DllImportEntry(GlobalizationNative_NormalizeString) + DllImportEntry(GlobalizationNative_StartsWith) + DllImportEntry(GlobalizationNative_ToAscii) + DllImportEntry(GlobalizationNative_ToUnicode) +}; -#define QCFuncElement(name,impl) \ - (void*)0x8 /* FCFuncFlag_QCall */, (void*)(impl), (void*)name, +EXTERN_C const void* GlobalizationResolveDllImport(const char* name); -FCFuncStart(gPalGlobalizationNative) - QCFuncElement("ChangeCase", GlobalizationNative_ChangeCase) - QCFuncElement("ChangeCaseInvariant", GlobalizationNative_ChangeCaseInvariant) - QCFuncElement("ChangeCaseTurkish", GlobalizationNative_ChangeCaseTurkish) - QCFuncElement("CloseSortHandle", GlobalizationNative_CloseSortHandle) - QCFuncElement("CompareString", GlobalizationNative_CompareString) - QCFuncElement("EndsWith", GlobalizationNative_EndsWith) - QCFuncElement("EnumCalendarInfo", GlobalizationNative_EnumCalendarInfo) - QCFuncElement("GetCalendarInfo", GlobalizationNative_GetCalendarInfo) - QCFuncElement("GetCalendars", GlobalizationNative_GetCalendars) - QCFuncElement("GetDefaultLocaleName", GlobalizationNative_GetDefaultLocaleName) - QCFuncElement("GetICUVersion", GlobalizationNative_GetICUVersion) - QCFuncElement("GetJapaneseEraStartDate", GlobalizationNative_GetJapaneseEraStartDate) - QCFuncElement("GetLatestJapaneseEra", GlobalizationNative_GetLatestJapaneseEra) - QCFuncElement("GetLocaleInfoGroupingSizes", GlobalizationNative_GetLocaleInfoGroupingSizes) - QCFuncElement("GetLocaleInfoInt", GlobalizationNative_GetLocaleInfoInt) - QCFuncElement("GetLocaleInfoString", GlobalizationNative_GetLocaleInfoString) - QCFuncElement("GetLocaleName", GlobalizationNative_GetLocaleName) - QCFuncElement("GetLocales", GlobalizationNative_GetLocales) - QCFuncElement("GetLocaleTimeFormat", GlobalizationNative_GetLocaleTimeFormat) - QCFuncElement("GetSortHandle", GlobalizationNative_GetSortHandle) - QCFuncElement("GetSortKey", GlobalizationNative_GetSortKey) - QCFuncElement("GetSortVersion", GlobalizationNative_GetSortVersion) - QCFuncElement("GetTimeZoneDisplayName", GlobalizationNative_GetTimeZoneDisplayName) - QCFuncElement("IndexOf", GlobalizationNative_IndexOf) - QCFuncElement("InitICUFunctions", GlobalizationNative_InitICUFunctions) - QCFuncElement("InitOrdinalCasingPage", GlobalizationNative_InitOrdinalCasingPage) - QCFuncElement("IsNormalized", GlobalizationNative_IsNormalized) - QCFuncElement("IsPredefinedLocale", GlobalizationNative_IsPredefinedLocale) - QCFuncElement("LastIndexOf", GlobalizationNative_LastIndexOf) - QCFuncElement("LoadICU", GlobalizationNative_LoadICU) - QCFuncElement("NormalizeString", GlobalizationNative_NormalizeString) - QCFuncElement("StartsWith", GlobalizationNative_StartsWith) - QCFuncElement("ToAscii", GlobalizationNative_ToAscii) - QCFuncElement("ToUnicode", GlobalizationNative_ToUnicode) -FCFuncEnd() +EXTERN_C const void* GlobalizationResolveDllImport(const char* name) +{ + return ResolveDllImport(s_globalizationNative, lengthof(s_globalizationNative), name); +} diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index dcd1d87..28f57b4 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -2,14 +2,12 @@ project(System.IO.Compression.Native C) if (CLR_CMAKE_TARGET_BROWSER) add_definitions(-s USE_ZLIB) -elseif (CLR_CMAKE_TARGET_ANDROID) - # need special case here since we want to link against libz.so but find_package() would resolve libz.a - set(ZLIB_LIBRARIES z) -elseif (CLR_CMAKE_TARGET_SUNOS) - set(ZLIB_LIBRARIES z m) -else () - find_package(ZLIB REQUIRED) -endif () +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) + +set(NATIVE_LIBS_EXTRA) +append_extra_compression_libs(NATIVE_LIBS_EXTRA) set(NATIVECOMPRESSION_SOURCES ../../AnyOS/zlib/pal_zlib.c @@ -52,6 +50,7 @@ if (NOT CLR_CMAKE_TARGET_BROWSER) ../../AnyOS/brotli/enc/metablock.c ../../AnyOS/brotli/enc/static_dict.c ../../AnyOS/brotli/enc/utf8_util.c + ../../AnyOS/System.IO.Compression.Native/entrypoints.c ) # Disable implicit fallthrough warning for Brotli @@ -66,7 +65,7 @@ if (GEN_SHARED_LIB) ) target_link_libraries(System.IO.Compression.Native - ${ZLIB_LIBRARIES} + ${NATIVE_LIBS_EXTRA} ) install_with_stripped_symbols (System.IO.Compression.Native PROGRAMS .) endif () @@ -78,4 +77,4 @@ add_library(System.IO.Compression.Native-Static set_target_properties(System.IO.Compression.Native-Static PROPERTIES OUTPUT_NAME System.IO.Compression.Native CLEAN_DIRECT_OUTPUT 1) -install (TARGETS System.IO.Compression.Native-Static DESTINATION .) +install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake b/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake new file mode 100644 index 0000000..f4c7dcd --- /dev/null +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/extra_libs.cmake @@ -0,0 +1,14 @@ + +macro(append_extra_compression_libs NativeLibsExtra) + if (CLR_CMAKE_TARGET_BROWSER) + # nothing special to link + elseif (CLR_CMAKE_TARGET_ANDROID) + # need special case here since we want to link against libz.so but find_package() would resolve libz.a + set(ZLIB_LIBRARIES z) + elseif (CLR_CMAKE_TARGET_SUNOS) + set(ZLIB_LIBRARIES z m) + else () + find_package(ZLIB REQUIRED) + endif () + list(APPEND ${NativeLibsExtra} ${ZLIB_LIBRARIES}) +endmacro() diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt index 1750a07..ede4480 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt @@ -1,11 +1,13 @@ project(System.IO.Ports.Native C) -add_library(System.IO.Ports.Native - SHARED - pal_termios.c - pal_serial.c - ${VERSION_FILE_PATH} -) +if (GEN_SHARED_LIB) + add_library(System.IO.Ports.Native + SHARED + pal_termios.c + pal_serial.c + ${VERSION_FILE_PATH} + ) +endif() add_library(System.IO.Ports.Native-Static STATIC @@ -15,5 +17,8 @@ add_library(System.IO.Ports.Native-Static set_target_properties(System.IO.Ports.Native-Static PROPERTIES OUTPUT_NAME System.IO.Ports.Native CLEAN_DIRECT_OUTPUT 1) -install_with_stripped_symbols (System.IO.Ports.Native PROGRAMS .) -install (TARGETS System.IO.Ports.Native-Static DESTINATION .) +if (GEN_SHARED_LIB) + install_with_stripped_symbols (System.IO.Ports.Native PROGRAMS .) +endif() + +install (TARGETS System.IO.Ports.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index 517628d..d41bb80 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -53,23 +53,22 @@ elseif (CLR_CMAKE_TARGET_FREEBSD) endif () endif () +include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) + +set(NATIVE_LIBS_EXTRA) +append_extra_system_libs(NATIVE_LIBS_EXTRA) + if (GEN_SHARED_LIB) add_library(System.Native SHARED ${NATIVE_SOURCES} ${VERSION_FILE_PATH} ) - if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID) - target_link_libraries(System.Native rt) - elseif (CLR_CMAKE_TARGET_FREEBSD) - target_link_libraries(System.Native pthread) - if (HAVE_INOTIFY) - find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) - target_link_libraries(System.Native ${INOTIFY_LIBRARY}) - endif () - elseif (CLR_CMAKE_TARGET_SUNOS) - target_link_libraries(System.Native socket) - endif () + + target_link_libraries(System.Native + ${NATIVE_LIBS_EXTRA} + ) + install_with_stripped_symbols (System.Native PROGRAMS .) endif () @@ -78,10 +77,6 @@ add_library(System.Native-Static ${NATIVE_SOURCES} ) -if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) - target_link_libraries(System.Native "-framework Foundation") -endif () - set_target_properties(System.Native-Static PROPERTIES OUTPUT_NAME System.Native CLEAN_DIRECT_OUTPUT 1) -install (TARGETS System.Native-Static DESTINATION .) +install (TARGETS System.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.Native/extra_libs.cmake b/src/libraries/Native/Unix/System.Native/extra_libs.cmake new file mode 100644 index 0000000..b0cb4c1 --- /dev/null +++ b/src/libraries/Native/Unix/System.Native/extra_libs.cmake @@ -0,0 +1,18 @@ + +macro(append_extra_system_libs NativeLibsExtra) + if (CLR_CMAKE_TARGET_LINUX AND NOT CLR_CMAKE_TARGET_ANDROID) + list(APPEND ${NativeLibsExtra} rt) + elseif (CLR_CMAKE_TARGET_FREEBSD) + list(APPEND ${NativeLibsExtra} pthread) + if (HAVE_INOTIFY) + find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) + list(APPEND ${NativeLibsExtra} ${INOTIFY_LIBRARY}) + endif () + elseif (CLR_CMAKE_TARGET_SUNOS) + list(APPEND ${NativeLibsExtra} socket) + endif () + + if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + list(APPEND ${NativeLibsExtra} "-framework Foundation") + endif () +endmacro() diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt index 6514f0e..bdc1678 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt @@ -2,34 +2,22 @@ project(System.Net.Security.Native C) add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers) -if (HAVE_GSSFW_HEADERS) - find_library(LIBGSS NAMES GSS) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find GSS.Framework and System.Net.Security.Native cannot build without it. Try installing GSS.Framework (or the appropriate package for your platform)") - endif() -elseif(HAVE_HEIMDAL_HEADERS) - find_library(LIBGSS NAMES gssapi) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find libgssapi and System.Net.Security.Native cannot build without it. Try installing heimdal (or the appropriate package for your platform)") - endif() -elseif(HeimdalGssApi) - message(FATAL_ERROR "HeimdalGssApi option was set but gssapi headers could not be found and System.Net.Security.Native cannot build without the headers. Try installing heimdal (or the appropriate package for your platform)") -else() - find_library(LIBGSS NAMES gssapi_krb5) - if(LIBGSS STREQUAL LIBGSS-NOTFOUND) - message(FATAL_ERROR "Cannot find libgssapi_krb5 and System.Net.Security.Native cannot build without it. Try installing libkrb5-dev (or the appropriate package for your platform)") - endif() -endif() +include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) + +set(NATIVE_LIBS_EXTRA) +append_extra_security_libs(NATIVE_LIBS_EXTRA) set(NATIVEGSS_SOURCES pal_gssapi.c ) -add_library(System.Net.Security.Native - SHARED - ${NATIVEGSS_SOURCES} - ${VERSION_FILE_PATH} -) +if (GEN_SHARED_LIB) + add_library(System.Net.Security.Native + SHARED + ${NATIVEGSS_SOURCES} + ${VERSION_FILE_PATH} + ) +endif() add_library(System.Net.Security.Native-Static STATIC @@ -38,9 +26,12 @@ add_library(System.Net.Security.Native-Static set_target_properties(System.Net.Security.Native-Static PROPERTIES OUTPUT_NAME System.Net.Security.Native CLEAN_DIRECT_OUTPUT 1) -target_link_libraries(System.Net.Security.Native - ${LIBGSS} -) +if (GEN_SHARED_LIB) + target_link_libraries(System.Net.Security.Native + ${NATIVE_LIBS_EXTRA} + ) + + install_with_stripped_symbols (System.Net.Security.Native PROGRAMS .) +endif() -install_with_stripped_symbols (System.Net.Security.Native PROGRAMS .) -install (TARGETS System.Net.Security.Native-Static DESTINATION .) +install (TARGETS System.Net.Security.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/extra_libs.cmake b/src/libraries/Native/Unix/System.Net.Security.Native/extra_libs.cmake new file mode 100644 index 0000000..49c6ff4 --- /dev/null +++ b/src/libraries/Native/Unix/System.Net.Security.Native/extra_libs.cmake @@ -0,0 +1,23 @@ + +macro(append_extra_security_libs NativeLibsExtra) + if (HAVE_GSSFW_HEADERS) + find_library(LIBGSS NAMES GSS) + if(LIBGSS STREQUAL LIBGSS-NOTFOUND) + message(FATAL_ERROR "Cannot find GSS.Framework and System.Net.Security.Native cannot build without it. Try installing GSS.Framework (or the appropriate package for your platform)") + endif() + elseif(HAVE_HEIMDAL_HEADERS) + find_library(LIBGSS NAMES gssapi) + if(LIBGSS STREQUAL LIBGSS-NOTFOUND) + message(FATAL_ERROR "Cannot find libgssapi and System.Net.Security.Native cannot build without it. Try installing heimdal (or the appropriate package for your platform)") + endif() + elseif(HeimdalGssApi) + message(FATAL_ERROR "HeimdalGssApi option was set but gssapi headers could not be found and System.Net.Security.Native cannot build without the headers. Try installing heimdal (or the appropriate package for your platform)") + else() + find_library(LIBGSS NAMES gssapi_krb5) + if(LIBGSS STREQUAL LIBGSS-NOTFOUND) + message(FATAL_ERROR "Cannot find libgssapi_krb5 and System.Net.Security.Native cannot build without it. Try installing libkrb5-dev (or the appropriate package for your platform)") + endif() + endif() + + list(APPEND ${NativeLibsExtra} ${LIBGSS}) +endmacro() diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h index cd7ff85..5c1fe55 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h +++ b/src/libraries/Native/Unix/System.Net.Security.Native/pal_gssapi.h @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. #pragma once +#include "pal_config.h" #include "pal_compiler.h" #if HAVE_GSSFW_HEADERS || HAVE_HEIMDAL_HEADERS diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt index 5a424ab..d8e985d 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -29,11 +29,13 @@ if (CLR_CMAKE_TARGET_TVOS) add_definitions(-DTARGET_TVOS) endif() -add_library(System.Security.Cryptography.Native.Apple - SHARED - ${NATIVECRYPTO_SOURCES} - ${VERSION_FILE_PATH} -) +if (GEN_SHARED_LIB) + add_library(System.Security.Cryptography.Native.Apple + SHARED + ${NATIVECRYPTO_SOURCES} + ${VERSION_FILE_PATH} + ) +endif() add_library(System.Security.Cryptography.Native.Apple-Static STATIC @@ -42,10 +44,15 @@ add_library(System.Security.Cryptography.Native.Apple-Static set_target_properties(System.Security.Cryptography.Native.Apple-Static PROPERTIES OUTPUT_NAME System.Security.Cryptography.Native.Apple CLEAN_DIRECT_OUTPUT 1) -target_link_libraries(System.Security.Cryptography.Native.Apple - ${COREFOUNDATION_LIBRARY} - ${SECURITY_LIBRARY} -) +if (GEN_SHARED_LIB) + target_link_libraries(System.Security.Cryptography.Native.Apple + ${COREFOUNDATION_LIBRARY} + ${SECURITY_LIBRARY} + ) +endif() + +if (GEN_SHARED_LIB) + install_with_stripped_symbols (System.Security.Cryptography.Native.Apple PROGRAMS .) +endif() -install_with_stripped_symbols (System.Security.Cryptography.Native.Apple PROGRAMS .) -install (TARGETS System.Security.Cryptography.Native.Apple-Static DESTINATION .) +install (TARGETS System.Security.Cryptography.Native.Apple-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt index e59120b..2ca4f23 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt @@ -8,34 +8,10 @@ add_compile_options(-Wno-used-but-marked-unused) add_definitions(-DOPENSSL_API_COMPAT=0x10100000L) -if(CMAKE_STATIC_LIB_LINK) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) -endif(CMAKE_STATIC_LIB_LINK) - -if(CLR_CMAKE_TARGET_ANDROID AND NOT CROSS_ROOTFS) - # TEMP: consume OpenSSL dependencies from external sources via env. variables - set(OPENSSL_FOUND 1) - set(OPENSSL_INCLUDE_DIR $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/include) - if(CLR_CMAKE_TARGET_ARCH_ARM64) - set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.arm64-v8a/libcrypto.so) - set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.arm64-v8a/libssl.so) - elseif(CLR_CMAKE_TARGET_ARCH_ARM) - set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.armeabi-v7a/libcrypto.so) - set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.armeabi-v7a/libssl.so) - elseif(CLR_CMAKE_TARGET_ARCH_I386) - set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.x86/libcrypto.so) - set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.x86/libssl.so) - else() - set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.x86_64/libcrypto.so) - set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.x86_64/libssl.so) - endif() -else() - find_package(OpenSSL) -endif() +include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake) -if(NOT OPENSSL_FOUND) - message(FATAL_ERROR "!!! Cannot find libssl and System.Security.Cryptography.Native cannot build without it. Try installing libssl-dev (on Linux, but this may vary by distro) or openssl (on macOS) !!!. See the requirements document for your specific operating system: https://github.com/dotnet/runtime/tree/master/docs/workflow/requirements.") -endif(NOT OPENSSL_FOUND) +set(NATIVE_LIBS_EXTRA) +append_extra_cryptography_libs(NATIVE_LIBS_EXTRA) include_directories(${OPENSSL_INCLUDE_DIR}) @@ -84,10 +60,12 @@ endif() add_library(objlib OBJECT ${NATIVECRYPTO_SOURCES} ${VERSION_FILE_PATH}) -add_library(System.Security.Cryptography.Native.OpenSsl - SHARED - $ -) +if (GEN_SHARED_LIB) + add_library(System.Security.Cryptography.Native.OpenSsl + SHARED + $ + ) +endif() add_library(System.Security.Cryptography.Native.OpenSsl-Static STATIC @@ -96,34 +74,33 @@ add_library(System.Security.Cryptography.Native.OpenSsl-Static set_target_properties(System.Security.Cryptography.Native.OpenSsl-Static PROPERTIES OUTPUT_NAME System.Security.Cryptography.Native.OpenSsl CLEAN_DIRECT_OUTPUT 1) -if (FEATURE_DISTRO_AGNOSTIC_SSL) - # on macOS the link step fails with undefined symbols, and the script doesn't run. - # if the build succeeds, the script would succeed, except it uses a Linux-only command. - # - # on Linux, the build will succeed with undefined symbols, then the script reports them - # and fails the build for us. - if (NOT APPLE) - add_custom_command(TARGET System.Security.Cryptography.Native.OpenSsl POST_BUILD - COMMENT "Verifying System.Security.Cryptography.Native.OpenSsl.so dependencies" - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh - $ - "Verification failed. System.Security.Cryptography.Native.OpenSsl.so has undefined dependencies. These are likely OpenSSL APIs that need to be added to opensslshim.h" - VERBATIM - ) +if (GEN_SHARED_LIB) + if (FEATURE_DISTRO_AGNOSTIC_SSL) + # on macOS the link step fails with undefined symbols, and the script doesn't run. + # if the build succeeds, the script would succeed, except it uses a Linux-only command. + # + # on Linux, the build will succeed with undefined symbols, then the script reports them + # and fails the build for us. + if (NOT APPLE) + add_custom_command(TARGET System.Security.Cryptography.Native.OpenSsl POST_BUILD + COMMENT "Verifying System.Security.Cryptography.Native.OpenSsl.so dependencies" + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../verify-so.sh + $ + "Verification failed. System.Security.Cryptography.Native.OpenSsl.so has undefined dependencies. These are likely OpenSSL APIs that need to be added to opensslshim.h" + VERBATIM + ) + endif() endif() - # Link with libdl.so to get the dlopen / dlsym / dlclose - target_link_libraries(System.Security.Cryptography.Native.OpenSsl - dl - ) -else() target_link_libraries(System.Security.Cryptography.Native.OpenSsl - ${OPENSSL_CRYPTO_LIBRARY} - ${OPENSSL_SSL_LIBRARY} + ${NATIVE_LIBS_EXTRA} ) endif() include(configure.cmake) -install_with_stripped_symbols (System.Security.Cryptography.Native.OpenSsl PROGRAMS .) -install (TARGETS System.Security.Cryptography.Native.OpenSsl-Static DESTINATION .) +if (GEN_SHARED_LIB) + install_with_stripped_symbols (System.Security.Cryptography.Native.OpenSsl PROGRAMS .) +endif() + +install (TARGETS System.Security.Cryptography.Native.OpenSsl-Static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/extra_libs.cmake b/src/libraries/Native/Unix/System.Security.Cryptography.Native/extra_libs.cmake new file mode 100644 index 0000000..9d7521f --- /dev/null +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/extra_libs.cmake @@ -0,0 +1,39 @@ + +macro(append_extra_cryptography_libs NativeLibsExtra) + if(CMAKE_STATIC_LIB_LINK) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a) + endif(CMAKE_STATIC_LIB_LINK) + + if(CLR_CMAKE_TARGET_ANDROID AND NOT CROSS_ROOTFS) + # TEMP: consume OpenSSL dependencies from external sources via env. variables + set(OPENSSL_FOUND 1) + set(OPENSSL_INCLUDE_DIR $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/include) + if(CLR_CMAKE_TARGET_ARCH_ARM64) + set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.arm64-v8a/libcrypto.so) + set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.arm64-v8a/libssl.so) + elseif(CLR_CMAKE_TARGET_ARCH_ARM) + set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.armeabi-v7a/libcrypto.so) + set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.armeabi-v7a/libssl.so) + elseif(CLR_CMAKE_TARGET_ARCH_I386) + set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.x86/libcrypto.so) + set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.x86/libssl.so) + else() + set(OPENSSL_CRYPTO_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/crypto/libs/android.x86_64/libcrypto.so) + set(OPENSSL_SSL_LIBRARY $ENV{ANDROID_OPENSSL_AAR}/prefab/modules/ssl/libs/android.x86_64/libssl.so) + endif() + else() + find_package(OpenSSL) + endif() + + if(NOT OPENSSL_FOUND) + message(FATAL_ERROR "!!! Cannot find libssl and System.Security.Cryptography.Native cannot build without it. Try installing libssl-dev (on Linux, but this may vary by distro) or openssl (on macOS) !!!. See the requirements document for your specific operating system: https://github.com/dotnet/runtime/tree/master/docs/workflow/requirements.") + endif(NOT OPENSSL_FOUND) + + + if (FEATURE_DISTRO_AGNOSTIC_SSL) + # Link with libdl.so to get the dlopen / dlsym / dlclose + list(APPEND ${NativeLibsExtra} dl) + else() + list(APPEND ${NativeLibsExtra} ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY}) + endif() +endmacro() diff --git a/src/libraries/Native/Unix/tryrun.cmake b/src/libraries/Native/Unix/tryrun.cmake deleted file mode 100644 index adb1862..0000000 --- a/src/libraries/Native/Unix/tryrun.cmake +++ /dev/null @@ -1,42 +0,0 @@ -set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH}) -set(CROSS_ROOTFS $ENV{ROOTFS_DIR}) - -macro(set_cache_value) - set(${ARGV0} ${ARGV1} CACHE STRING "Result from TRY_RUN" FORCE) - set(${ARGV0}__TRYRUN_OUTPUT "dummy output" CACHE STRING "Output from TRY_RUN" FORCE) -endmacro() - -if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv7-alpine-linux-musleabihf OR - EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf OR - EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl) - - set(ALPINE_LINUX 1) -elseif(EXISTS ${CROSS_ROOTFS}/bin/freebsd-version) - set(FREEBSD 1) - set(CMAKE_SYSTEM_NAME FreeBSD) - set(CLR_CMAKE_TARGET_OS FreeBSD) -elseif(EXISTS ${CROSS_ROOTFS}/usr/platform/i86pc) - set(ILLUMOS 1) - set(CLR_CMAKE_TARGET_OS SunOS) -endif() - -if(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|x86)$" OR FREEBSD OR ILLUMOS) - set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0) - set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0) - - if(ALPINE_LINUX) - set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1) - else() - set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 0) - endif() - - if(FREEBSD) - set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP 1) - set_cache_value(HAVE_CLOCK_MONOTONIC 1) - set_cache_value(HAVE_CLOCK_REALTIME 1) - elseif(ILLUMOS) - set_cache_value(HAVE_SET_MAX_VARIABLE 1) - endif() -else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!") -endif() diff --git a/src/libraries/Native/Windows/CMakeLists.txt b/src/libraries/Native/Windows/CMakeLists.txt index 6343b3f..1f3ac2b 100644 --- a/src/libraries/Native/Windows/CMakeLists.txt +++ b/src/libraries/Native/Windows/CMakeLists.txt @@ -23,6 +23,17 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "Binary directory isn't being correctly set before calling Cmake. Tree must be built in separate directory from source.") endif() +if(STATIC_LIBS_ONLY) + # Suppress exporting of the PAL APIs + add_definitions(-DPALEXPORT=EXTERN_C) + + set(GEN_SHARED_LIB 0) + set(STATIC_LIB_DESTINATION lib) +else() + set(GEN_SHARED_LIB 1) + set(STATIC_LIB_DESTINATION .) +endif() + project(CoreFX) # The following options are set by the razzle build @@ -113,4 +124,9 @@ endif () # as other asserts should still be included. add_compile_definitions($<$:NDEBUG>) +# we only need to build System.Globalization.Native when building static libs. +if(STATIC_LIBS_ONLY) + add_subdirectory(../Unix/System.Globalization.Native System.Globalization.Native) +endif() + add_subdirectory(clrcompression) diff --git a/src/libraries/Native/Windows/clrcompression/CMakeLists.txt b/src/libraries/Native/Windows/clrcompression/CMakeLists.txt index 5ac67d5..9566e38 100644 --- a/src/libraries/Native/Windows/clrcompression/CMakeLists.txt +++ b/src/libraries/Native/Windows/clrcompression/CMakeLists.txt @@ -5,7 +5,10 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) -include (GenerateExportHeader) + +if (GEN_SHARED_LIB) + include (GenerateExportHeader) +endif() if($ENV{__BuildArch} STREQUAL x86 OR $ENV{__BuildArch} STREQUAL x64) set(NATIVECOMPRESSION_SOURCES @@ -71,18 +74,21 @@ set (NATIVECOMPRESSION_SOURCES ../../AnyOS/brotli/enc/metablock.c ../../AnyOS/brotli/enc/static_dict.c ../../AnyOS/brotli/enc/utf8_util.c - clrcompression.def + ../../AnyOS/System.IO.Compression.Native/entrypoints.c ) #Include Brotli include files include_directories("../../AnyOS/brotli/include") -add_library(clrcompression - SHARED - ${NATIVECOMPRESSION_SOURCES} - # This will add versioning to the library - ${CMAKE_REPO_ROOT}/artifacts/obj/NativeVersion.rc -) +if (GEN_SHARED_LIB) + add_library(clrcompression + SHARED + ${NATIVECOMPRESSION_SOURCES} + clrcompression.def + # This will add versioning to the library + ${CMAKE_REPO_ROOT}/artifacts/obj/NativeVersion.rc + ) +endif() add_library(clrcompression-static STATIC @@ -93,21 +99,28 @@ SET_TARGET_PROPERTIES(clrcompression-static PROPERTIES PREFIX "") SET_TARGET_PROPERTIES(clrcompression-static PROPERTIES OUTPUT_NAME libclrcompression) # Allow specification of arguments that should be passed to the linker -SET_TARGET_PROPERTIES(clrcompression PROPERTIES LINK_OPTIONS "${__LinkArgs};${__SharedLinkArgs}") +if (GEN_SHARED_LIB) + SET_TARGET_PROPERTIES(clrcompression PROPERTIES LINK_OPTIONS "${__LinkArgs};${__SharedLinkArgs}") +endif() SET_TARGET_PROPERTIES(clrcompression-static PROPERTIES STATIC_LIBRARY_OPTIONS "${__LinkArgs}") # Allow specification of libraries that should be linked against -target_link_libraries(clrcompression ${__LinkLibraries}) +if (GEN_SHARED_LIB) + target_link_libraries(clrcompression ${__LinkLibraries}) +endif() target_link_libraries(clrcompression-static ${__LinkLibraries}) -GENERATE_EXPORT_HEADER( clrcompression - BASE_NAME clrcompression - EXPORT_MACRO_NAME clrcompression_EXPORT - EXPORT_FILE_NAME clrcompression_Export.h - STATIC_DEFINE clrcompression_BUILT_AS_STATIC -) +if (GEN_SHARED_LIB) + GENERATE_EXPORT_HEADER( clrcompression + BASE_NAME clrcompression + EXPORT_MACRO_NAME clrcompression_EXPORT + EXPORT_FILE_NAME clrcompression_Export.h + STATIC_DEFINE clrcompression_BUILT_AS_STATIC + ) + + install (TARGETS clrcompression DESTINATION .) + install (FILES $ DESTINATION .) +endif() -install (TARGETS clrcompression DESTINATION .) -install (TARGETS clrcompression-static DESTINATION .) -install (FILES $ DESTINATION .) +install (TARGETS clrcompression-static DESTINATION ${STATIC_LIB_DESTINATION}) diff --git a/src/libraries/Native/build-native.sh b/src/libraries/Native/build-native.sh index 2aaa9fe..0dc7c80 100755 --- a/src/libraries/Native/build-native.sh +++ b/src/libraries/Native/build-native.sh @@ -157,4 +157,4 @@ setup_dirs check_prereqs # Build the corefx native components. -build_native "$__TargetOS" "$__BuildArch" "$__nativeroot" "$__nativeroot" "$__IntermediatesDir" "$__CMakeArgs" "native libraries component" +build_native "$__TargetOS" "$__BuildArch" "$__nativeroot" "$__IntermediatesDir" "$__CMakeArgs" "native libraries component" diff --git a/src/mono/mono/metadata/native-library-qcall.c b/src/mono/mono/metadata/native-library-qcall.c index c4e1def..232b2df 100644 --- a/src/mono/mono/metadata/native-library-qcall.c +++ b/src/mono/mono/metadata/native-library-qcall.c @@ -12,8 +12,6 @@ #include "mono/utils/mono-path.h" #include "mono/metadata/native-library.h" -extern const void* gPalGlobalizationNative[]; - enum { func_flag_end_of_array = 0x01, func_flag_has_signature = 0x02, @@ -21,10 +19,6 @@ enum { func_flag_qcall = 0x08, // QCall - mscorlib.dll to mscorwks.dll transition implemented as PInvoke }; -#if defined(NO_GLOBALIZATION_SHIM) || !defined(ENABLE_NETCORE) -const void* gPalGlobalizationNative[] = { (void*)func_flag_end_of_array }; -#endif - static const MonoQCallDef c_qcalls[] = { #ifndef DISABLE_QCALLS diff --git a/src/mono/mono/metadata/native-library.c b/src/mono/mono/metadata/native-library.c index 2176315..0003bcf 100644 --- a/src/mono/mono/metadata/native-library.c +++ b/src/mono/mono/metadata/native-library.c @@ -49,6 +49,10 @@ static GHashTable *native_library_module_map; static GHashTable *native_library_module_blocklist; #endif +#if defined(ENABLE_NETCORE) && !defined(NO_GLOBALIZATION_SHIM) +extern const void *GlobalizationResolveDllImport (const char *name); +#endif + #ifndef DISABLE_DLLMAP static MonoDllMap *global_dll_map; #endif @@ -1256,6 +1260,20 @@ legacy_lookup_native_library (MonoImage *image, const char *scope) #endif // ENABLE_NETCORE +#if defined(ENABLE_NETCORE) && !defined(NO_GLOBALIZATION_SHIM) +static gpointer +default_resolve_dllimport (const char *dll, const char *func) +{ + if (strcmp (dll, "libSystem.Globalization.Native") == 0) { + const void *method_impl = GlobalizationResolveDllImport (func); + if (method_impl) + return (gpointer)method_impl; + } + + return NULL; +} +#endif + gpointer lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_out) { @@ -1336,6 +1354,12 @@ lookup_pinvoke_call_impl (MonoMethod *method, MonoLookupPInvokeStatus *status_ou } #endif +#if defined(ENABLE_NETCORE) && !defined(NO_GLOBALIZATION_SHIM) + gpointer default_override = default_resolve_dllimport (new_scope, new_import); + if (default_override) + return default_override; +#endif + #ifdef ENABLE_NETCORE #ifndef HOST_WIN32 retry_with_libcoreclr: diff --git a/src/mono/mono/metadata/qcall-def.h b/src/mono/mono/metadata/qcall-def.h index 1e83108..7341edd 100644 --- a/src/mono/mono/metadata/qcall-def.h +++ b/src/mono/mono/metadata/qcall-def.h @@ -12,4 +12,4 @@ * have to end with a func_flag_end_of_array (0x01) entry. **/ -FCClassElement("Globalization", "", gPalGlobalizationNative) +FCClassElement("", "", NULL) diff --git a/src/mono/wasm/wasm.proj b/src/mono/wasm/wasm.proj index 035c141..896fefd 100644 --- a/src/mono/wasm/wasm.proj +++ b/src/mono/wasm/wasm.proj @@ -35,7 +35,7 @@ - + diff --git a/src/tests/build.sh b/src/tests/build.sh index a1efe50..0955a4a 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -279,7 +279,7 @@ build_Tests() fi if [[ "$__SkipNative" != 1 && "$__TargetOS" != "Browser" && "$__TargetOS" != "Android" ]]; then - build_native "$__TargetOS" "$__BuildArch" "$__TestDir" "$__TryRunDir" "$__NativeTestIntermediatesDir" "CoreCLR test component" + build_native "$__TargetOS" "$__BuildArch" "$__TestDir" "$__NativeTestIntermediatesDir" "CoreCLR test component" if [[ "$?" -ne 0 ]]; then echo "${__ErrMsgPrefix}${__MsgPrefix}Error: native test build failed. Refer to the build log files for details (above)" @@ -605,7 +605,6 @@ __OSPlatformConfig="$__TargetOS.$__BuildArch.$__BuildType" __BinDir="$__RootBinDir/bin/coreclr/$__OSPlatformConfig" __PackagesBinDir="$__BinDir/.nuget" __TestDir="$__RepoRootDir/src/tests" -__TryRunDir="$__RepoRootDir/src/coreclr" __TestWorkingDir="$__RootBinDir/tests/coreclr/$__OSPlatformConfig" __IntermediatesDir="$__RootBinDir/obj/coreclr/$__OSPlatformConfig" __TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__OSPlatformConfig" -- 2.7.4