-
Notifications
You must be signed in to change notification settings - Fork 40
Add initial support for creating shared library with symbol versioning #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add initial support for creating shared library with symbol versioning #470
Conversation
72be119 to
4117df0
Compare
4117df0 to
3e04f3b
Compare
quic-seaswara
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to define the symbol override rules especially for weak and strong symbols that have versioning information.
Does this work with --gc-sections ?
Can you please add the tests applicable ?
Please use lld to build with versioned libraries generated by eld, and run it to make sure we have those cases handled.
3e04f3b to
9c4a384
Compare
This PR does not add support for the case where the input files have versioned symbols. This PR only enables creating shared libraries with symbol versioning information. So, there is no symbol resolution change for this PR.
Yes,
I have added build and run tests for symbol versioning in x86-64. |
dd05a74 to
9beb3a7
Compare
10c24f3 to
ea915f6
Compare
|
Thank you @quic-seaswara, @quic-areg and @quic-akaryaki for the reviews. I have resolved / replied-to all the reviews. Can you please review again? |
d9cf7fc to
1b27f1f
Compare
quic-areg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1b27f1f to
645ea12
Compare
224d101 to
83a2eb5
Compare
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]>
83a2eb5 to
6a6f8b8
Compare
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:
the version ID of the i'th symbol in the dynamic symbol
table.
are defined by this module.
are used by this module.
To add the support for creating shared libraries with symbol versioning
information, this commit:
.gnu.version_d
nodes.
versioned symbols.
information in the .dynamic section.
Additionally, this commit adds the trace flag --trace=symbol-versioning.
Resolves #646