aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/asan/dlclose-test-1-so.cc
blob: 99f00e2300745b04615fb5ec0c1f727de430bfa7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//===----------- dlclose-test-so.cc -----------------------------*- C++ -*-===//
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of AddressSanitizer, an address sanity checker.
//
// Regression test for
// http://code.google.com/p/address-sanitizer/issues/detail?id=19
//===----------------------------------------------------------------------===//

#include <stdio.h>

static int pad1;
static int static_var;
static int pad2;

extern "C"
int *get_address_of_static_var() {
  return &static_var;
}

__attribute__((constructor))
void at_dlopen() {
  printf("%s: I am being dlopened\n", __FILE__);
}
__attribute__((destructor))
void at_dlclose() {
  printf("%s: I am being dlclosed\n", __FILE__);
}