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

Add DNMD into src/native #107961

Open
wants to merge 148 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
4f1bc36
Initial commit of DNMD
AaronRobinsonMSFT Oct 24, 2022
fdb4920
Simple mddump impl
AaronRobinsonMSFT Oct 24, 2022
aaa8aac
Remove uses of C file I/O API
AaronRobinsonMSFT Oct 24, 2022
428b569
Create table/column index enum
AaronRobinsonMSFT Oct 26, 2022
157318e
Add support for Portable PDBs
AaronRobinsonMSFT Oct 26, 2022
39670eb
Minor nits
AaronRobinsonMSFT Oct 27, 2022
fe7a626
Fix C and C++ issues on clang
AaronRobinsonMSFT Oct 28, 2022
7c2f48a
Add PE data structures to platform.h
AaronRobinsonMSFT Oct 28, 2022
87cfbbe
Move around platform headers
AaronRobinsonMSFT Oct 28, 2022
23382a8
Incorrect macro used.
AaronRobinsonMSFT Oct 29, 2022
097796f
Cursor updates
AaronRobinsonMSFT Oct 29, 2022
eeb50cb
Change query API to permit bulk
AaronRobinsonMSFT Oct 30, 2022
f5b058a
Start implementation for interfaces
AaronRobinsonMSFT Oct 30, 2022
8a1a4d2
Add build of static and shared
AaronRobinsonMSFT Oct 30, 2022
d1abd88
Start Regression testing suite
AaronRobinsonMSFT Oct 31, 2022
302aaf1
Missed test props file.
AaronRobinsonMSFT Oct 31, 2022
c11b1fd
Create CoTaskMemAlloc and malloc smart pointers
AaronRobinsonMSFT Oct 31, 2022
10fe9f2
EnumTypeDefs always skips the first row.
AaronRobinsonMSFT Oct 31, 2022
6647a1f
Add find logic for sorted tables in dnmd
AaronRobinsonMSFT Nov 1, 2022
ec235b3
Add impl and test for EnumMembers
AaronRobinsonMSFT Nov 2, 2022
44f7f5a
EnumParams and EnumFields
AaronRobinsonMSFT Nov 2, 2022
8e6ad50
EnumProperties
AaronRobinsonMSFT Nov 2, 2022
5f1848e
Add entries for tables not defined in ECMA
AaronRobinsonMSFT Nov 3, 2022
018cf61
Enum Events and UserStrings
AaronRobinsonMSFT Nov 5, 2022
a5ee998
GetClassLayout
AaronRobinsonMSFT Nov 7, 2022
78b76ea
Mark MetadataImportRO final and all methods
AaronRobinsonMSFT Nov 7, 2022
f3f5167
Nits
AaronRobinsonMSFT Nov 7, 2022
bad5bf6
GetTypeSpecFromToken and GetRVA
AaronRobinsonMSFT Nov 7, 2022
8f7c0de
Add flags for specific table to mddump.
AaronRobinsonMSFT Nov 7, 2022
aa1db66
IsGlobal
AaronRobinsonMSFT Nov 10, 2022
87a7d06
Update Regression test project
AaronRobinsonMSFT Nov 11, 2022
d30ea61
Fix CMake logic for publishing headers
AaronRobinsonMSFT Nov 12, 2022
adf15ae
Always emit symbols
AaronRobinsonMSFT Nov 12, 2022
42b0503
Add project to compare perf and profile
AaronRobinsonMSFT Nov 12, 2022
f8de5cb
Style nits
AaronRobinsonMSFT Nov 12, 2022
9409fa0
EnumPermissionSets
AaronRobinsonMSFT Nov 13, 2022
5f4ae38
Remove some unnecessary overhead
AaronRobinsonMSFT Nov 13, 2022
52a6df0
Make testing against NETFX 2/4 easier.
AaronRobinsonMSFT Nov 13, 2022
3ba53ee
Add tests for running against NETFX 2/4 BCL
AaronRobinsonMSFT Nov 14, 2022
6d9ac81
GetTypeDefProps
AaronRobinsonMSFT Nov 19, 2022
7452733
EnumMembersWithName
AaronRobinsonMSFT Nov 19, 2022
a16f8f7
Add lifetime cleanup mechanism for enum
AaronRobinsonMSFT Nov 19, 2022
31682c8
EnumMethodsWithName
AaronRobinsonMSFT Nov 20, 2022
e7873a9
GetMethodProps
AaronRobinsonMSFT Nov 20, 2022
f1aa57b
GetScopeProps
AaronRobinsonMSFT Nov 20, 2022
4724df7
EnumMemberRefs
AaronRobinsonMSFT Nov 20, 2022
781a76d
dnmd library nits.
AaronRobinsonMSFT Nov 21, 2022
0d7f55b
Improve performance test for expansion
AaronRobinsonMSFT Nov 21, 2022
529eba3
Request LTCG
AaronRobinsonMSFT Nov 22, 2022
50a3d5a
GetPinvokeMap
AaronRobinsonMSFT Nov 22, 2022
f33b003
GetTypeRefProps
AaronRobinsonMSFT Nov 22, 2022
5a5e25a
GetModuleRefProps
AaronRobinsonMSFT Nov 23, 2022
3feefdb
GetFieldMarshal
AaronRobinsonMSFT Nov 23, 2022
97b4216
GetNestedClassProps
AaronRobinsonMSFT Nov 23, 2022
88a5c5b
FindTypeRef
AaronRobinsonMSFT Nov 23, 2022
151e41c
GetParamForMethodIndex
AaronRobinsonMSFT Nov 24, 2022
dac337a
EnumMethodImpls
AaronRobinsonMSFT Nov 24, 2022
6018085
EnumCustomAttributes
AaronRobinsonMSFT Nov 25, 2022
d376c51
GetCustomAttributeProps
AaronRobinsonMSFT Nov 25, 2022
90687aa
GetEventProps
AaronRobinsonMSFT Nov 29, 2022
1a59d14
GetMemberProps
AaronRobinsonMSFT Nov 30, 2022
75da83d
GetCustomAttributeByName
AaronRobinsonMSFT Dec 1, 2022
2bd11ed
Fix TypeSpec reading for CustomAttributes
AaronRobinsonMSFT Dec 1, 2022
062e09e
GetCustomAttributeByName benchmark
AaronRobinsonMSFT Dec 3, 2022
2a50e58
Nits
AaronRobinsonMSFT Dec 3, 2022
77dd2c1
GetNameFromToken
AaronRobinsonMSFT Dec 3, 2022
493c97b
GetNativeCallConvFromSig
AaronRobinsonMSFT Dec 6, 2022
57f409a
Nits
AaronRobinsonMSFT Dec 6, 2022
c439fd4
FindTypeDefByName
AaronRobinsonMSFT Dec 11, 2022
88fc3b6
Fix bug in GetMethodProps
AaronRobinsonMSFT Jan 10, 2023
4b34fcb
Add notes about running tests.
AaronRobinsonMSFT Jan 11, 2023
8bf3db2
Reference IL project in UnitTests project.
AaronRobinsonMSFT Jan 11, 2023
986c037
Show the il file in VS's solution view
jkoritzinsky Jan 11, 2023
26d2a56
Include the interop debugging configuration in checked-in source
jkoritzinsky Jan 11, 2023
e601dfe
Implement IMetaDataImport2 APIs for generics and MethodSpecs
jkoritzinsky Jan 11, 2023
9ef3e53
Implement GetVersionString and add comment about GetPEKind
jkoritzinsky Jan 11, 2023
f99db3e
Implement IMetadataImport::FindMethod
jkoritzinsky Jan 13, 2023
e72083f
Implement FindMember, FindField, and FindMemberRef APIs
jkoritzinsky Jan 14, 2023
23b1439
PR feedback
jkoritzinsky Jan 17, 2023
58de7bd
Remove span.hpp
jkoritzinsky Jan 17, 2023
1a51885
Fix build
jkoritzinsky Jan 17, 2023
cc6f85d
Update managed tests to only use IMetaDataImport2 as there's no tests…
jkoritzinsky Jan 17, 2023
0f6b30b
Always call FindMethod before FindField
jkoritzinsky Jan 17, 2023
403fdbb
Fix up string handling feedback
jkoritzinsky Jan 17, 2023
5d02e18
Merge pull request #2 from AaronRobinsonMSFT/interface-generic
jkoritzinsky Jan 19, 2023
31238a3
Style nits
AaronRobinsonMSFT Jan 20, 2023
708d722
Reduce allocation for context
AaronRobinsonMSFT Jan 21, 2023
2b59b3a
Add predicate to query functions to avoid
AaronRobinsonMSFT Jan 23, 2023
e55983d
Move regperf to a regnative location for shared
AaronRobinsonMSFT Jan 27, 2023
d45df75
Port unit test logic to C++
AaronRobinsonMSFT Jan 29, 2023
b1ce758
Fix build on macOS
AaronRobinsonMSFT Jan 30, 2023
291738f
Respond to macOS build support on Windows
AaronRobinsonMSFT Jan 30, 2023
23f0afe
Tests pass on macOS
AaronRobinsonMSFT Feb 1, 2023
1d85e15
Linux builds if utf16 <=> utf8 conversion
AaronRobinsonMSFT Feb 1, 2023
875b951
Merge in Import implementation and testing
AaronRobinsonMSFT Feb 1, 2023
9bc8775
Remove "unknown pragma" suppressions.
AaronRobinsonMSFT Feb 1, 2023
c168abc
Add main CI job that builds, tests, and reports test failures as anot…
jkoritzinsky Feb 1, 2023
3fe4779
Update main.yml
jkoritzinsky Feb 2, 2023
9e62fd3
Make a small whitespace change to trigger the action
jkoritzinsky Feb 2, 2023
5452f9f
Merge pull request #13 from jkoritzinsky/ci
jkoritzinsky Feb 2, 2023
cfc7aed
Set some loader and build settings to make the macos build work better.
Feb 3, 2023
58ba75f
Don't to IPO on debug builds. Clang's ThinLTO in dynamic libraries cr…
Feb 11, 2023
ddd13a2
Null terminate buffers passed to the encoding conversion functions
Feb 11, 2023
6d50918
Set the right upload path for test results.
Feb 11, 2023
9368501
Fix test results uupload
Feb 11, 2023
fdd4279
Add rpath settings for macOS.
AaronRobinsonMSFT Feb 11, 2023
7f23e99
Merge pull request #15 from jkoritzinsky/fix-mac-build
AaronRobinsonMSFT Feb 11, 2023
f56d6b3
Compare baseline results to current results by value instead of by po…
jkoritzinsky Feb 11, 2023
0f6cd39
Implement and test IMetaDataAssemblyImport (#11)
jkoritzinsky Feb 12, 2023
1e874d8
Disable fail-fast on strategy (#17)
jkoritzinsky Feb 23, 2023
669b5ed
Publish test results in separate workflow (#16)
jkoritzinsky Feb 23, 2023
5e86175
Add license (#20)
AaronRobinsonMSFT Feb 27, 2023
4bb22b4
Enable building with GCC and Linux. (#21)
jkoritzinsky Feb 28, 2023
5506a36
Add support for the uncompressed stream, indirection tables, and mini…
jkoritzinsky Mar 29, 2023
901a319
Define when to run CI on push
AaronRobinsonMSFT Mar 31, 2023
f805a5d
Fixes based on fuzzing with afl++ (#25)
AaronRobinsonMSFT Mar 31, 2023
068261a
Update build infrastructure to install as a modern CMake package (#26)
jkoritzinsky Jun 22, 2023
58f314e
Stubbed out delta API in `dnmd` (#27)
AaronRobinsonMSFT Jul 28, 2023
3a2da4d
Explicitly validate that the user is asking for a sorted column when …
jkoritzinsky Jul 28, 2023
b2f9b79
Change the interfaces library to use a tear-off model to make adding …
jkoritzinsky Jul 30, 2023
7a060b7
Use macros to templatize search functions (#31)
AaronRobinsonMSFT Aug 11, 2023
de389c3
Add a writing API and implement the md_apply_delta API in terms of it…
jkoritzinsky Aug 14, 2023
c813324
Update style to be consistent (#32)
AaronRobinsonMSFT Aug 15, 2023
c8ba731
Create API for accessing raw column data. (#34)
AaronRobinsonMSFT Aug 16, 2023
c09468c
Implement save APIs and provide an mdmerge tool that composes an imag…
jkoritzinsky Aug 24, 2023
5b7bd51
Add specialized parsing functions for portable pdb blobs (#38)
jkoritzinsky Aug 30, 2023
3f2ad67
Introduce a marker interface and move ownership to it (#39)
jkoritzinsky Sep 2, 2023
9538281
Various improvements for PDBs (#40)
jkoritzinsky Sep 11, 2023
ca08231
Fix refcount leaks in dnmd::interfaces (#41)
jkoritzinsky Sep 13, 2023
9982141
Remove tool source duplication (#42)
AaronRobinsonMSFT Nov 28, 2023
334d8cb
Change the "data to write" parameters in `md_set_column_value_as_*` m…
jkoritzinsky Nov 29, 2023
31e70b8
Add a new md_add_new_row_to_sorted_list function to insert a row into…
jkoritzinsky Nov 30, 2023
454300f
Move the "get MethodDefSig from a MethodRefSig" functionality into dn…
jkoritzinsky Dec 5, 2023
e457e73
Initial infrastructure for SymReader support (#46)
AaronRobinsonMSFT Dec 6, 2023
63745b3
Update to .NET 8 (#47)
AaronRobinsonMSFT Dec 6, 2023
71939f2
Fix the version length field when saving (#51)
jkoritzinsky Jan 4, 2024
66ce795
Implement signature importing (#48)
jkoritzinsky Jan 10, 2024
e2e6276
Add DNMD API to create a new metadata handle and implement IMetaDataD…
jkoritzinsky Jan 18, 2024
af70b97
Convert our unit tests and perf harness to use native entry-points (#50)
jkoritzinsky Jan 26, 2024
9b986e1
Disable the Preview SDK message (#53)
jkoritzinsky Apr 10, 2024
e592785
Provide single-threaded (no-locking) implementation of IMetadataEmit …
jkoritzinsky Jun 18, 2024
bccf406
Add a thread-safe wrapping implementation (#54)
jkoritzinsky Jul 23, 2024
b4d7ca7
Implement fix in DNMD for dotnet/runtime#108907
jkoritzinsky Oct 16, 2024
9a97253
Change the DNMD APIs to act on single rows and bring other
jkoritzinsky Oct 31, 2024
99a7991
Merge branch 'dnmd-only' into HEAD
jkoritzinsky Oct 31, 2024
a6d049e
Move the native non-crypto-use SHA1 impl to minipal and reuse it from…
jkoritzinsky Oct 15, 2024
4167a4c
Integrate DNMD into the runtime repos build.
jkoritzinsky Sep 16, 2024
6d99e39
Remove the implicit conversion from span<T> to T* and instead introdu…
jkoritzinsky Nov 1, 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
6 changes: 6 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
<SubsetName Include="Tools.ILLinkTests" OnDemand="true" Description="Unit tests for the tools.illink subset." />

<SubsetName Include="Tools.CdacReaderTests" OnDemand="true" Description="Units tests for the cDAC reader." />
<SubsetName Include="Tools.NativeTests" OnDemand="true" Description="Native unit tests for native tools and libraries." />

<!-- Host -->
<SubsetName Include="Host" Description="The .NET hosts, packages, hosting libraries, and tests. Equivalent to: $(DefaultHostSubsets)" />
Expand Down Expand Up @@ -409,6 +410,11 @@
Test="true" Category="tools"/>
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+tools.nativetests+'))">
<ProjectToBuild Include="$(RepoRoot)src\native\dnmd\dnmd.proj"
Test="true" Category="tools" Condition="'$(DotNetBuildSourceOnly)' != 'true'"/>
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+clr.nativecorelib+'))">
<ProjectToBuild Include="$(CoreClrProjectRoot)crossgen-corelib.proj" Category="clr" />
</ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ if (MSVC)
define_property(TARGET PROPERTY CLR_EH_CONTINUATION INHERITED BRIEF_DOCS "Controls the /guard:ehcont flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:ehcont compiler flag should be present")
define_property(TARGET PROPERTY CLR_EH_OPTION INHERITED BRIEF_DOCS "Defines the value of the /EH option" FULL_DOCS "Set this property to one of the valid /EHxx options (/EHa, /EHsc, /EHa-, ...)")
define_property(TARGET PROPERTY MSVC_WARNING_LEVEL INHERITED BRIEF_DOCS "Define the warning level for the /Wn option" FULL_DOCS "Set this property to one of the valid /Wn options (/W0, /W1, /W2, /W3, /W4)")
define_property(TARGET PROPERTY SET_SOURCE_CHARSET INHERITED BRIEF_DOCS "Add the /source-charset option" FULL_DOCS "Set this property to add the /source-charset:utf8 option")

set_property(GLOBAL PROPERTY CLR_CONTROL_FLOW_GUARD ON)

Expand Down Expand Up @@ -881,7 +882,8 @@ if (MSVC)

add_compile_options($<$<COMPILE_LANGUAGE:C,CXX,ASM_MASM>:/Zi>) # enable debugging information
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/ZH:SHA_256>) # use SHA256 for generating hashes of compiler processed source files.
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8.
set_property(GLOBAL PROPERTY SET_SOURCE_CHARSET ON)
add_compile_options($<$<AND:$<BOOL:$<TARGET_PROPERTY:SET_SOURCE_CHARSET>>,$<COMPILE_LANGUAGE:C,CXX>>:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8.

if (CLR_CMAKE_HOST_ARCH_I386)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
Expand Down
12 changes: 11 additions & 1 deletion eng/pipelines/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,19 @@ extends:
jobParameters:
timeoutInMinutes: 120
nameSuffix: CLR_Tools_Tests
buildArgs: -s clr.aot+clr.iltools+libs.sfx+clr.toolstests+tools.cdacreadertests -c $(_BuildConfig) -test
buildArgs: -s clr.aot+clr.iltools+libs.sfx+clr.toolstests+tools.cdacreadertests+tools.nativetests -c $(_BuildConfig) -test
enablePublishTestResults: true
testResultsFormat: 'xunit'
postBuildSteps:
- task: PublishTestResults@2
displayName: 'Publish CTest Results'
inputs:
testResultsFormat: 'CTest'
testResultsFiles: '*.ctestxml'
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
testRunTitle: 'CLR_Tools_Tests-$(_BuildConfig)-ctest'
continueOnError: true
condition: always()
# We want to run AOT tests when illink changes because there's share code and tests from illink which are used by AOT
condition: >-
or(
Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,17 @@ add_subdirectory(pal/prebuilt/inc)
set(EP_GENERATED_HEADER_PATH "${GENERATED_INCLUDE_DIR}")
include (${CLR_SRC_NATIVE_DIR}/eventpipe/configure.cmake)

#--------------------------------
# Include shared native libraries
#--------------------------------
add_subdirectory(${CLR_SRC_NATIVE_DIR}/containers containers)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/eventpipe eventpipe)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/minipal shared_minipal)

if (NOT CLR_CROSS_COMPONENTS_BUILD)
include(dnmd.cmake)
endif()

if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_subdirectory(debug/debug-pal)
endif()
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/build-runtime.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do (
if not "!string:-crosscomponents-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! crosscomponents
)
if not "!string:-cdac-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! cdac
)
if not "!string:-debug-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! debug
)
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/components.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ add_dependencies(runtime hosts)

# The cross-components build is separate, so we don't need to add a dependency on coreclr_misc
add_component(crosscomponents)

# The cdac-components build is separate
add_component(cdac)
18 changes: 18 additions & 0 deletions src/coreclr/dnmd.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Include the dnmd project into the CoreCLR build
include(FetchContent)
FetchContent_Declare(
dnmd
SOURCE_DIR "${CLR_SRC_NATIVE_DIR}/dnmd"
)

set(DNMD_BUILD_TESTS OFF)
set(DNMD_INSTALL OFF)
FetchContent_MakeAvailable(dnmd)

set_property(DIRECTORY ${CLR_SRC_NATIVE_DIR}/dnmd PROPERTY CLR_CONTROL_FLOW_GUARD ON)

# Install dnmd for usage by the cdac.
install_static_library(dnmd cdac cdac)
install_static_library(dnmd_interfaces_static cdac cdac)
install(TARGETS dnmd_interfaces DESTINATION cdac COMPONENT cdac)
add_dependencies(cdac dnmd_interfaces)
4 changes: 4 additions & 0 deletions src/coreclr/inc/corhdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,11 @@ typedef enum NativeTypeArrayFlags
//
// Enum used for HFA type recognition.
// Supported across architectures, so that it can be used in altjits and cross-compilation.
#ifdef __cplusplus
typedef enum CorInfoHFAElemType : unsigned {
#else
typedef enum CorInfoHFAElemType {
#endif
CORINFO_HFA_ELEM_NONE,
CORINFO_HFA_ELEM_FLOAT,
CORINFO_HFA_ELEM_DOUBLE,
Expand Down
49 changes: 0 additions & 49 deletions src/coreclr/inc/sha1.h

This file was deleted.

4 changes: 4 additions & 0 deletions src/coreclr/md/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ endif (CLR_CMAKE_TARGET_WIN32)
add_library_clr(mdruntime_dac ${MDRUNTIME_SOURCES})
set_target_properties(mdruntime_dac PROPERTIES DAC_COMPONENT TRUE)
target_precompile_headers(mdruntime_dac PRIVATE stdafx.h)
target_link_libraries(mdruntime_dac PUBLIC minipal)

add_library_clr(mdruntime_wks OBJECT ${MDRUNTIME_SOURCES})
target_compile_definitions(mdruntime_wks PRIVATE FEATURE_METADATA_EMIT_ALL)
target_precompile_headers(mdruntime_wks PRIVATE stdafx.h)
target_link_libraries(mdruntime_wks PUBLIC minipal)

add_library_clr(mdruntime-dbi ${MDRUNTIME_SOURCES})
set_target_properties(mdruntime-dbi PROPERTIES DBI_COMPONENT TRUE)
target_precompile_headers(mdruntime-dbi PRIVATE stdafx.h)
target_link_libraries(mdruntime-dbi PUBLIC minipal)

add_library_clr(mdruntime_ppdb ${MDRUNTIME_SOURCES})
target_compile_definitions(mdruntime_ppdb PRIVATE FEATURE_METADATA_EMIT_ALL FEATURE_METADATA_EMIT_PORTABLE_PDB)
target_precompile_headers(mdruntime_ppdb PRIVATE stdafx.h)
target_link_libraries(mdruntime_ppdb PUBLIC minipal)
12 changes: 5 additions & 7 deletions src/coreclr/md/runtime/strongnameinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "stdafx.h"
#include "strongnameinternal.h"
#include "sha1.h"
#include <minipal/sha1.h>

// Common keys used by libraries we ship are included here.

Expand Down Expand Up @@ -317,9 +317,6 @@ HRESULT StrongNameTokenFromPublicKey(BYTE *pbPublicKeyBlob, // [in] pu
return S_OK;
#endif
HRESULT hr = S_OK;

SHA1Hash sha1;
BYTE *pHash = NULL;
DWORD i;
PublicKeyBlob *pPublicKey = NULL;
DWORD dwHashLenMinusTokenSize = 0;
Expand All @@ -338,16 +335,17 @@ HRESULT StrongNameTokenFromPublicKey(BYTE *pbPublicKeyBlob, // [in] pu
}

// Compute a hash over the public key.
sha1.AddData(pbPublicKeyBlob, cbPublicKeyBlob);
pHash = sha1.GetHash();
BYTE hash[SHA1_HASH_SIZE];
minipal_sha1(pbPublicKeyBlob, cbPublicKeyBlob, hash, sizeof(hash));

static_assert(SHA1_HASH_SIZE >= StrongNameToken::SIZEOF_TOKEN, "StrongNameToken::SIZEOF_TOKEN must be smaller or equal to the SHA1_HASH_SIZE");
dwHashLenMinusTokenSize = SHA1_HASH_SIZE - StrongNameToken::SIZEOF_TOKEN;

// Take the last few bytes of the hash value for our token. (These are the
// low order bytes from a network byte order point of view). Reverse the
// order of these bytes in the output buffer to get host byte order.
for (i = 0; i < StrongNameToken::SIZEOF_TOKEN; i++)
pToken->m_token[StrongNameToken::SIZEOF_TOKEN - (i + 1)] = pHash[i + dwHashLenMinusTokenSize];
pToken->m_token[StrongNameToken::SIZEOF_TOKEN - (i + 1)] = hash[i + dwHashLenMinusTokenSize];

return hr;
}
1 change: 0 additions & 1 deletion src/coreclr/utilcode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ set(UTILCODE_COMMON_SOURCES
corimage.cpp
format1.cpp
prettyprintsig.cpp
sha1.cpp
sigbuilder.cpp
sigparser.cpp
sstring.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "reflectclasswriter.h"
#include "comdynamic.h"

#include "sha1.h"
#include <minipal/sha1.h>

#include "eeconfig.h"

Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/dwbucketmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ DWORD GetCountBucketParamsForEvent(LPCWSTR wzEventName)
#include "dwreport.h"
#include <msodwwrap.h>
#include "dbginterface.h"
#include <sha1.h>
#include <minipal/sha1.h>

//------------------------------------------------------------------------------
// Description
Expand Down Expand Up @@ -1068,11 +1068,11 @@ int BaseBucketParamsManager::CopyStringToBucket(_Out_writes_(targetMaxLength) LP
}

// String didn't fit, so hash it.
SHA1Hash hash;
hash.AddData(reinterpret_cast<BYTE*>(const_cast<LPWSTR>(pSource)), (static_cast<int>(u16_strlen(pSource))) * sizeof(WCHAR));
BYTE hash[SHA1_HASH_SIZE];
minipal_sha1(reinterpret_cast<BYTE*>(const_cast<LPWSTR>(pSource)), (static_cast<int>(u16_strlen(pSource))) * sizeof(WCHAR), hash, sizeof(hash));

// Encode in base32. The hash is a fixed size; we'll accept up to maxLen characters of the encoding.
BytesToBase32 b32(hash.GetHash(), SHA1_HASH_SIZE);
BytesToBase32 b32(hash, SHA1_HASH_SIZE);
targLen = b32.Convert(pTargetParam, targetMaxLength);
pTargetParam[targLen] = W('\0');

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/peassembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "../binder/inc/applicationcontext.hpp"
#include "../binder/inc/assemblybindercommon.hpp"

#include "sha1.h"
#include <minipal/sha1.h>


#ifndef DACCESS_COMPILE
Expand Down
5 changes: 5 additions & 0 deletions src/native/dnmd/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
artifacts/
.vs/
.idea/
*~
TestResults/
37 changes: 37 additions & 0 deletions src/native/dnmd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.20)
project(dnmd
LANGUAGES C)

# Always include our public headers
include_directories(src/inc)

# Include the metadata API headers provided by CoreCLR
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../coreclr/inc ${CMAKE_CURRENT_SOURCE_DIR}/../../coreclr/pal/prebuilt/inc)

if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
# This is our root CMakeList.txt, so we need to set up some global settings and include the minipal here.
include(../../../eng/native/configurepaths.cmake)
include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)

add_subdirectory(${CLR_SRC_NATIVE_DIR}/minipal minipal)
endif()

include_directories(${CLR_SRC_NATIVE_DIR})

option(DNMD_BUILD_TESTS "Build tests for dnmd" ON)
option(DNMD_INSTALL "Install dnmd targets" ON)
option(DNMD_BUILD_INTERFACES "Build implementations of the metadata interfaces for DNMD" ON)
option(DNMD_BUILD_TOOLS "Build tools for dnmd" ON)

if (DNMD_BUILD_INTERFACES OR DNMD_BUILD_TESTS OR DNMD_BUILD_TOOLS)
enable_language(CXX)
endif()

add_subdirectory(src/)


if (DNMD_BUILD_TESTS)
enable_testing()

add_subdirectory(test/)
endif()
Loading
Loading