[lld-macho] Use export trie instead of symtab when linking against dylibs
authorJez Ng <jezng@fb.com>
Thu, 23 Apr 2020 03:00:57 +0000 (20:00 -0700)
committerJez Ng <jezng@fb.com>
Sun, 10 May 2020 03:56:22 +0000 (20:56 -0700)
commit7bbdbacd00ae04f9c0d609bf2c00036cafb55fef
treecc20c4a74a53b60127eb325af8e37ca07a90a46c
parent5d3feefa0df9c054f6d683ca13316a822b596f87
[lld-macho] Use export trie instead of symtab when linking against dylibs

Summary:
This allows us to link against stripped dylibs. Moreover, it's simply
more correct: The symbol table includes symbols that the dylib uses but
doesn't export.

This temporarily regresses our ability to do lazy symbol binding because
dyld_stub_binder isn't in libSystem's export trie. Rather, it is in one
of the sub-libraries libSystem re-exports. (This doesn't affect our
tests since we are mocking out dyld_stub_binder there.) A follow-up diff
will address this by adding support for sub-libraries.

Depends on D79114.

Reviewers: ruiu, pcc, MaskRay, smeenai, alexshap, gkm, Ktwu, christylee

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D79226
lld/MachO/ExportTrie.cpp
lld/MachO/ExportTrie.h
lld/MachO/InputFiles.cpp
lld/test/CMakeLists.txt
lld/test/MachO/dylink.s