[MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
authorDaniel Rodríguez Troitiño <danielrodriguez@fb.com>
Tue, 22 Nov 2022 23:12:27 +0000 (15:12 -0800)
committerDaniel Rodríguez Troitiño <danielrodriguez@fb.com>
Wed, 23 Nov 2022 01:44:46 +0000 (17:44 -0800)
commit42ad9bf95fd5cb30e2ab3e017b6718ac6efea1be
tree7f860bfb0ae0325ac90754afeb420dd15f7b1283
parent7218103bcaca36be0287172a91ae2907ca20930c
[MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE

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 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 with improvements on top.

Reviewed By: alexander-shaposhnikov

Differential Revision: https://reviews.llvm.org/D134571
llvm/include/llvm/Object/MachO.h
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/ObjectYAML/MachOEmitter.cpp
llvm/test/ObjectYAML/MachO/export_trie_lc_dyld_exports_trie.yaml [new file with mode: 0644]
llvm/test/ObjectYAML/MachO/export_trie_lc_dyld_info_only.yaml [moved from llvm/test/ObjectYAML/MachO/export_trie.yaml with 100% similarity]
llvm/tools/obj2yaml/macho2yaml.cpp