[all-commits] [llvm/llvm-project] 53544f: [ELF] Respect ltoCanOmit for symbols in non-prevai...

Fangrui Song via All-commits all-commits at lists.llvm.org
Wed Dec 11 08:55:26 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 53544fc15f08687c14becced4ecc22c2356265cd
      https://github.com/llvm/llvm-project/commit/53544fc15f08687c14becced4ecc22c2356265cd
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-12-11 (Wed, 11 Dec 2024)

  Changed paths:
    M lld/ELF/InputFiles.cpp
    M lld/test/ELF/lto/internalize-exportdyn.ll

  Log Message:
  -----------
  [ELF] Respect ltoCanOmit for symbols in non-prevailing COMDAT

A linkonce_odr definition can be omitted in LTO compilation if
`canBeOmittedFromSymbolTable()` is true in all bitcode files.

Currently, we don't respect the `canBeOmittedFromSymbolTable()` bit from
symbols in a non-prevailing COMDAT, which could lead to incorrect
omission of a definition when merging a prevailing linkonce_odr and a
non-prevailing weak_odr, e.g. an implicit template instantiation and an
explicit template instantiation.

To fix #111341, allow the non-prevailing COMDAT code path to clear the
`ltoCanOmit` bit, so that `VisibleToRegularObj` could be false in
LTO.cpp. We could resolve either an Undefined or a Defined. For
simplicity, just use a Defined like the prevailing case (similar to how
we resolve symbols in ObjectFile COMDAT reviews.llvm.org/D120626).

Pull Request: https://github.com/llvm/llvm-project/pull/119332



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list