Skip to content

Commit

Permalink
test commit to see if pre-c11-compat happens in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
yowl committed May 4, 2024
1 parent 21cc98a commit da4ca46
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 13 deletions.
30 changes: 26 additions & 4 deletions eng/pipelines/runtimelab/install-llvm.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,45 @@ foreach ($Config in $Configs)
{
pushd llvm-project
$BuildDirName = "build-$($Config.ToLower())"
mkdir $BuildDirName -Force
if ($IsWindows)
{
mkdir $BuildDirName -Force
}
else
{
mkdir $BuildDirName --parents
}

$BuildDirPath = "$pwd/$BuildDirName"
$SourceDirName = "$pwd/llvm"
popd

$CmakeConfigureCommandLine = "-G", "Visual Studio 17 2022", "-DLLVM_INCLUDE_BENCHMARKS=OFF", "-Thost=x64"
if ($IsWindows)
{
$generator="Visual Studio 17 2022"
}
else
{
$generator="Ninja"
}

$CmakeConfigureCommandLine = "-G", "$generator", "-DLLVM_INCLUDE_BENCHMARKS=OFF"
$CmakeConfigureCommandLine += "-S", $SourceDirName, "-B", $BuildDirPath
if ($Config -eq "Release")
{
$LlvmConfig = "Release"
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded"
if ($IsWindows)
{
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded", "-Thost=x64"
}
}
else
{
$LlvmConfig = "Debug"
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug"
if ($IsWindows)
{
$CmakeConfigureCommandLine += "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug", "-Thost=x64"
}
}
$CmakeConfigureCommandLine += "-DCMAKE_BUILD_TYPE=$LlvmConfig"

Expand Down
23 changes: 22 additions & 1 deletion src/coreclr/build-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ if [[ -n "$__RequestedBuildComponents" ]]; then
__CMakeTarget=" $__RequestedBuildComponents "
__CMakeTarget="${__CMakeTarget// paltests / paltests_install }"
fi

if [[ "$__CMakeTarget" == *"wasmjit"* ]]; then
echo wasmjit
__ExtraCmakeArgs="$__ExtraCmakeArgs -DCLR_CMAKE_BUILD_LLVM_JIT=1"

if [[ "$__BuildType" == "Release" ]]; then
if [[ -n $LLVM_CMAKE_CONFIG_RELEASE ]]; then
LLVM_CMAKE_CONFIG="$LLVM_CMAKE_CONFIG_RELEASE"
fi
else
if [[ -n $LLVM_CMAKE_CONFIG_DEBUG ]]; then
LLVM_CMAKE_CONFIG="$LLVM_CMAKE_CONFIG_DEBUG"
fi
fi

if [[ -z "$LLVM_CMAKE_CONFIG" ]]; then
echo The LLVM_CMAKE_CONFIG environment variable pointing to llvm-build-dir/lib/cmake/llvm must be set. 1>&2
exit 1
fi
fi

if [[ -z "$__CMakeTarget" ]]; then
__CMakeTarget="install"
fi
Expand All @@ -185,7 +206,7 @@ fi

eval "$__RepoRootDir/eng/native/version/copy_version_files.sh"

build_native "$__HostOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component"
build_native "$__HostOS" "$__HostArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs $__ExtraCmakeArgs" "CoreCLR component"

# Build complete

Expand Down
7 changes: 6 additions & 1 deletion src/coreclr/jit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ function(create_standalone_jit)
# We'll be linking against LLVM built without /guard:ehcont, so disable it.
set_target_properties(${TARGETDETAILS_TARGET} PROPERTIES CLR_EH_CONTINUATION OFF)

find_package(LLVM REQUIRED CONFIG PATHS $ENV{LLVM_CMAKE_CONFIG})
message("find_package")
message($ENV{LLVM_CMAKE_CONFIG})
find_package(LLVM REQUIRED CONFIG PATHS $ENV{LLVM_CMAKE_CONFIG} NO_DEFAULT_PATH)
target_include_directories(${TARGETDETAILS_TARGET} PRIVATE ${LLVM_INCLUDE_DIRS})
message(${LLVM_INCLUDE_DIRS})
separate_arguments(LLVM_DEFINITIONS)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE ${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs core bitwriter)
Expand Down Expand Up @@ -711,6 +714,8 @@ endif (CLR_CMAKE_TARGET_ARCH_RISCV64)
if (CLR_CMAKE_BUILD_LLVM_JIT)
# The LLVM clrjit needs to be the last clrjit to use create_standalone_jit as it modifies some cmake variables.
# LLVM clrjit has an extra export - registerLlvmCallbacks.
add_compile_options(-Wno-switch)
add_compile_options(-Wno-format)
set(CLRJIT_EXPORTS ${CMAKE_CURRENT_LIST_DIR}/ClrJit.Llvm.exports)
set(JIT_EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/ClrJit.Llvm.exports.def)
preprocess_file (${CLRJIT_EXPORTS} ${JIT_EXPORTS_FILE})
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ CORINFO_GENERIC_HANDLE Llvm::getSymbolHandleForClassToken(mdToken token)
template <EEApiId Func, typename TReturn, typename... TArgs>
TReturn CallEEApi(TArgs... args)
{
return static_cast<TReturn (*)(TArgs...)>(g_callbacks[static_cast<int>(Func)])(args...);
return reinterpret_cast<TReturn (*)(TArgs...)>(g_callbacks[static_cast<int>(Func)])(args...);
}

const char* Llvm::GetMangledMethodName(CORINFO_METHOD_HANDLE methodHandle)
Expand Down Expand Up @@ -885,8 +885,8 @@ extern "C" DLLEXPORT void registerLlvmCallbacks(void** jitImports, void** jitExp
assert(jitExports != nullptr);

memcpy(g_callbacks, jitImports, static_cast<int>(EEApiId::Count) * sizeof(void*));
jitExports[static_cast<int>(JitApiId::StartSingleThreadedCompilation)] = &Llvm::StartSingleThreadedCompilation;
jitExports[static_cast<int>(JitApiId::FinishSingleThreadedCompilation)] = &Llvm::FinishSingleThreadedCompilation;
jitExports[static_cast<int>(JitApiId::StartSingleThreadedCompilation)] = (void*)&Llvm::StartSingleThreadedCompilation;
jitExports[static_cast<int>(JitApiId::FinishSingleThreadedCompilation)] = (void*)&Llvm::FinishSingleThreadedCompilation;
jitExports[static_cast<int>(JitApiId::Count)] = (void*)0x1234;
}

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/llvmcodegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ void Llvm::visitNode(GenTree* node)
break;
case GT_JMP:
NYI("LLVM/GT_JMP"); // Requires support for explicit tailcalls.
LLVM_FALLTHROUGH;
default:
unreached();
}
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/jit/llvmlssa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@ class ShadowStackAllocator
{
if (block != m_currentBlock)
{
m_actions.Push({AllocationActionKind::Block, m_currentBlockIndex++});
m_actions.Push({AllocationActionKind::Block, {m_currentBlockIndex++}});
m_currentBlock = block;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/unix/UnixContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// WASM has no thread state contexts.
#ifndef HOST_WASM

#include <ucontext.h>

// Convert Unix native context to PAL_LIMITED_CONTEXT
void NativeContextToPalContext(const void* context, PAL_LIMITED_CONTEXT* palContext);
// Redirect Unix native context to the PAL_LIMITED_CONTEXT and also set the first two argument registers
Expand Down
6 changes: 3 additions & 3 deletions src/native/libs/build-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ source "$__RepoRootDir"/eng/native/build-commons.sh

# Set cross build
if [[ "$__TargetOS" == browser ]]; then
if [[ -z "$EMSDK_PATH" ]]; then
if [[ -z "$EMSDK" ]]; then
if [[ -d "$__RepoRootDir"/src/mono/browser/emsdk/ ]]; then
export EMSDK_PATH="$__RepoRootDir"/src/mono/browser/emsdk/
export EMSDK="$__RepoRootDir"/src/mono/browser/emsdk/
else
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
exit 1
fi
fi
source "$EMSDK_PATH"/emsdk_env.sh
source "$EMSDK"/emsdk_env.sh
export CLR_CC=$(which emcc)
elif [[ "$__TargetOS" == wasi ]]; then
if [[ -z "$WASI_SDK_PATH" ]]; then
Expand Down

0 comments on commit da4ca46

Please sign in to comment.