[all-commits] [llvm/llvm-project] 9a2e2d: [lld-macho] Change loadReexport to handle the case...

Vy Nguyen via All-commits all-commits at lists.llvm.org
Tue Mar 2 09:15:18 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9a2e2de15f108f943ae50e6183719a4af81104e8
      https://github.com/llvm/llvm-project/commit/9a2e2de15f108f943ae50e6183719a4af81104e8
  Author: Vy Nguyen <vyng at google.com>
  Date:   2021-03-02 (Tue, 02 Mar 2021)

  Changed paths:
    M lld/MachO/Driver.h
    M lld/MachO/InputFiles.cpp
    A lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libReexportSystem.tbd
    M lld/test/MachO/Inputs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd
    A lld/test/MachO/reexport-nested-lib.s
    M llvm/include/llvm/TextAPI/MachO/InterfaceFile.h
    M llvm/lib/TextAPI/MachO/InterfaceFile.cpp

  Log Message:
  -----------
  [lld-macho] Change loadReexport to handle the case where a TAPI re-exports to reference documents nested within other TBD.

Currently, it was delibrately impleneted to not handle this case, but as it has turnt out, we need this feature.
The concrete use case is
       `System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa` reexports
               /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit , which then rexports
                    /System/Library/PrivateFrameworks/UIFoundation.framework/Versions/A/UIFoundation

The current implemention uses a global currentTopLevelTapi, which is not reset until it finishes loading the whole tree.
This is a problem because if the top-level is set to Cocoa, then when we get to UIFoundation, it will try to find UIFoundation in the current top level, which is Cocoa and will not find it.

The right thing should be:
 - When loading a library from a TBD file, re-exports need to be looked up in the auxiliary documents within the same TBD.
 - When loading from an actual dylib, no additional TBD documents need to be examined.
 - In no case does a re-export mentioned in one TBD file need to be looked up in a document in an auxiliary document from a different TBD file

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




More information about the All-commits mailing list