Files
clang-p2996/compiler-rt/test/asan/TestCases/report_error_summary.cpp
Charlie Barto 53a81d4d26 Reland [asan][windows] Eliminate the static asan runtime on windows (#107899)
This reapplies 8fa66c6ca7 ([asan][windows]
Eliminate the static asan runtime on windows) for a second time.

That PR bounced off the tests because it caused failures in the other
sanitizer runtimes, these have been fixed by only building interception,
sanitizer_common, and asan with /MD, and continuing to build the rest of
the runtimes with /MT. This does mean that any usage of the static
ubsan/fuzzer/etc runtimes will mean you're mixing different runtime
library linkages in the same app, the interception, sanitizer_common,
and asan runtimes are designed for this, however it does result in some
linker warnings.

Additionally, it turns out when building in release-mode with
LLVM_ENABLE_PDBs the build system forced /OPT:ICF. This totally breaks
asan's "new" method of doing "weak" functions on windows, and so
/OPT:NOICF was explicitly added to asan's link flags.

---------

Co-authored-by: Amy Wishnousky <amyw@microsoft.com>
2024-09-09 13:41:08 -07:00

21 lines
427 B
C++

// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <stdio.h>
// Required for ld64 macOS 12.0+
__attribute__((weak)) extern "C" void foo() {}
extern "C" void __sanitizer_report_error_summary(const char *summary) {
fprintf(stderr, "test_report_error_summary\n");
// CHECK: test_report_error_summary
fflush(stderr);
}
char *x;
int main() {
x = new char[20];
delete[] x;
return x[0];
}