Run time linker and library symbols

Did you know that almost all programs are incomplete until you start them? When programmers compile a program, it is only partially complete. When you start a program, the operating system looks at the program and runs another program to make it complete — called a run time linker. In the case of modern Linux, it’s usually /lib/ld-linux.so.2. Read the manpage on ‘ld.so‘ for more information.

  • You can find out what libraries your program uses with ldd /path/to/program. You can also run it as follows (assuming you’re using bash/ksh/zsh): LD_DEBUG=files program
  • Find out what symbols a program uses and from which shared libraries: LD_DEBUG=bindings program
  • Have you ever wanted to find out what shared library contains the code or definition for a function or symbol? David Wheeler shows how you can find it: nm -o /lib/* /usr/lib/*/* | grep symbol_name Then look for the capital “T”. Read the Program Library HOWTO by David Wheeler.