summaryrefslogtreecommitdiff
path: root/tests/libs/ld_config_test_helper_lib2.cpp
blob: d5bca2c362116af63d2115deba13f9e44e40890f (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <dlfcn.h>
#include <stdio.h>

// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
// use.

__attribute__((weak)) extern "C" void bar() {
  printf("bar lib2\n");
  void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
  if (next != nullptr) next();
}