Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When comparing relocations against two symbols, ICF's equalsConstant() did not look at the value of the two symbols. With subsections_via_symbols, the value is usually 0 but not always: In particular, it isn't 0 for constants in string and literal sections. Since we ignored the value, comparing two constant string symbols or two literal symbols always compared the 0th's element, so functions in the same TU always compared as equal. This can cause mislinks, and, with -dead_strip, crashes. Fixes PR52349, see that bug for lots of details and examples of mislinks. While here, make the existing assembly in icf-literals.s a bit more realistic (use leaq instead of movq with strings, and use foo(%rip) instead of foo@gotpcrel(%rip)). This has no interesting effect, it just maybe makes the test look a bit less surprising. Differential Revision: https://reviews.llvm.org/D112862
- Loading branch information
Showing
2 changed files
with
44 additions
and
9 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