[compiler-rt] 6282315 - [asan][test][win] Port more tests to not use clang-cl on MinGW (3)
Alvin Wong via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 04:54:27 PDT 2023
Author: Alvin Wong
Date: 2023-05-16T19:53:49+08:00
New Revision: 6282315f8ae52fda7d2eaa1e2ecd6d3dbb614f51
URL: https://github.com/llvm/llvm-project/commit/6282315f8ae52fda7d2eaa1e2ecd6d3dbb614f51
DIFF: https://github.com/llvm/llvm-project/commit/6282315f8ae52fda7d2eaa1e2ecd6d3dbb614f51.diff
LOG: [asan][test][win] Port more tests to not use clang-cl on MinGW (3)
This ports tests which requires additional link flags.
Differential Revision: https://reviews.llvm.org/D150268
Added:
Modified:
compiler-rt/test/asan/TestCases/Windows/dll_heap_allocation.cpp
compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cpp
compiler-rt/test/asan/TestCases/Windows/null_deref_multiple_dlls.cpp
compiler-rt/test/asan/TestCases/Windows/shadow_conflict_32.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_heap_allocation.cpp b/compiler-rt/test/asan/TestCases/Windows/dll_heap_allocation.cpp
index 40e48335e8549..b8c2c1a24d4ce 100644
--- a/compiler-rt/test/asan/TestCases/Windows/dll_heap_allocation.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/dll_heap_allocation.cpp
@@ -1,7 +1,6 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl -LD %s -Fe%t.dll -DHEAP_LIBRARY -MD
-// RUN: %clang_cl %s %t.lib -Fe%t -fsanitize=address -MT
+// RUN: %clang_cl %LD %s %Fe%t.dll -DHEAP_LIBRARY %MD \
+// RUN: %if target={{.*-windows-gnu}} %{ -Wl,--out-implib,%t.lib %}
+// RUN: %clang_cl %s %t.lib %Fe%t -fsanitize=address %MT
// RUN: %run %t 2>&1 | FileCheck %s
// Check that ASan does not fail when releasing allocations that occurred within
@@ -18,6 +17,7 @@ BOOL WINAPI DllMain(PVOID h, DWORD reason, PVOID reserved) {
#else
+#include <cstdio>
#include <memory>
extern std::unique_ptr<int> __declspec(dllimport) myglobal;
int main(int argc, char **argv) {
diff --git a/compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cpp b/compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cpp
index c9fc1669bc707..e3efa0a1a4fd2 100644
--- a/compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/dll_report_globals_symbolization_at_startup.cpp
@@ -1,7 +1,6 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -LD -Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl_asan -Od -DEXE %s %t.lib -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll \
+// RUN: %if target={{.*-windows-gnu}} %{ -Wl,--out-implib,%t.lib %}
+// RUN: %clang_cl_asan %Od -DEXE %s %t.lib %Fe%te.exe
// RUN: %env_asan_opts=report_globals=2 %run %te.exe 2>&1 | FileCheck %s
// FIXME: Currently, the MT runtime build crashes on startup due to dbghelp.dll
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 04f8b925a4a32..e31e597463704 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
@@ -1,12 +1,12 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Make sure everything works even if the main module doesn't have any stack
// variables, thus doesn't explicitly reference any symbol exported by the
// runtime thunk.
//
-// RUN: %clang_cl_asan -LD -Od -DDLL1 %s -Fe%t1.dll
-// RUN: %clang_cl_asan -LD -Od -DDLL2 %s -Fe%t2.dll
-// RUN: %clang_cl_asan -Od -DEXE %s %t1.lib %t2.lib -Fe%t
+// RUN: %clang_cl_asan %LD %Od -DDLL1 %s %Fe%t1.dll \
+// RUN: %if target={{.*-windows-gnu}} %{ -Wl,--out-implib,%t1.lib %}
+// RUN: %clang_cl_asan %LD %Od -DDLL2 %s %Fe%t2.dll \
+// RUN: %if target={{.*-windows-gnu}} %{ -Wl,--out-implib,%t2.lib %}
+// RUN: %clang_cl_asan %Od -DEXE %s %t1.lib %t2.lib %Fe%t
// RUN: not %run %t 2>&1 | FileCheck %s
#include <malloc.h>
diff --git a/compiler-rt/test/asan/TestCases/Windows/shadow_conflict_32.cpp b/compiler-rt/test/asan/TestCases/Windows/shadow_conflict_32.cpp
index c08fcc346ba6b..d032418e476fb 100644
--- a/compiler-rt/test/asan/TestCases/Windows/shadow_conflict_32.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/shadow_conflict_32.cpp
@@ -1,11 +1,13 @@
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Load this DLL at the default 32-bit ASan shadow base, and test how we dump
// the process memory layout.
// REQUIRES: asan-32-bits
//
-// RUN: %clang_cl_asan -DBUILD_DLL -LD %s -Fe%t_dll.dll -link -base:0x30000000 -fixed -dynamicbase:no
-// RUN: %clang_cl_asan %s -Fe%t.exe -link %t_dll.lib
+// RUN: %clang_cl_asan -DBUILD_DLL %LD %s %Fe%t_dll.dll \
+// RUN: %if target={{.*-windows-gnu}} %{ \
+// RUN: -Wl,--image-base,0x30000000,--disable-reloc-section \
+// RUN: -Wl,--disable-dynamicbase,--out-implib,%t_dll.lib \
+// RUN: %} %else %{ -link -base:0x30000000 -fixed -dynamicbase:no %}
+// RUN: %clang_cl_asan %s %Fe%t.exe %t_dll.lib
// RUN: not %run %t.exe 2>&1 | FileCheck %s
#ifndef BUILD_DLL
More information about the llvm-commits
mailing list