Не могли бы вы использовать для этого рекурсивную версию ldd? Кто-то, кажется, написал скрипт , который может помочь. Это, по крайней мере, говорит о том, что все библиотеки зависимостей могут быть разрешены, если они были указаны в .so в первую очередь правильно. Вы можете гарантировать, что все зависимости указаны в .so с опциями компоновщика, и этот плюс рекурсивный ldd гарантирует отсутствие неразрешенных символов.
У линкеров часто есть возможность сделать неразрешенные символы в общих библиотеках ошибкой, и вы можете использовать это, чтобы вообще не проверять. Для GNU ld вы можете просто передать --no-allow-shlib-undefined, и вы гарантировано, что если он создаст .so, у него не будет неразрешенных символов. Из документации GNU:
--no-undefined
Report unresolved symbol references from regular object files.
This is done even if the linker is creating a non-symbolic shared
library. The switch --[no-]allow-shlib-undefined controls the
behaviour for reporting unresolved references found in shared
libraries being linked in.
--allow-shlib-undefined
--no-allow-shlib-undefined
Allows (the default) or disallows undefined symbols in shared
libraries. This switch is similar to --no-undefined except
that it determines the behaviour when the undefined symbols are
in a shared library rather than a regular object file. It does
not affect how undefined symbols in regular object files are
handled.
The reason that --allow-shlib-undefined is the default is that the
shared library being specified at link time may not be the
same as the one that is available at load time, so the symbols might
actually be resolvable at load time. Plus there are some systems,
(eg BeOS) where undefined symbols in shared libraries is normal.
(The kernel patches them at load time to select which function is most
appropriate for the current architecture. This is used for example to
dynamically select an appropriate memset function). Apparently it is
also normal for HPPA shared libraries to have undefined symbols.
Если вы собираетесь пройти проверку после ссылки, я согласен с Мартином, что, вероятно, вам лучше всего выбрать nm. Я обычно просто выбираю 'U' в выводе, чтобы проверить наличие неразрешенных символов, так что я думаю, что написать довольно простой сценарий.