Quick Linux Tip #55 - Check Exported Symbols in .so Files

Quick Linux Tip #55:

Question: A binary is failing with "undefined symbol". How do I check what a .so file exports?

Try: nm -D /usr/lib/x86_64-linux-gnu/libssl.so.3 | grep ' T ' | head -20

Info: nm -D displays the dynamic symbols available in a shared library. The T symbol type indicates a function defined in the library, while U indicates an undefined symbol that the library expects another shared library to provide.

Examples:

  • $ nm -D --defined-only /path/to/lib.so | grep function_name  # Find an exported symbol
  • $ ldd /usr/bin/nginx  # View shared library dependencies
  • $ objdump -T /path/to/lib.so | grep -w function_name  # Inspect the dynamic symbol table

Note: Common symbol flags include T for exported text/functions, U for undefined or imported symbols, and B/D for data. If a required symbol is missing, compare the binary's dependencies with ldd and inspect the library's exported symbols before replacing or changing shared libraries.




LinuxTeck.com
linuxteck@ubuntu:~$ nm -D /lib64/libssl.so.3 | grep ' T ' | head -9
0000000000045a30 T BIO_f_ssl
0000000000038c50 T DTLS_client_method
0000000000038c60 T DTLS_method
0000000000038c70 T DTLS_server_method
0000000000045a80 T SSL_CIPHER_description
0000000000045b20 T SSL_CIPHER_find
0000000000045b60 T SSL_CIPHER_get_bits
0000000000045ba0 T SSL_CIPHER_get_cipher_nid
0000000000045be0 T SSL_CIPHER_get_digest_nid

linuxteck@ubuntu:~$ ldd /usr/bin/curl | head -5
	linux-vdso.so.1 (0x00007ffd5abccdf0)
	libcurl.so.4 => /usr/lib/x86_64-linux-gnu/libcurl.so.4 (0x00007f8a12345000)
	libz.so.1 => /usr/lib/x86_64-linux-gnu/libz.so.1 (0x00007f8a23456000)
	libssl.so.3 => /usr/lib/x86_64-linux-gnu/libssl.so.3 (0x00007f8a34567000)
linuxteck@ubuntu:~$

PREVIOUS ARTICLE Quick Linux Tip #54 - Extract JSON Values with jq NEXT ARTICLE Quick Linux Tip #56 - My SSD Is Wearing Out. Which Process Is Writing the Most?
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.