[llvm] Add symbol version support to llvm-ifs (PR #163030)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 23 02:32:19 PDT 2026
ur4t wrote:
> In the current design, a "VersionDefinitions" section was created and the hierarchy information recorded using "Parent" and "Name" attributes. We can see it tries to mirror what was stored in ".gnu.version_d", but the hierarchy information is only used by the dynamic linker; for ld and lld, the hierarchy information from ".gnu.version_d" is ignored. Therefore, in IFS, we don't need the "Parent" attribute at all. If we delete this field, it makes more sense to just inline the "Name" attribute into the entries in the "Symbols" section and remove the "VersionDefinitions" section completely.
Yes, removed.
Now this PR only adds necessary code to support symbol versioning.
YAML schema and exact serialization format of ELF symbol versioning in current implementation:
Items of `Symbols` now have an optional string field `Version` and a bool field `Default`.
1.1. `Version` is omitted when the string is empty.
1.2. `Default` is omitted when false.
> In general, static linkers also do not need ".gnu.version_r" when linking to an .so file; however, lld does parse it, so we may have to figure out how the linker uses it and modify the "NeededLibs" section to make sure it is covered.
> We also have some suggestions for the current flags provided by llvm-ifs: "--strip_needed" and "--strip_undefined". With the support of ELF symbol versions, "--strip_needed" probably needs to strip the undefined symbols as well. But let's focus on the IFS schema design first.
Sure. I think they should be handled in standalone PRs, like other TODOs such as `IFUNC` and program headers.
And by the way, it will be hard to handle the same version string appears in multiple version definitions/requirements. So I agree to ignore ".gnu.version_r" for now.
https://github.com/llvm/llvm-project/pull/163030
More information about the llvm-commits
mailing list