Search code examples
cunixshared-librariesace

dynamic library loading : easy way to figure out unresolved symbols runtime


I am working on a huge project which is loading dynamic libraries at runtime using ACE_DLL::open.

Library is located and tries to open but fails on mmap ( below is the strace ) because of unresolved symbols. I know for sure that its because of unresolved symbols and by running nm I could get the list of all unresolved symbols. Problem is there are tons of unresolved symbols at compile time which should in turn be resolved at run time, so nm is not very helpful as I need to go through all symbols one by one.

Is there a smart way to figure out exact what is causing the .so to be loaded

open("libxxxxxxx_d.so", O_RDONLY) = 29
read(29, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300w\3\0004\0\0\0"..., 512) = 512
fstat64(29, {st_mode=S_IFREG|0755, st_size=10130306, ...}) = 0
mmap2(NULL, 373832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 29, 0) = 0xffffffffed5f5000
mmap2(0xed64e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 29, 0x59)  =   0xffffffffed64e000
close(29)                               = 0
munmap(0xed5f5000, 373832)              = 0
munmap(0xed5cc000, 167764)              = 0

Solution

  • Set ACE_DEBUG=1 as environment variable, the ACE logging should than print a debug message indicating which symbol is unresolved. This is just one symbol, so you probably need several iterations to find all