llvm-project
e34651fa - [ELF] Set vna_flags to VER_FLG_WEAK if all references are weak (#176673)

Commit
11 days ago
[ELF] Set vna_flags to VER_FLG_WEAK if all references are weak (#176673) When all undefined references to a version are weak, set vna_flags to VER_FLG_WEAK in the .gnu.version_r section. This enables glibc ld.so to report a warning instead of an error when the required version is not found at runtime, supporting optional dependencies. Per https://sourceware.org/bugzilla/show_bug.cgi?id=24718#c20 , glibc rtld since 2.30 (BZ #24741) tolerates missing versioned symbols when the runtime shared object defines the required version. With this vna_flags VER_FLG_WEAK change, rtld can also tolerate a completely missing version, printing a message like: ``` % LD_PRELOAD=c2.so ./a ./a: /tmp/t/v2/c2.so: weak version `v1' not found (required by /tmp/t/v2/b.so) a ``` instead of a fatal error. In addition, add a comment about `vn.vernaxus.size() == 1`.
Author
Parents
Loading