[all-commits] [llvm/llvm-project] cafb6c: [lld/mac] Add some support for dynamic lookup symb...
Nico Weber via All-commits
all-commits at lists.llvm.org
Fri Feb 26 13:51:13 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: cafb6cd10c7434fdb541a40eda89fc51880f43c0
https://github.com/llvm/llvm-project/commit/cafb6cd10c7434fdb541a40eda89fc51880f43c0
Author: Nico Weber <thakis at chromium.org>
Date: 2021-02-26 (Fri, 26 Feb 2021)
Changed paths:
M lld/MachO/Driver.cpp
M lld/MachO/Options.td
M lld/MachO/SymbolTable.cpp
M lld/MachO/SymbolTable.h
M lld/MachO/Symbols.h
M lld/MachO/SyntheticSections.cpp
M lld/MachO/Writer.cpp
A lld/test/MachO/U-dynamic-lookup.s
Log Message:
-----------
[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
More information about the All-commits
mailing list