[PATCH] D134571: [MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE

Daniel Rodríguez Troitiño via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 15:56:35 PDT 2022


drodriguez created this revision.
drodriguez added reviewers: beanz, pete, Higuoxing.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: All.
drodriguez requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.

Modify the Object library to give access to the information pointed by
each of the load commands, and to fallback from one into the other when
the exports are requested.

Modify ObjCopy code to calculate the right offset and size needed
depending on the existence of LC_DYLD_INFO or LC_DYLD_EXPORTS_TRIE, read
the exports from either of those places, and write the export
information as pointed to either of those places.

Modify ObjectYAML to support dumping the export trie when pointed by
LC_DYLD_EXPORTS_TRIE and to parse the existence of a export trie also
when the load command is present.

This is a split of D134250 <https://reviews.llvm.org/D134250> with improvements on top.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134571

Files:
  llvm/include/llvm/Object/MachO.h
  llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp
  llvm/lib/ObjCopy/MachO/MachOObject.h
  llvm/lib/ObjCopy/MachO/MachOReader.cpp
  llvm/lib/ObjCopy/MachO/MachOReader.h
  llvm/lib/ObjCopy/MachO/MachOWriter.cpp
  llvm/lib/Object/MachOObjectFile.cpp
  llvm/lib/ObjectYAML/MachOEmitter.cpp
  llvm/test/tools/llvm-objdump/MachO/exports-trie-lc.test
  llvm/tools/obj2yaml/macho2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134571.462600.patch
Type: text/x-patch
Size: 18512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220923/6a1a2ddf/attachment.bin>


More information about the llvm-commits mailing list