Continuation of D147432 and D147444.
Differential Revision: https://reviews.llvm.org/D150267
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Build an executable with ASan, then extract the DLLs that it depends on.
-// RUN: %clang_cl_asan %s -Fe%t.exe
+// RUN: %clang_cl_asan %s %Fe%t.exe
// RUN: llvm-readobj --coff-imports %t.exe | grep Name: | sed -e 's/ *Name: *//' > %t
//
// Make sure the binary doesn't depend on dbghelp directly.
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: %run %t %t.dll | FileCheck %s
#include <malloc.h>
#include <stdio.h>
+#ifdef __MINGW32__
+// FIXME: remove after mingw-w64 adds this declaration.
+extern "C" size_t __cdecl _aligned_msize(void *_Memory, size_t _Alignment, size_t _Offset);
+#endif
+
#define CHECK_ALIGNED(ptr,alignment) \
do { \
if (((uintptr_t)(ptr) % (alignment)) != 0) \
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: %run %t %t.dll | FileCheck %s
#include <malloc.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
// On windows 64-bit, the memchr function is written in assembly and is not
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <stdio.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <stdio.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <malloc.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <malloc.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <process.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
__attribute__((noinline))
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
extern "C" __declspec(dllexport)
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
struct C {
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <sanitizer/asan_interface.h>
should_crash(&buffer[96]);
// CHECK: AddressSanitizer: use-after-poison on address [[ADDR:0x[0-9a-f]+]]
// CHECK-NEXT: WRITE of size 1 at [[ADDR]] thread T0
-// CHECK-NEXT: should_crash{{.*}}\dll_poison_unpoison.cpp
-// CHECK-NEXT: test_function{{.*}}\dll_poison_unpoison.cpp:[[@LINE-4]]
+// CHECK-NEXT: should_crash{{.*[\\/]}}dll_poison_unpoison.cpp
+// CHECK-NEXT: test_function{{.*[\\/]}}dll_poison_unpoison.cpp:[[@LINE-4]]
// CHECK-NEXT: main
//
// CHECK: [[ADDR]] is located in stack of thread T0 at offset [[OFFSET:.*]] in frame
-// CHECK-NEXT: test_function{{.*}}\dll_poison_unpoison.cpp
+// CHECK-NEXT: test_function{{.*[\\/]}}dll_poison_unpoison.cpp
// CHECK: 'buffer'{{.*}} <== Memory access at offset [[OFFSET]] is inside this variable
return 0;
}
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: %env_asan_opts=detect_stack_use_after_return=1 not %run %t %t.dll 2>&1 | FileCheck %s
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll -fsanitize-address-use-after-return=always
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll -fsanitize-address-use-after-return=always
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <malloc.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %p/dll_host.cpp -Fe%t
-// RUN: %clang_cl_asan -LD -Od %s -Fe%t.dll
+// RUN: %clang_cl_asan %Od %p/dll_host.cpp %Fe%t
+// RUN: %clang_cl_asan %LD %Od %s %Fe%t.dll
// RUN: not %run %t %t.dll 2>&1 | FileCheck %s
#include <windows.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include <stdio.h>
#include <windows.h>
-// RUN: %clang_cl_asan -LD /Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl /Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %te.exe %t.dll 2>&1 | FileCheck %s
// REQUIRES: asan-dynamic-runtime
// REQUIRES: asan-32-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// UNSUPPORTED: asan-64-bits
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
#include <windows.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include <stdio.h>
#include <windows.h>
-// RUN: %clang_cl_asan -LD /Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl /Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %te.exe %t.dll 2>&1 | FileCheck %s
// REQUIRES: asan-dynamic-runtime
// REQUIRES: asan-32-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include <stdio.h>
#include <windows.h>
-// RUN: %clang_cl_asan -LD /Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl /Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %te.exe %t.dll 2>&1 | FileCheck %s
// REQUIRES: asan-dynamic-runtime
// REQUIRES: asan-32-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <cassert>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=allocator_may_return_null=true %run %t
// RUN: %env_asan_opts=allocator_may_return_null=true:windows_hook_rtl_allocators=true %run %t
// UNSUPPORTED: asan-64-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include "sanitizer\allocator_interface.h"
#include <cassert>
#include <stdio.h>
// CHECK-NOT: Assertion failed:
// CHECK-NOT: AddressSanitizer
-// CHECK: Success
\ No newline at end of file
+// CHECK: Success
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include "sanitizer\allocator_interface.h"
#include <cassert>
#include <stdio.h>
// CHECK-NOT: assert
// CHECK-NOT: AddressSanitizer
-// CHECK: Success
\ No newline at end of file
+// CHECK: Success
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <windows.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan /Od -o %t %s
+// RUN: %clang_cl_asan %Od -o %t %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s
-// RUN: %clang_cl /Od -o %t %s
+// RUN: %clang_cl %Od -o %t %s
// RUN: %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <cassert>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <stdio.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan /Od /MT -o %t %s
+// RUN: %clang_cl_asan %Od %MT -o %t %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <cassert>
// CHECK: allocated!
// CHECK-NOT: heap-buffer-overflow
// CHECK-NOT: AddressSanitizer
-// CHECK-NOT: HeapAlloc size failure!
\ No newline at end of file
+// CHECK-NOT: HeapAlloc size failure!
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan /Od -o %t %s
+// RUN: %clang_cl_asan %Od -o %t %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
// RUN: %env_asan_opts=windows_hook_rtl_allocators=false %run %t 2>&1 | FileCheck %s
-// RUN: %clang_cl /Od -o %t %s
+// RUN: %clang_cl %Od -o %t %s
// RUN: %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
#include <cassert>
// CHECK-NOT: double-free
// CHECK-NOT: AddressSanitizer
-// CHECK: passed!
\ No newline at end of file
+// CHECK: passed!
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Workaround for "LINK : fatal error LNK1318: Unexpected PDB error"
// RUN: rm -f %t.pdb
}
// CHECK-NOT: Assertion
-// CHECK: passed
\ No newline at end of file
+// CHECK: passed
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Make sure we can handle reloading the same DLL multiple times.
-// RUN: %clang_cl_asan -LD -Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl_asan -Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl_asan %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=report_globals=1 %run %te.exe %t.dll 2>&1 | FileCheck %s
#include <windows.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -LD -Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl_asan -Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl_asan %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=report_globals=2 %run %te.exe %t.dll 2>&1 | FileCheck %s
#include <windows.h>
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t /MD
+// RUN: %clang_cl_asan %Od %s %Fe%t %MD
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
// REQUIRES: asan-rtl-heap-interception
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -LD /Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl /Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %te.exe %t.dll 2>&1 | FileCheck %s
// REQUIRES: asan-dynamic-runtime
// REQUIRES: asan-32-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -LD /Od -DDLL %s -Fe%t.dll
-// RUN: %clang_cl /Od -DEXE %s -Fe%te.exe
+// RUN: %clang_cl_asan %LD %Od -DDLL %s %Fe%t.dll
+// RUN: %clang_cl %Od -DEXE %s %Fe%te.exe
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %te.exe %t.dll 2>&1 | FileCheck %s
// REQUIRES: asan-dynamic-runtime
// REQUIRES: asan-32-bits
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t /MD
+// RUN: %clang_cl_asan %Od %s %Fe%t %MD
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
// REQUIRES: asan-rtl-heap-interception
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t /MD
+// RUN: %clang_cl_asan %Od %s %Fe%t %MD
// RUN: %env_asan_opts=windows_hook_rtl_allocators=true not %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: asan-64-bits
// REQUIRES: asan-rtl-heap-interception
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
#include <Windows.h>
#include <stdio.h>
#include <sanitizer/allocator_interface.h>
#include <psapi.h>
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %t
// REQUIRES: asan-64-bits
}
return 0;
-}
\ No newline at end of file
+}
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: %env_asan_opts=detect_stack_use_after_return=1 not %run %t 2>&1 | FileCheck %s
-// RUN: %clang_cl_asan -Od %s -Fe%t -fsanitize-address-use-after-return=always
+
+// RUN: %clang_cl_asan %Od %s %Fe%t -fsanitize-address-use-after-return=always
// RUN: not %run %t 2>&1 | FileCheck %s
char *x;
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
// Make sure symbolization works even if the path to the .exe file changes.
// RUN: mkdir %t || true
-// RUN: %clang_cl_asan -Od %s -Fe%t/symbols_path.exe
+// RUN: %clang_cl_asan %Od %s %Fe%t/symbols_path.exe
// RUN: not %run %t/symbols_path.exe 2>&1 | FileCheck %s
// RUN: mkdir %t2 || true
// RUN: mv %t/* %t2
-// UNSUPPORTED: target={{.*-windows-gnu}}
-
-// RUN: %clang_cl_asan -Od %s -Fe%t
+// RUN: %clang_cl_asan %Od %s %Fe%t
// RUN: env ASAN_OPTIONS=handle_segv=0 %run %t 2>&1 | FileCheck %s --check-prefix=USER
// RUN: env ASAN_OPTIONS=handle_segv=1 not %run %t 2>&1 | FileCheck %s --check-prefix=ASAN
// Test the default.
config.substitutions.append( ("%clang_cl_asan ", clang_cl_asan_invocation) )
config.substitutions.append( ("%Od", "-Od") )
config.substitutions.append( ("%Fe", "-Fe") )
+ config.substitutions.append( ("%LD", "-LD") )
+ config.substitutions.append( ("%MD", "-MD") )
+ config.substitutions.append( ("%MT", "-MT") )
base_lib = os.path.join(config.compiler_rt_libdir, "clang_rt.asan%%s%s.lib" % config.target_suffix)
config.substitutions.append( ("%asan_lib", base_lib % "") )
config.substitutions.append( ("%clang_cl_asan ", build_invocation(clang_asan_cxxflags)) )
config.substitutions.append( ("%Od", "-O0") )
config.substitutions.append( ("%Fe", "-o") )
+ config.substitutions.append( ("%LD", "-shared") )
+ config.substitutions.append( ("%MD", "") )
+ config.substitutions.append( ("%MT", "") )
# FIXME: De-hardcode this path.
asan_source_dir = os.path.join(