Skip to content

dkpg-shlibdeps: Add option to ignore weak undefined symbols

Thomas Anderson requested to merge IgnoreWeakSymbols into master

Weak undefined symbols can be used to test feature support. For example:

attribute((weak)) uint64_t gbm_bo_get_modifier(struct gbm_bo* bo); void foo(gbm_bo* bo) { // gbm_create_device is a strong undefined symbol. The dynamic linker will // fail if this is not available. gbm_create_device(1234); // gbm_bo_get_modifier is a weak undefined symbol. It will be NULL if it's // not available. if (gbm_bo_get_modifier) gbm_bo_get_modifier(bo); }

However currently, dpkg-shlibdeps would consider gbm_bo_get_modifier in the example to be a required symbol (and would increase the minimum required library version), even though the intention is to use it only if it is available.

To address this, this change skips weak undefined symbols when checking for dependencies. Out of an abundance of caution, this behavior is guarded behind a new flag: --ignore-weak-undefined.

Merge request reports

Loading