[ELF]: --icf: don't fold sections referencing sections with LCDA after D84610

This commit is contained in:
Fangrui Song 2020-08-07 13:42:09 -07:00
parent 5a0b1472c0
commit 164a02d0fa
2 changed files with 9 additions and 1 deletions

View File

@ -468,9 +468,10 @@ template <class ELFT> void ICF<ELFT>::run() {
//
// If two .gcc_except_table have identical semantics (usually identical
// content with PC-relative encoding), we will lose folding opportunity.
uint32_t uniqueId = 0;
for (Partition &part : partitions)
part.ehFrame->iterateFDEWithLSDA<ELFT>(
[&](InputSection &s) { s.eqClass[0] = 1; });
[&](InputSection &s) { s.eqClass[0] = ++uniqueId; });
// Collect sections to merge.
for (InputSectionBase *sec : inputSections) {

View File

@ -41,3 +41,10 @@ _Z1dv:
.section .gcc_except_table,"a",@progbits
## The actual content does not matter.
.Lexception0:
## .rodata.Z1[ab]v reference .text.Z1[ab]v. Dont fold them.
.section .rodata.Z1av,"a",@progbits
.long .text.Z1av - .
.section .rodata.Z1bv,"a",@progbits
.long .text.Z1bv - .