| 1 | // Load this DLL at the default 32-bit ASan shadow base, and test how we dump |
| 2 | // the process memory layout. |
| 3 | // REQUIRES: asan-32-bits |
| 4 | // |
| 5 | // RUN: %clang_cl_asan -DBUILD_DLL %LD %s %Fe%t_dll.dll \ |
| 6 | // RUN: %if target={{.*-windows-gnu}} %{ \ |
| 7 | // RUN: -Wl,--image-base,0x30000000,--disable-reloc-section \ |
| 8 | // RUN: -Wl,--disable-dynamicbase,--out-implib,%t_dll.lib \ |
| 9 | // RUN: %} %else %{ -link -base:0x30000000 -fixed -dynamicbase:no %} |
| 10 | // RUN: %clang_cl_asan %s %Fe%t.exe %t_dll.lib |
| 11 | // RUN: not %run %t.exe 2>&1 | FileCheck %s |
| 12 | |
| 13 | #ifndef BUILD_DLL |
| 14 | #include <stdio.h> |
| 15 | |
| 16 | extern "C" __declspec(dllimport) int test_function(); |
| 17 | |
| 18 | int main() { |
| 19 | fprintf(stderr, format: "should have failed to initialize, DLL got loaded near 0x%p\n" , |
| 20 | (void *)&test_function); |
| 21 | } |
| 22 | |
| 23 | #else |
| 24 | extern "C" __declspec(dllexport) int test_function() { return 0; } |
| 25 | #endif |
| 26 | |
| 27 | // CHECK: =={{[0-9:]+}}==Shadow memory range interleaves with an existing memory mapping. ASan cannot proceed correctly. ABORTING. |
| 28 | // CHECK: =={{[0-9:]+}}==ASan shadow was supposed to be located in the [0x2fff0000-0x3fffffff] range. |
| 29 | // CHECK: =={{[0-9:]+}}==Dumping process modules |
| 30 | |
| 31 | // CHECK-DAG: {{0x30000000-0x300.....}} {{.*}}\shadow_conflict_32.cpp.tmp_dll.dll |
| 32 | // CHECK-DAG: {{0x........-0x........}} {{.*}}\shadow_conflict_32.cpp.tmp.exe |
| 33 | // CHECK-DAG: {{0x........-0x........}} {{.*}}\ntdll.dll |
| 34 | |