[PATCH] D84610: [ELF] --icf: don't fold text sections with LSDA

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 26 17:03:36 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: grimar, pcc, psmith, respindola.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

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 but such
cases are rare.

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, but I don't think it is better than
assigning a simple unique ID.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84610

Files:
  lld/ELF/EhFrame.cpp
  lld/ELF/EhFrame.h
  lld/ELF/ICF.cpp
  lld/ELF/InputSection.h
  lld/ELF/SyntheticSections.cpp
  lld/ELF/SyntheticSections.h
  lld/test/ELF/icf-eh-frame.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84610.280759.patch
Type: text/x-patch
Size: 9684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200727/e9dbde40/attachment.bin>


More information about the llvm-commits mailing list