[all-commits] [llvm/llvm-project] 21b4f8: [ELF] --icf: don't fold text sections with LSDA

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Aug 5 09:22:20 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 21b4f8060ab3b313009cf8995140edd5adbf7a4a
      https://github.com/llvm/llvm-project/commit/21b4f8060ab3b313009cf8995140edd5adbf7a4a
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-08-05 (Wed, 05 Aug 2020)

  Changed paths:
    M lld/ELF/EhFrame.cpp
    M lld/ELF/EhFrame.h
    M lld/ELF/ICF.cpp
    M lld/ELF/InputSection.h
    M lld/ELF/SyntheticSections.cpp
    M lld/ELF/SyntheticSections.h
    A lld/test/ELF/icf-eh-frame.s

  Log Message:
  -----------
  [ELF] --icf: don't fold text sections with LSDA

Fix PR36272 and PR46835

A .eh_frame FDE references a text section and (optionally) a LSDA (in
.gcc_except_table).  Even if two text sections have identical content and
relocations (e.g. a() and b()), we cannot fold them if their LSDA are different.

```
void foo();
void a() {
  try { foo(); } catch (int) { }
}
void b() {
  try { foo(); } catch (float) { }
}
```

Scan .eh_frame pieces with LSDA and disallow referenced text sections to be
folded. If two .gcc_except_table have identical semantics (usually identical
content with PC-relative encoding), we will lose folding opportunity.
For ClickHouse (an exception-heavy application), this can reduce --icf=all efficiency
from 9% to 5%. There may be some percentage we can reclaim without affecting
correctness, if we analyze .eh_frame and .gcc_except_table sections.

gold 2.24 implemented a more complex fix (resolution to
https://sourceware.org/bugzilla/show_bug.cgi?id=21066) which combines the
checksum of .eh_frame CIE/FDE pieces.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D84610




More information about the All-commits mailing list