Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
8518e9f
checkpoint
lambdageek Mar 28, 2024
12aef6d
add old tooling notes
lambdageek Mar 28, 2024
1eff4d0
add an emitter
lambdageek Apr 1, 2024
22e217b
checkpoint read in the directory header
lambdageek Apr 1, 2024
dd9279d
checkpoint plausible-looking offsets
lambdageek Apr 2, 2024
492af29
checkpoint: field stuff is working
lambdageek Apr 3, 2024
459d124
checkpoint json
lambdageek Apr 3, 2024
28f8256
contract parsing
lambdageek Apr 3, 2024
418739d
refactor
lambdageek Apr 3, 2024
1c1524d
indirect pointer value support
lambdageek Apr 3, 2024
34e852e
move sample to tool dir
lambdageek Apr 3, 2024
e48e709
Take baselines from the docs/design/datacontracts/data dir
lambdageek Apr 3, 2024
0e8c60e
Add README
lambdageek Apr 3, 2024
cd4f0f0
fix BE
lambdageek Apr 3, 2024
b6b079e
hook up cdac-build-tool to the coreclr build; export DotNetRuntimeCon…
lambdageek Apr 4, 2024
a9b0d7f
try fix win-x86 build warning
lambdageek Apr 4, 2024
dbf0557
paths
lambdageek Apr 4, 2024
74433f1
vebose
lambdageek Apr 4, 2024
ea441b6
fix typo; fixes win32
lambdageek Apr 5, 2024
787b836
cleanup; add contracts.txt
lambdageek Apr 5, 2024
e015e83
add diagram to README
lambdageek Apr 5, 2024
0354723
move implementation notes
lambdageek Apr 5, 2024
da038f3
better verbose output from ObjectFileScraper
lambdageek Apr 5, 2024
f64b548
turn off whole program optimizations for data-descriptor.obj
lambdageek Apr 5, 2024
2e29a10
C++-ify and add real Thread offsets
lambdageek Apr 6, 2024
58162a3
no C99 designated initializers in C++ until C++20
lambdageek Apr 8, 2024
4bb51bf
build data descriptor after core runtime
lambdageek Apr 8, 2024
9700e29
fix gcc build
lambdageek Apr 8, 2024
3f22c7c
fix typo
lambdageek Apr 8, 2024
4aae511
simplify ObjectFileScraper
lambdageek Apr 8, 2024
60738ef
more dependencies
lambdageek Apr 8, 2024
c0dab90
try fix source build
lambdageek Apr 8, 2024
84eaa3b
remove fixme; document
lambdageek Apr 8, 2024
86e5258
Merge commit 'origin/main^' into cdac-contract-tool
lambdageek Apr 9, 2024
cc658c9
invoke 'dotnet cmake-build-tool.dll' instead of 'dotnet run --project'
lambdageek Apr 9, 2024
39fe70d
clean up macro boilerplate
lambdageek Apr 9, 2024
5064deb
platform flags
lambdageek Apr 9, 2024
74000bc
turn off verbose output
lambdageek Apr 9, 2024
76c27bc
can't use constexpr function in coreclr
lambdageek Apr 9, 2024
270fe21
Code review fixups
lambdageek Apr 12, 2024
84e0800
Rename "aux data" to "pointer data"
lambdageek Apr 12, 2024
51da4e3
rename "data-descriptor" to "datadescriptor"
lambdageek Apr 12, 2024
b26f3ac
simplify linking
lambdageek Apr 12, 2024
8f9d1a7
cdac-build-tool don't build dotnet tool; turn on analyzers
lambdageek Apr 12, 2024
87b79b3
update README
lambdageek Apr 12, 2024
b33ad07
rationalize naming; update docs; add some inline comments
lambdageek Apr 12, 2024
c39e6f4
rm whitespace
lambdageek Apr 12, 2024
5ef8428
renamce cdac.h to cdacoffsets.h
lambdageek Apr 12, 2024
9f381be
comments
lambdageek Apr 12, 2024
443f83b
fixup README
lambdageek Apr 12, 2024
9fc2b26
hex offsets; improved formatting
lambdageek Apr 12, 2024
024c566
don't throw in ParseContracts; add line numbers to errors
lambdageek Apr 12, 2024
b0f1f40
spelling
lambdageek Apr 12, 2024
2852d8d
Update README.md
lambdageek Apr 12, 2024
2429bd8
change input format for contracts to jsonc
lambdageek Apr 16, 2024
18a863e
add custom JsonConverter instances for the compact json representation
lambdageek Apr 16, 2024
a49e5e6
code review changes
lambdageek Apr 16, 2024
1f5ba44
inline comments into the data-descriptor-blob C code
lambdageek Apr 16, 2024
2decea4
cleanup
lambdageek Apr 16, 2024
ce18bee
comments and markdown
lambdageek Apr 16, 2024
e143998
Apply suggestions from code review
lambdageek Apr 17, 2024
08cf75d
simplify; bug fix - PointerDataCount include placeholder
lambdageek Apr 17, 2024
0d4d40d
fixup docs
lambdageek Apr 17, 2024
94c56ea
Merge remote-tracking branch 'origin/main' into cdac-contract-tool
lambdageek Apr 18, 2024
3d49b70
Update src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJso…
lambdageek Apr 18, 2024
f845c41
one more set of feedback changes
lambdageek Apr 18, 2024
64430cf
maybe no live ILLink ?
lambdageek Apr 18, 2024
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
Prev Previous commit
Next Next commit
Update README.md
  • Loading branch information
