[PATCH] D91579: [ELF] --gc-sections: collect unused .gcc_except_table in section groups and associated text sections

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 16 16:19:36 PST 2020


MaskRay created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay requested review of this revision.

`try ... catch` in an inline function produces `.gcc_except_table.*` with GCC or
newer Clang (since D83655 <https://reviews.llvm.org/D83655>). For --gc-sections, currently we scan `.eh_frame`
pieces and mark liveness of such a `.gcc_except_table.*` and then the associated
`.text.*` (if a member in a section group is retained, the others should be
retained as well).

Essentially all `.text.*` and `.gcc_except_table.*` compiled from inline
functions with `try ... catch` cannot be discarded by the imprecise --gc-sections.

This patch teaches the .eh_frame piece scanning code to only mark
`.gcc_except_table` in a section group, thus allow unused `.text.*` and
`.gcc_except_table.*` to be discarded.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91579

Files:
  lld/ELF/MarkLive.cpp
  lld/test/ELF/gc-sections-lsda.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91579.305620.patch
Type: text/x-patch
Size: 3744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201117/aad8c942/attachment.bin>


More information about the llvm-commits mailing list