[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.

---------

GitOrigin-RevId: b609a4d7ea8b716f5f0ec83d10945362f42e730d
5 files changed
tree: 36849f56b48f6564f87d9fd6663fc24fdb8bcd0a
  1. cmake/
  2. COFF/
  3. Common/
  4. docs/
  5. ELF/
  6. include/
  7. MachO/
  8. MinGW/
  9. test/
  10. tools/
  11. unittests/
  12. utils/
  13. wasm/
  14. .clang-format
  15. .clang-tidy
  16. .gitignore
  17. CMakeLists.txt
  18. CODE_OWNERS.TXT
  19. LICENSE.TXT
  20. README.md
README.md

LLVM Linker (lld)

This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.

lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.

Benchmarking

In order to make sure various developers can evaluate patches over the same tests, we create a collection of self contained programs.

It is hosted at https://s3-us-west-2.amazonaws.com/linker-tests/lld-speed-test.tar.xz

The current sha256 is 10eec685463d5a8bbf08d77f4ca96282161d396c65bd97dc99dbde644a31610f.