lambdageek authored Apr 12, 2024
commit 2852d8d3ae3781f18a47daa02c2a1598b42b69dd
27 changes: 14 additions & 13 deletions src/coreclr/tools/cdac-build-tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ files that specify contracts.
## Running

```console
% cdac-build-tool compose [-v] -o contract-descriptor.c -c contracts.txt data-descriptor.o
% cdac-build-tool compose [-v] -o contractdescriptor.c -c contracts.txt datadescriptor.o
```
## .NET runtime build integration

Expand All @@ -19,36 +19,42 @@ It consumes a target platform object file and emits a C source
file that contains a JSON contract descriptor. The C source
is then included in the normal build and link steps to create the runtime.

The contract descriptor source file depends on `contract-aux-data.c` which is a source file that contains
The contract descriptor source file depends on `contractpointerdata.c` which is a source file that contains
the definitions of the "indirect pointer data" that is referenced by the data descriptor. This is typically the addresses of important global variables in the runtime.
Constants and build flags are embedded directly in the JSON payload.

Multiple data descriptor source files may be specified (for example if they are produced by different components of the runtime, or by different source languages). The final JSON payload will be a composition of all the data descriptors.

Multiple contracts text files may be specified. This may be useful if some contracts are conditionally included (for example if they are platform-specific). The final JSON payload will be a composition of all the contracts files.

In the C/C++ data descriptor, we use a single header file `datadescriptor.h` together with the C preprocessor to produce `datadescriptor.c` and `contractpointerdata.c`.
This is an implementation detail. For data structures defined in other languages, other tools can be used to produce the object file and indirect pointer data.

```mermaid
flowchart TB
headers("runtime headers")
data_src("data-descriptor.c")
data_header("datadescriptor.h")
data_src("datadescriptor.c")
compile_data["clang"]
data_obj("data-descriptor.o")
data_obj("datadescriptor.o")
contracts("contracts.txt")
globals("contract-aux-data.c")
globals("contractpointerdata.c")
build[["cdac-build-tool"]]
descriptor_src("contract-descriptor.c")
descriptor_src("contractdescriptor.c")
vm("runtime sources")
compile_runtime["clang"]
runtime_lib(["libcoreclr.so"])

headers -.-> data_src
headers ~~~ data_header
data_header -.-> data_src
headers -.-> globals
headers -.-> vm
data_src --> compile_data --> data_obj --> build
contracts ----> build
contracts ---> build
build --> descriptor_src
descriptor_src --> compile_runtime
globals -----> compile_runtime
data_header -.-> globals ----> compile_runtime
vm ----> compile_runtime --> runtime_lib
```

Expand All @@ -74,9 +80,6 @@ CDAC_TYPE_END(GCHandle)
CDAC_TYPES_END()

CDAC_GLOBALS_BEGIN()
// FIXME: wasm32 doesn't like uint64_t cast from uintptr_t at compile-time
// The right thing to do is to not do pointers using this mechanism since they need to go into
// auxdata anyway.
CDAC_GLOBAL_POINTER(ManagedThreadStore, &g_managedThreadStore)
#if FEATURE_EH_FUNCLETS
CDAC_GLOBAL(FeatureEHFunclets, uint8, 1)
Expand All @@ -87,8 +90,6 @@ CDAC_GLOBAL(SomeMagicNumber, uint32, 42)
CDAC_GLOBALS_END()
```

**TODO**: finish documenting this

The file is included multiple times with the macros variously defined in order to generate the
data descriptor blob.

Expand Down