[all-commits] [llvm/llvm-project] 87ce7b: [lld-macho] Simplify archive loading logic

Jez Ng via All-commits all-commits at lists.llvm.org
Tue Jul 19 18:56:50 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 87ce7b41d82a1b19ba5131d9c1068f1be0b77025
      https://github.com/llvm/llvm-project/commit/87ce7b41d82a1b19ba5131d9c1068f1be0b77025
  Author: Jez Ng <jezng at fb.com>
  Date:   2022-07-19 (Tue, 19 Jul 2022)

  Changed paths:
    M lld/MachO/Config.h
    M lld/MachO/Driver.cpp
    M lld/test/MachO/force-load-swift-libs.ll

  Log Message:
  -----------
  [lld-macho] Simplify archive loading logic

This is a follow-on to {D129556}. I've refactored the code such that
`addFile()` no longer needs to take an extra parameter. Additionally,
the "do we force-load or not" policy logic is now fully contained within
addFile, instead of being split between `addFile` and
`parseLCLinkerOptions`. This also allows us to move the `ForceLoad` (now
`LoadType`) enum out of the header file.

Additionally, we can now correctly report loads induced by
`LC_LINKER_OPTION` in our `-why_load` output.

I've also added another test to check that CLI library non-force-loads
take precedence over `LC_LINKER_OPTION` + `-force_load_swift_libs`. (The
existing logic is correct, just untested.)

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D130137




More information about the All-commits mailing list