Skip to content

Instantly share code, notes, and snippets.

@liviaerxin
Last active September 2, 2024 11:48
Show Gist options
  • Save liviaerxin/63064ba5e349efc43de96b5cd3f902ed to your computer and use it in GitHub Desktop.
Save liviaerxin/63064ba5e349efc43de96b5cd3f902ed to your computer and use it in GitHub Desktop.
Library Diagnosis(*.so, *.dylib, *.dll)

Library Diagnosis

linker - Equivalent of DYLD_PRINT_LIBRARIES on linux? - Stack Overflow

linux - How do I find out what all symbols are exported from a shared object? - Stack Overflow

Linux

# print runtime loaded and accessed libraries
LD_DEBUG=libs ./binary_name
# show linked libraries
ldd ./binary_name
ldd *.so

LD_TRACE_LOADED_OBJECTS=1 ./binary_name
# show all symbols exported from libraries

# For an ELF shared library
readelf -Ws --dyn-syms /path/to/libfoo.so
nm -D /path/to/libfoo.so

# For an AIX shared object
dump -Tv /path/to/foo.o

# For a Windows DLL, use 
dumpbin /EXPORTS foo.dll.

OSX

# print runtime loaded and accessed libraries
DYLD_PRINT_LIBRARIES=1 ./dlopen_test.out
# show linked libraries
otool -L *.dylib
# show all symbols exported from libraries
nm -D /path/to/libfoo.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment