From de06288019e62ee563d6958fb0fb7d0ffb8a2e62 Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Tue, 22 Oct 2024 00:28:19 -0700 Subject: UnitTestFrameworkPkg: Use /MTd and enable Address Sanitizers * Update host based unit test VS20xx builds to use /MTd instead of /MT to enable use of debug libraries for host based unit tests. * Enable /fsanitize=address for host based unit test VS2019 builds * Enable /fsanitize=address for host based unit test VS2022 builds * Enable -fsanitize=address for host based unit test GCC builds * Add UNIT_TESTING_ADDRESS_SANITIZER_ENABLE define that is set to TRUE by default so it is always enabled, but can be set to FALSE to temporarily disable during development/debug of unit tests. * Add address sanitizer information to ReadMe.md Enabling the Address Sanitizer can detect double frees, buffer overflow, buffer underflow, access to invalid addresses, and various exceptions. These can be detected in both the unit test case sources as well as the code under test. Signed-off-by: Michael D Kinney --- .../Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf') diff --git a/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf b/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf index 9a7673f179..7458df7948 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf +++ b/UnitTestFrameworkPkg/Library/UnitTestDebugAssertLib/UnitTestDebugAssertLibHost.inf @@ -31,6 +31,6 @@ UnitTestLib [BuildOptions] - MSFT:*_*_*_CC_FLAGS == /c /EHs /Zi /Od /MT + MSFT:*_*_*_CC_FLAGS == /c /EHs /Zi /Od /MTd GCC:*_*_IA32_CC_FLAGS == -g -c -fshort-wchar -fexceptions -O0 -m32 -malign-double -fno-pie GCC:*_*_X64_CC_FLAGS == -g -c -fshort-wchar -fexceptions -O0 -m64 -fno-pie "-DEFIAPI=__attribute__((ms_abi))" -- cgit v1.2.3