Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corehost: derive fallback rid from output rid. #82163

Merged
merged 8 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/coreclr/build-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,11 @@ export MSBUILDDEBUGPATH
# Check prereqs.
check_prereqs

# When the host runs on an unknown rid, it falls back to the output rid
__FallbackOS="${__OutputRid%-*}" # Strip architecture

# Build the coreclr (native) components.
__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize $__CMakeArgs"
__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLI_CMAKE_FALLBACK_RID=\"$__FallbackOS\" $__CMakeArgs"

if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then
__CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs"
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/runtime.proj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<_CoreClrBuildArg Condition="'$(PgoInstrument)' == 'true'" Include="-pgoinstrument" />
<_CoreClrBuildArg Condition="'$(NativeOptimizationDataSupported)' == 'true' and '$(NoPgoOptimize)' != 'true' and '$(PgoInstrument)' != 'true'" Include="-pgodatapath &quot;$(PgoPackagePath)&quot;" />
<_CoreClrBuildArg Condition="'$(HostArchitecture)' != ''" Include="-hostarch $(HostArchitecture)" />
<_CoreClrBuildArg Include="-outputrid $(OutputRid)" />
</ItemGroup>

<ItemGroup Condition="'$(ClrFullNativeBuild)' != 'true'">
Expand Down
5 changes: 4 additions & 1 deletion src/native/corehost/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ __IntermediatesDir="$__RootBinDir/obj/$__OutputRid.$__BuildType"

export __BinDir __IntermediatesDir __RuntimeFlavor

# When the host runs on an unknown rid, it falls back to the output rid
__FallbackOS="${__OutputRid%-*}" # Strip architecture

__CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs"
__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__OutputRid\" -DCLI_CMAKE_FALLBACK_RID=\"$__FallbackOS\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
__CMakeArgs="-DRUNTIME_FLAVOR=\"$__RuntimeFlavor\" $__CMakeArgs"
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"

Expand Down
19 changes: 1 addition & 18 deletions src/native/corehost/hostmisc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,12 @@
#if defined(TARGET_WINDOWS)
#define LIB_PREFIX ""
#define LIB_FILE_EXT ".dll"
#define FALLBACK_HOST_RID _X("win10")
#elif defined(TARGET_OSX)
#define LIB_PREFIX "lib"
#define LIB_FILE_EXT ".dylib"
#define FALLBACK_HOST_RID _X("osx.10.12")
#else
#define LIB_PREFIX "lib"
#define LIB_FILE_EXT ".so"
#if defined(TARGET_FREEBSD)
#define FALLBACK_HOST_RID _X("freebsd")
#elif defined(TARGET_ILLUMOS)
#define FALLBACK_HOST_RID _X("illumos")
#elif defined(TARGET_SUNOS)
#define FALLBACK_HOST_RID _X("solaris")
#elif defined(TARGET_LINUX_MUSL)
#define FALLBACK_HOST_RID _X("linux-musl")
#elif defined(TARGET_ANDROID)
#define FALLBACK_HOST_RID _X("linux-bionic")
#else
#define FALLBACK_HOST_RID _X("linux")
#endif
#endif

#define _STRINGIFY(s) _X(s)
Expand Down Expand Up @@ -276,9 +261,7 @@ namespace pal
string_t get_current_os_rid_platform();
inline string_t get_current_os_fallback_rid()
{
string_t fallbackRid(FALLBACK_HOST_RID);

return fallbackRid;
return _STRINGIFY(FALLBACK_HOST_RID);
}

const void* mmap_read(const string_t& path, size_t* length = nullptr);
Expand Down
6 changes: 6 additions & 0 deletions src/native/corehost/setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ else()
add_definitions(-DREPO_COMMIT_HASH="${CLI_CMAKE_COMMIT_HASH}")
endif()
endif()

if("${CLI_CMAKE_FALLBACK_RID}" STREQUAL "")
message(FATAL_ERROR "Fallback rid needs to be specified to build the host")
else()
add_definitions(-DFALLBACK_HOST_RID="${CLI_CMAKE_FALLBACK_RID}")
endif()