compnerd added a comment. I don't think that this really belongs in compiler-rt, this is really libc specific. For example, what about hooking into the Java class registration (see glibc's JV section)? Repository: rL LLVM https://reviews.llvm.org/D28791