aboutsummaryrefslogtreecommitdiff
path: root/tests/libs/dlopen_b.cpp
blob: 092c96c9539c1b18efdb56a3e1f316b941b87ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <dlfcn.h>
extern "C" void *dlopen_b() {
  // Work around for http://b/20049306, which isn't going to be fixed.
  static int defeat_sibling_call_optimization = 0;

  // This is supposed to succeed because this library has DT_RUNPATH
  // for libtest_dt_runpath_x.so which should be taken into account
  // by dlopen.
  void *handle = dlopen("libtest_dt_runpath_x.so", RTLD_NOW);
  if (handle != nullptr) {
    defeat_sibling_call_optimization++;
    return handle;
  }
  return nullptr;
}