Linkers, Loaders & Executables

What does running the ldd command on an executable on Linux show?

  1. AThe shared libraries the executable needs and where each is found
  2. BThe executable's source code
  3. CThe CPU time the executable used
Show answer and explanation

Answer: A. The shared libraries the executable needs and where each is found

ldd lists the shared libraries used by a dynamically linked executable or shared library and which file each resolves to. Missing ones are shown as "not found", which helps diagnose a program that will not start. Note that running it on an untrusted executable can execute code inside it, so care is needed.

  • A. Correct. It is used to examine dependencies.
  • B. Source code is not contained in the executable.
  • C. CPU time is measured with commands such as time.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. Which pairs major operating systems with the executable formats they use correctly?
  2. When recursion goes so deep that it exceeds the stack limit, what generally happens on Linux and similar systems?
  3. In C, what is true of the starting values of a local variable and a global variable declared without initializers?
  4. After repeated malloc and free, a large block may become impossible to allocate even though total free memory is sufficient. What is this phenomenon called?
  5. When building a shared library, what is the advantage of exporting only the public functions and giving internal functions "hidden" symbol visibility?