brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · d032418 Raw
34 lines · cpp
1// Load this DLL at the default 32-bit ASan shadow base, and test how we dump2// the process memory layout.3// REQUIRES: asan-32-bits4//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.lib11// RUN: not %run %t.exe 2>&1 | FileCheck %s12 13#ifndef BUILD_DLL14#include <stdio.h>15 16extern "C" __declspec(dllimport) int test_function();17 18int main() {19  fprintf(stderr, "should have failed to initialize, DLL got loaded near 0x%p\n",20          (void *)&test_function);21}22 23#else24extern "C" __declspec(dllexport) int test_function() { return 0; }25#endif26 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 modules30 31// CHECK-DAG: {{0x30000000-0x300.....}} {{.*}}\shadow_conflict_32.cpp.tmp_dll.dll32// CHECK-DAG: {{0x........-0x........}} {{.*}}\shadow_conflict_32.cpp.tmp.exe33// CHECK-DAG: {{0x........-0x........}} {{.*}}\ntdll.dll34