[compiler-rt] 2289785 - [asan] Fix Windows tests
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 00:18:24 PDT 2024
Author: Vitaly Buka
Date: 2024-08-08T00:17:19-07:00
New Revision: 22897855c8253c8604ae65f61cc34a8fd95dbe61
URL: https://github.com/llvm/llvm-project/commit/22897855c8253c8604ae65f61cc34a8fd95dbe61
DIFF: https://github.com/llvm/llvm-project/commit/22897855c8253c8604ae65f61cc34a8fd95dbe61.diff
LOG: [asan] Fix Windows tests
Fix Windows after #101853.
Added:
Modified:
compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp
compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp
compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp b/compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp
index e31e597463704f..ea5140a13dc883 100644
--- a/compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp
@@ -12,31 +12,34 @@
#include <malloc.h>
#include <string.h>
-extern "C" {
#if defined(EXE)
+extern "C" {
__declspec(dllimport) void foo1();
__declspec(dllimport) void foo2();
+}
int main() {
foo1();
foo2();
}
#elif defined(DLL1)
+extern "C" {
__declspec(dllexport) void foo1() {}
+}
#elif defined(DLL2)
-__attribute__((noinline))
-static void NullDeref(int *ptr) {
+extern "C" {
+__attribute__((noinline)) static void NullDeref(int *ptr) {
// CHECK: ERROR: AddressSanitizer: access-violation on unknown address
// CHECK: {{0x0*000.. .*pc 0x.*}}
- ptr[10]++; // BOOM
+ ptr[10]++; // BOOM
}
__declspec(dllexport) void foo2() {
- NullDeref((int*)0);
+ NullDeref((int *)0);
// CHECK: {{ #1 0x.* in foo2.*null_deref_multiple_dlls.cpp:}}[[@LINE-1]]
// CHECK: AddressSanitizer can not provide additional info.
}
+}
#else
-# error oops!
+# error oops!
#endif
-}
diff --git a/compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp b/compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp
index ac1f1a3b7f39b3..f9627b9ad3b579 100644
--- a/compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/report_globals_reload_dll.cpp
@@ -7,7 +7,6 @@
#include <stdio.h>
#include <string.h>
-extern "C" {
#if defined(EXE)
int main(int argc, char **argv) {
if (argc != 2) {
@@ -40,12 +39,13 @@ int main(int argc, char **argv) {
fflush(0);
}
#elif defined(DLL)
+extern "C" {
BOOL WINAPI DllMain(HMODULE, DWORD reason, LPVOID) {
printf("in DLL(reason=%d)\n", (int)reason);
fflush(0);
return TRUE;
}
+}
#else
# error oops!
#endif
-}
diff --git a/compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp b/compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp
index 65586077bc4581..7cad3f39be1ec2 100644
--- a/compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/report_globals_vs_freelibrary.cpp
@@ -6,7 +6,6 @@
#include <stdio.h>
#include <string.h>
-extern "C" {
#if defined(EXE)
int main(int argc, char **argv) {
if (argc != 2) {
@@ -36,12 +35,13 @@ int main(int argc, char **argv) {
fflush(0);
}
#elif defined(DLL)
+extern "C" {
BOOL WINAPI DllMain(HMODULE, DWORD reason, LPVOID) {
printf("in DLL(reason=%d)\n", (int)reason);
fflush(0);
return TRUE;
}
+}
#else
# error oops!
#endif
-}
More information about the llvm-commits
mailing list