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
17static int pad1;
18static int static_var;
19static int pad2;
20
21extern "C"
22int *get_address_of_static_var() {
23  return &static_var;
24}
25
26__attribute__((constructor))
27void at_dlopen() {
28  printf("%s: I am being dlopened\n", __FILE__);
29}
30__attribute__((destructor))
31void at_dlclose() {
32  printf("%s: I am being dlclosed\n", __FILE__);
33}
34