Commit Graph

3 Commits

Author SHA1 Message Date
Jez Ng 3d5e5066f1 [lld-macho][nfc] Clean up tests
* Remove unnecessary `rm -rf %t`s
* Have lc-linker-option.ll use the right comment marker
2021-05-10 15:45:54 -04:00
Greg McGary 4b89629403 [lld-macho][NFC] Purge stale test-output trees prior to split-file
Enforce standard practice

Differential Revision: https://reviews.llvm.org/D102112
2021-05-08 17:36:30 -07:00
Nico Weber cafb6cd10c [lld/mac] Add some support for dynamic lookup symbols, and implement -U
Dynamic lookup symbols are symbols that work like dynamic symbols
in ELF: They're not bound to a dylib like normal Mach-O twolevel lookup
symbols, but they live in a global pool and dyld resolves them against
exported symbols from all loaded dylibs.

This adds support for dynamical lookup symbols to lld/mac. They are
represented as DylibSymbols with file set to nullptr.

This also uses this support to implement the -U flag, which makes
a specific symbol that's undefined at the end of the link a
dynamic lookup symbol.

For -U, it'd be sufficient to just to a pass over remaining undefined symbols
at the end of the link and to replace them with dynamic lookup symbols then.
But I'd like to use this code to implement flat_namespace too, and that will
require real support for resolving dynamic lookup symbols in SymbolTable. So
this patch adds this now already.

While writing tests for this, I noticed that we didn't set N_WEAK_DEF in the
symbol table for DylibSymbols, so this fixes that too.

Differential Revision: https://reviews.llvm.org/D97521
2021-02-26 16:50:53 -05:00