[all-commits] [llvm/llvm-project] b609a4: [lld-macho][NFC] Refactor insertions into inputSec...

alx32 via All-commits all-commits at lists.llvm.org
Thu Mar 21 14:51:06 PDT 2024


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

  Changed paths:
    M lld/MachO/Driver.cpp
    M lld/MachO/InputSection.cpp
    M lld/MachO/InputSection.h
    M lld/MachO/ObjC.cpp
    M lld/MachO/SyntheticSections.cpp

  Log Message:
  -----------
  [lld-macho][NFC] Refactor insertions into inputSections (#85692)

Before this change, after `InputSection` objects are created, they need
to be added to the appropriate container for tracking.
The logic for selecting the appropriate container lives in `Driver.cpp`
/ `gatherInputSections`, where the `InputSection` is added to the
matching container depending on the input config and the type of
`InputSection`.

Also, multiple other locations also insert directly into `inputSections`
array - assuming that that is the appropriate container for the
`InputSection`'s they create. Currently this is the correct assumption,
however an upcoming feature will change this.

For an upcoming feature (relative method lists), we need to route
`InputSection`'s either to `inputSections` array or to a synthetic
section, depending on weather the relative method list optimization is
enabled or not.

We can achieve the above either by duplicating some of the logic or
refactoring the routing and `InputSection`'s and reusing that.

The refactoring & code sharing approach seems the correct way to go - as
such this diff performs the refactoring while not introducing any
functional changes. Later on we can just call `addInputSection` and not
have to worry about routing logic.

---------



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