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