| 15 | class LateInitializer { |
| 16 | public: |
| 17 | LateInitializer() { |
| 18 | Dl_info dl_info; |
| 19 | if (!OS::isMusl() && dladdr((const void*)Hooks::init, &dl_info) && dl_info.dli_fname != NULL) { |
| 20 | // Make sure async-profiler DSO cannot be unloaded, since it contains JVM callbacks. |
| 21 | // This is not relevant for musl, where dlclose() is no-op. |
| 22 | // Can't use ELF NODELETE flag because of https://sourceware.org/bugzilla/show_bug.cgi?id=20839 |
| 23 | dlopen(dl_info.dli_fname, RTLD_LAZY | RTLD_NODELETE); |
| 24 | } |
| 25 | |
| 26 | if (!checkJvmLoaded()) { |
| 27 | const char* command = getenv("ASPROF_COMMAND"); |
| 28 | if (command != NULL && OS::checkPreloaded() && Hooks::init(false)) { |
| 29 | startProfiler(command); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | bool checkJvmLoaded() { |
nothing calls this directly
no test coverage detected