Commit 10c24f3
committed
Add initial support for creating shared library with symbol versioning
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 #646
Signed-off-by: Parth Arora <[email protected]>1 parent 885297a commit 10c24f3
File tree
56 files changed
+1136
-44
lines changed- .github/workflows
- cmake/modules
- include/eld
- Config
- Core
- Diagnostics
- Driver
- Fragment
- Script
- SymbolResolver
- Target
- lib
- Config
- Core
- Diagnostics
- Fragment
- Object
- Script
- Target
- Writers
- test
- Hexagon/Plugin/TrampolineInfo
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
56 files changed
+1136
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
178 | 183 | | |
179 | 184 | | |
180 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
423 | 429 | | |
424 | 430 | | |
425 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
691 | | - | |
| 691 | + | |
| 692 | + | |
692 | 693 | | |
693 | 694 | | |
694 | 695 | | |
| |||
0 commit comments