-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[cdac] cdac-build-tool #100650
[cdac] cdac-build-tool #100650
Changes from 64 commits
8518e9f
12aef6d
1eff4d0
22e217b
dd9279d
492af29
459d124
28f8256
418739d
1c1524d
34e852e
e48e709
0e8c60e
cd4f0f0
b6b079e
a9b0d7f
dbf0557
74433f1
ea441b6
787b836
e015e83
0354723
da038f3
f64b548
2e29a10
58162a3
4bb51bf
9700e29
3f22c7c
4aae511
60738ef
c0dab90
84eaa3b
86e5258
cc658c9
39fe70d
5064deb
74000bc
76c27bc
270fe21
84e0800
51da4e3
b26f3ac
8f9d1a7
87b79b3
b33ad07
c39e6f4
5ef8428
9f381be
443f83b
9fc2b26
024c566
b0f1f40
2852d8d
2429bd8
18a863e
a49e5e6
1f5ba44
2decea4
ce18bee
e143998
08cf75d
0d4d40d
94c56ea
3d49b70
f845c41
64430cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// the empty baseline data descriptor | ||
{ | ||
"version": 0 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,46 @@ endif() | |
|
||
# publish runtimeinfo lib | ||
install_clr(TARGETS runtimeinfo DESTINATIONS lib COMPONENT runtime) | ||
|
||
add_library(cdac_data_descriptor OBJECT datadescriptor.cpp) | ||
# don't build the data descriptor before the VM (and any of its dependencies' generated headers) | ||
add_dependencies(cdac_data_descriptor cee_wks_core) | ||
if(CLR_CMAKE_TARGET_WIN32) | ||
# turn off whole program optimization: | ||
# 1. it creates object files that cdac-build-tool can't read | ||
# 2. we never link cdac_data_descriptor into the final product - it's only job is to be scraped | ||
target_compile_options(cdac_data_descriptor PRIVATE /GL-) | ||
endif() | ||
target_include_directories(cdac_data_descriptor BEFORE PRIVATE ${VM_DIR}) | ||
target_include_directories(cdac_data_descriptor BEFORE PRIVATE ${VM_DIR}/${ARCH_SOURCES_DIR}) | ||
target_include_directories(cdac_data_descriptor PRIVATE ${CLR_DIR}/interop/inc) | ||
|
||
set(GENERATED_CDAC_DESCRIPTOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/cdac") | ||
set(CONTRACT_DESCRIPTOR_OUTPUT "${GENERATED_CDAC_DESCRIPTOR_DIR}/contract-descriptor.c") | ||
if("${CDAC_BUILD_TOOL_BINARY_PATH}" STREQUAL "" OR NOT EXISTS "${CDAC_BUILD_TOOL_BINARY_PATH}") | ||
message(FATAL_ERROR "No cdac-build-tool set or ${CDAC_BUILD_TOOL_BINARY_PATH} does not exist") | ||
endif() | ||
|
||
set(CONTRACT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/contracts.jsonc") | ||
|
||
# generate the contract descriptor by running cdac-build-tool | ||
# n.b. this just uses `dotnet` from the PATH. InitializeDotNetCli adds the apropropriate directory | ||
add_custom_command( | ||
OUTPUT "${CONTRACT_DESCRIPTOR_OUTPUT}" | ||
VERBATIM | ||
COMMAND dotnet ${CDAC_BUILD_TOOL_BINARY_PATH} compose -o "${CONTRACT_DESCRIPTOR_OUTPUT}" -c "${CONTRACT_FILE}" $<TARGET_OBJECTS:cdac_data_descriptor> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just make embedding the contract descriptor optional if someone is doing a build without msbuild? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If making it optional doesn't affect debugging, that's good. Second part is: - <_CoreClrBuildArg Include="-cmakeargs "-DCDAC_BUILD_TOOL_BINARY_PATH=$(RuntimeBinDir)cdac-build-tool\cdac-build-tool.dll"" />
+ <_CoreClrBuildArg Include="-cmakeargs "-DCDAC_BUILD_TOOL_BINARY_PATH='$(RuntimeBinDir)cdac-build-tool/cdac-build-tool.dll'" -cmakeargs "-DCLR_DOTNET_HOST_PATH='$(DOTNET_HOST_PATH)'"" /> - COMMAND dotnet ${CDAC_BUILD_TOOL_BINARY_PATH} compose -o "${CONTRACT_DESCRIPTOR_OUTPUT}" -c "${CONTRACT_FILE}" $<TARGET_OBJECTS:cdac_data_descriptor>
+ COMMAND "${CLR_DOTNET_HOST_PATH}" "${CDAC_BUILD_TOOL_BINARY_PATH}" compose -o "${CONTRACT_DESCRIPTOR_OUTPUT}" -c "${CONTRACT_FILE}" $<TARGET_OBJECTS:cdac_data_descriptor> which will resolve to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
in the future, it will make using something like dotnet-sos impossible I don't understand what scenarios don't have a .NET sdk available. any new platform bringup will start with cross compiling from an existing platform with a .NET sdk and a cross compiler toolchain, right? that case should be handled by the cmake+msbuild infrastructure I added #101297
I had something like this before and it broke source build because it was pointing to the repo root There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update I'm educating myself over in dotnet/installer#19534 (comment) I think previously I used something other than There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated #101297 to use DOTNET_HOST_PATH if it's set |
||
DEPENDS cdac_data_descriptor cee_wks_core $<TARGET_OBJECTS:cdac_data_descriptor> "${CONTRACT_FILE}" | ||
USES_TERMINAL | ||
) | ||
|
||
# It is important that cdac_contract_descriptor is an object library; | ||
# if it was static, linking it into the final dll would not export | ||
# DotNetRuntimeContractDescriptor since it is not referenced anywhere. | ||
add_library_clr(cdac_contract_descriptor OBJECT | ||
"${CONTRACT_DESCRIPTOR_OUTPUT}" | ||
contractpointerdata.cpp | ||
) | ||
target_include_directories(cdac_contract_descriptor BEFORE PRIVATE ${VM_DIR}) | ||
target_include_directories(cdac_contract_descriptor BEFORE PRIVATE ${VM_DIR}/${ARCH_SOURCES_DIR}) | ||
target_include_directories(cdac_contract_descriptor PRIVATE ${CLR_DIR}/interop/inc) | ||
add_dependencies(cdac_contract_descriptor cdac_data_descriptor cee_wks_core) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
#include "common.h" | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include "threads.h" | ||
|
||
extern "C" | ||
{ | ||
|
||
// without an extern declaration, clang does not emit this global into the object file | ||
extern const uintptr_t contractDescriptorPointerData[]; | ||
lambdageek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const uintptr_t contractDescriptorPointerData[] = { | ||
(uintptr_t)0, // placeholder | ||
#define CDAC_GLOBAL_POINTER(name,value) (uintptr_t)(value), | ||
#include "datadescriptor.h" | ||
}; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//algorithmic contracts for coreclr | ||
// The format of this file is: JSON with comments | ||
// { | ||
// "CONTRACT NAME": VERSION, | ||
// ... | ||
// } | ||
// CONTRACT NAME is an arbitrary string, VERSION is an integer | ||
// | ||
// cdac-build-tool can take multiple "-c contract_file" arguments | ||
// so to conditionally include contracts, put additional contracts in a separate file | ||
{ | ||
"SOSBreakingChangeVersion": 1 // example contract: "runtime exports an SOS breaking change version global" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
it checks both "not defined" and "evaluates to empty string".