1

I'm trying understand how some parts of a closed source program distributed as a stripped binary implemented. When I run ldd on the program, it prints only 4-5 most basic C libraries as dynamic dependencies. (e.g. libc, glib, gobject etc.) However, when I run it in gdb or attach gdb to it and run info sharedlibrary, it prints a huge list of libraries. Indeed, that program clearly uses GTK for GUI, for example, but gtk libraries are missing in ldd output and shown in info sharedlibrary output.

I was wondering does it work and how did they achieve this. Any ideas?

Thanks.

1 Answer 1

1

They can load their dynamic libraries dynamically by using dlopen and dlsym functions. Here is the man page of dlsym and usage example

2
  • You're definitely correct, I set breakpoints on dlopen and dlsym, and it stopped at dlopen. When I print (char*) $rdi it printed "libcairo.so". Now, my question is, why would they do that? Those libraries export huge number of symbols, are they manually linking all of them? Any ideas why would I want this?
    – sinan
    Mar 22, 2015 at 14:15
  • They probably do it for cross-platform compatibility reasons.
    – w s
    Mar 22, 2015 at 18:06

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.