From c594fcc91bb9fb4fedc6b2a055c7ea01eb361a20 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 27 May 2025 17:56:11 -0500 Subject: [PATCH] fuzzing: make fuzzing work with vcpkg and the new library layout (#18970) We need to replace the vcpkg "target triplet" configs with ones that enable ASAN! --- .../fuzzing/arm64-windows-static.cmake | 6 ++++++ dep/vcpkg-overlay-triplets/fuzzing/x64-windows-static.cmake | 6 ++++++ dep/vcpkg-overlay-triplets/fuzzing/x86-windows-static.cmake | 6 ++++++ src/common.build.pre.props | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 dep/vcpkg-overlay-triplets/fuzzing/arm64-windows-static.cmake create mode 100644 dep/vcpkg-overlay-triplets/fuzzing/x64-windows-static.cmake create mode 100644 dep/vcpkg-overlay-triplets/fuzzing/x86-windows-static.cmake diff --git a/dep/vcpkg-overlay-triplets/fuzzing/arm64-windows-static.cmake b/dep/vcpkg-overlay-triplets/fuzzing/arm64-windows-static.cmake new file mode 100644 index 0000000000..41bcac2329 --- /dev/null +++ b/dep/vcpkg-overlay-triplets/fuzzing/arm64-windows-static.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CXX_FLAGS /fsanitize=address) +set(VCPKG_C_FLAGS /fsanitize=address) diff --git a/dep/vcpkg-overlay-triplets/fuzzing/x64-windows-static.cmake b/dep/vcpkg-overlay-triplets/fuzzing/x64-windows-static.cmake new file mode 100644 index 0000000000..909e747923 --- /dev/null +++ b/dep/vcpkg-overlay-triplets/fuzzing/x64-windows-static.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CXX_FLAGS /fsanitize=address) +set(VCPKG_C_FLAGS /fsanitize=address) diff --git a/dep/vcpkg-overlay-triplets/fuzzing/x86-windows-static.cmake b/dep/vcpkg-overlay-triplets/fuzzing/x86-windows-static.cmake new file mode 100644 index 0000000000..60a3c5e9cb --- /dev/null +++ b/dep/vcpkg-overlay-triplets/fuzzing/x86-windows-static.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE static) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CXX_FLAGS /fsanitize=address) +set(VCPKG_C_FLAGS /fsanitize=address) diff --git a/src/common.build.pre.props b/src/common.build.pre.props index 4e2346eb05..b3f57bf230 100644 --- a/src/common.build.pre.props +++ b/src/common.build.pre.props @@ -262,7 +262,7 @@ FUZZING_BUILD;%(PreprocessorDefinitions) - libsancov.lib;clang_rt.asan-$(OCClangArchitectureName).lib;%(AdditionalDependencies) + libsancov.lib;clang_rt.asan_dynamic-$(OCClangArchitectureName).lib;%(AdditionalDependencies) @@ -279,12 +279,14 @@ arm64 --x-feature=terminal + $(VcpkgAdditionalInstallOptions) --overlay-triplets=$(SolutionDir)\dep\vcpkg-overlay-triplets\fuzzing false $(SolutionDir)\obj\$(Platform)\vcpkg + $(SolutionDir)\obj\$(Platform)\vcpkg-fuzzing $(VCPKG_ROOT) $(VsInstallRoot)\VC\vcpkg