-
-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Run COMDAT elimination inside resolve_symbols.
We've long had a hack to de-prioritize GNU_UNIQUE symbols, due to an edge case where these symbols could get higher resolution priority yet eliminated in the later COMDAT elimination stage. But since GNU_UNIQUE symbols were supposed to have a resolution as strong as GLOBAL symbols, it created unsoundness in the resolution and could have cause false duplicate symbol errors in later stages. The root cause is that COMDAT elimination, unlike ICF and SHF_MERGE, removes symbols from the candidate pool and can actually affect resolution result. Hence we ought to do the elimination before the final resolution. Doing so requires fully wiping the resolution instead of just the ones from eliminated archive members. This has a performance hit that we need to keep an eye on. On another note this wiping of resolution is actually justifiable. The old algorithm did not handle the case of an archive member overriding a DSO symbol. So wiping is the correct way even in absence of COMDAT elimination. One caveat is that currently the symbol resolution stage doesn't actually care about the is_alive flag which is how COMDAT symbols are killed. There are two other users of this flag: mergeable sections, and eh_frame. The eh_frame section is already handled with special logic, and we can treat it as if it had no symbols to resolve. Mergeable sections needs a bit more careful handling, but a good way is to just leave them unmerged and update the references in the same later pass where merge happens. This has been done in a prior commit. Signed-off-by: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
- Loading branch information
1 parent
26c503a
commit 730e970
Showing
3 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters