I am trying to get the address of a private function in GLIBC. For instance - the function __run_prefork_handlers().

I have done it with gdb, using info symbol __run_prefork_handlers and info address __run_prefork_handlers And I get the relevant information (relevant so) and address of the function.

I tried to get the address of this function programmatically using dlsym.

Since glibc is loaded by runtime loader at startup I call dlsym(RTLD_GLOBAL, "__run_prefork_handlers") without first calling dlopen.

I get a NULL pointer and perror returns:

undefined symbol: __run_prefork_handlers

Running the same code for symbol of an exported function such as fork works well.

Which steps should I take to get this information within a program?

  • Do nm, objdump and/or readelf show that symbol in one of the symbol tables? If not, the debugger has probably used debug symbols to get that address. In theory, though, that's something you could also do: parse the debug data.
    – 0xC0000022L
    Jan 17 at 10:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.