
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
26 lines
719 B
C++
26 lines
719 B
C++
//===- EhFrame.h ------------------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLD_ELF_EHFRAME_H
|
|
#define LLD_ELF_EHFRAME_H
|
|
|
|
#include "lld/Common/LLVM.h"
|
|
|
|
namespace lld {
|
|
namespace elf {
|
|
class InputSectionBase;
|
|
struct EhSectionPiece;
|
|
|
|
size_t readEhRecordSize(InputSectionBase *s, size_t off);
|
|
uint8_t getFdeEncoding(EhSectionPiece *p);
|
|
bool hasLSDA(const EhSectionPiece &p);
|
|
} // namespace elf
|
|
} // namespace lld
|
|
|
|
#endif
|