[all-commits] [llvm/llvm-project] abd980: [ELF] mergeCmp: work around irreflexivity bug

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Aug 5 17:08:50 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: abd9807590fc10eb92eb22aea7b50dbf08db7e9d
  Author: Fangrui Song <i at maskray.me>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M lld/ELF/Relocations.cpp

  Log Message:
  [ELF] mergeCmp: work around irreflexivity bug

Some tests (e.g. aarch64-feature-pac.s) segfault in libstdc++ _GLIBCXX_DEBUG

dyn_cast<ThunkSection> is incorrectly true for any SyntheticSection. std::merge
transitively calls mergeCmp(x, x) (due to __glibcxx_requires_irreflexive_pred)
and will segfault in `ta->getTargetInputSection()`. The dyn_cast<ThunkSection>
issue should be eventually fixed properly, bug `a != b` is robust enough for now.

More information about the All-commits mailing list