1 //===----------- dlclose-test-so.cc -----------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file is a part of AddressSanitizer, an address sanity checker. 11 // 12 // Regression test for 13 // http://code.google.com/p/address-sanitizer/issues/detail?id=19 14 //===----------------------------------------------------------------------===// 15 #include <stdio.h> 16 17 static int pad1; 18 static int static_var; 19 static int pad2; 20 21 extern "C" 22 int *get_address_of_static_var() { 23 return &static_var; 24 } 25 26 __attribute__((constructor)) 27 void at_dlopen() { 28 printf("%s: I am being dlopened\n", __FILE__); 29 } 30 __attribute__((destructor)) 31 void at_dlclose() { 32 printf("%s: I am being dlclosed\n", __FILE__); 33 } 34