Evgenii Stepanov | 6865082 | 2015-06-10 13:38:39 -0700 | [diff] [blame] | 1 | #include <dlfcn.h> |
| 2 | extern "C" void *dlopen_b() { |
Elliott Hughes | 68ae6ad | 2020-07-21 16:11:30 -0700 | [diff] [blame] | 3 | // Work around for http://b/20049306, which isn't going to be fixed. |
| 4 | static int defeat_sibling_call_optimization = 0; |
Dmitriy Ivanov | 7d09a8c | 2015-06-23 13:44:18 -0700 | [diff] [blame] | 5 | |
Dmitriy Ivanov | a1feb11 | 2015-10-01 18:41:57 -0700 | [diff] [blame] | 6 | // This is supposed to succeed because this library has DT_RUNPATH |
| 7 | // for libtest_dt_runpath_x.so which should be taken into account |
| 8 | // by dlopen. |
Evgenii Stepanov | 6865082 | 2015-06-10 13:38:39 -0700 | [diff] [blame] | 9 | void *handle = dlopen("libtest_dt_runpath_x.so", RTLD_NOW); |
Dmitriy Ivanov | 7d09a8c | 2015-06-23 13:44:18 -0700 | [diff] [blame] | 10 | if (handle != nullptr) { |
Elliott Hughes | 68ae6ad | 2020-07-21 16:11:30 -0700 | [diff] [blame] | 11 | defeat_sibling_call_optimization++; |
Dmitriy Ivanov | 7d09a8c | 2015-06-23 13:44:18 -0700 | [diff] [blame] | 12 | return handle; |
| 13 | } |
| 14 | return nullptr; |
Evgenii Stepanov | 6865082 | 2015-06-10 13:38:39 -0700 | [diff] [blame] | 15 | } |