[all-commits] [llvm/llvm-project] bbfa50: [lld-macho] Fix bug in makeSyntheticInputSection w...

alx32 via All-commits all-commits at lists.llvm.org
Wed Mar 27 17:28:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bbfa50696e43f337f55f8bacf739683b181debd5
      https://github.com/llvm/llvm-project/commit/bbfa50696e43f337f55f8bacf739683b181debd5
  Author: alx32 <103613512+alx32 at users.noreply.github.com>
  Date:   2024-03-27 (Wed, 27 Mar 2024)

  Changed paths:
    M lld/MachO/ConcatOutputSection.cpp
    M lld/MachO/InputSection.cpp
    M lld/MachO/InputSection.h
    M lld/MachO/SymbolTable.cpp
    M lld/MachO/SyntheticSections.cpp
    M lld/MachO/Writer.cpp
    M lld/test/MachO/objc-relative-method-lists-simple.s

  Log Message:
  -----------
  [lld-macho] Fix bug in makeSyntheticInputSection when -dead_strip flag is specified (#86878)

Previously, `makeSyntheticInputSection` would create a new
`ConcatInputSection` without setting `live` explicitly for it. Without
`-dead_strip` this would be OK since `live` would default to `true`.
However, with `-dead_strip`, `live` would default to false, and it would
remain set to `false`.
This hasn't resulted in any issues so far since no code paths that
exposed this issue were present.
However a recent change - ObjC relative method lists
(https://github.com/llvm/llvm-project/pull/86231) exposes this issue by
creating relocations to the `SyntheticInputSection`.
When these relocations are attempted to be written, this ends up with a
crash(assert), since the `SyntheticInputSection` they refer to is marked
as dead (`live` = `false`).

With this change, we set the correct behavior - `live` will always be
`true`. We add a test case that before this change would trigger an
assert in the linker.



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