Skip to content

Conversation

@parth-07
Copy link
Contributor

No description provided.

@parth-07 parth-07 marked this pull request as draft December 21, 2025 15:16
This commit adds initial support for building shared libraries with
symbol versioning information. Symbol versioning allows to add version
information to symbols. It is used to provide multiple definitions of
the same symbol for backward compatibility.

This commit adds the support such that the functionality can be enabled
conditionally at build time by specifying ELD_ENABLE_SYMBOL_VERSIONING
CMake option. This commit also updates the PR checkin builder to enable
symbol versioning functionality.

Symbol versioning is a target-independent feature but requires support
from compiler, linker and the loader. From the ELF perspective, symbol
versioning is implemented using 3 sections:
.gnu.version(SHT_GNU_versym), .gnu.version_d(SHT_GNU_verdef), and
.gnu.version_r(SHT_GNU_verneed). This commit only provides support for
.gnu.version and .gnu.version_d sections because only they are required
when building a shared library. .gnu.version_r is required when using a
shared library. Briefly, these sections can be descrbed as:

- .gnu.version: An array of version IDs. i'th entry of this array stores
                the version ID of the i'th symbol in the dynamic symbol
                table.
- .gnu.version_d: Stores the version definitions of the symbols that
                  are defined by this module.
- .gnu.version_r: Stores the version definitions of the undefined symbols that
                  are used by this module.

To add the support for creating shared libraries with symbol versioning
information, this commit:
- Adds support for creating symbol versioning sections .gnu.version and
  .gnu.version_d
- Improve version script support to properly handle versioned
  nodes.
- Add logic to properly assign output version IDs to symbols.
- Update dynamic symbol table and .hash section to properly emit
  versioned symbols.
- Emit symbol versioning sections and correctly fill symbol versioning
  information in the .dynamic section.

Additionally, this commit adds the trace flag --trace=symbol-versioning.

Resolves qualcomm#646

Signed-off-by: Parth Arora <[email protected]>
This commit adds primitive support for creating executables that use
shared libraries with symbol versioning information.

Signed-off-by: Parth Arora <[email protected]>
@partaror partaror force-pushed the PrimitiveSymbolVersioningExecutables branch from 038f473 to c25d32e Compare January 2, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant