[all-commits] [llvm/llvm-project] 3f9091: [ELF] --gc-sections: collect unused .gcc_except_ta...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Nov 17 09:11:39 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3f9091888656ff3aabf677caac6054b3fd4eaa0d
      https://github.com/llvm/llvm-project/commit/3f9091888656ff3aabf677caac6054b3fd4eaa0d
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-11-17 (Tue, 17 Nov 2020)

  Changed paths:
    M lld/ELF/MarkLive.cpp
    M lld/test/ELF/gc-sections-lsda.s

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

`try ... catch` in an inline function produces `.gcc_except_table.*` in a COMDAT
group with GCC or newer Clang (since 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.  Compared with the state before D83655, the output
`.gcc_except_table` is smaller (non-prevailing copies in COMDAT groups can now
be discarded) but `.text` may be larger, i.e. size regression.

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

Note, non-group `.gcc_except_table` can still not be discarded. That is the status quo.

Reviewed By: grimar, echristo

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




More information about the All-commits mailing list