[all-commits] [llvm/llvm-project] 7f3ddf: [lld-macho][nfc] Allow Defined symbols to be place...
Jez Ng via All-commits
all-commits at lists.llvm.org
Mon Mar 14 19:18:51 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7f3ddf8443272626186c7d1408737d2d72fd8b00
https://github.com/llvm/llvm-project/commit/7f3ddf8443272626186c7d1408737d2d72fd8b00
Author: Jez Ng <jezng at fb.com>
Date: 2022-03-14 (Mon, 14 Mar 2022)
Changed paths:
M lld/MachO/Arch/ARM.cpp
M lld/MachO/Arch/ARM64.cpp
M lld/MachO/Arch/ARM64Common.h
M lld/MachO/Arch/ARM64_32.cpp
M lld/MachO/Arch/X86_64.cpp
M lld/MachO/Symbols.cpp
M lld/MachO/Symbols.h
M lld/MachO/SyntheticSections.cpp
M lld/MachO/SyntheticSections.h
M lld/MachO/Target.h
Log Message:
-----------
[lld-macho][nfc] Allow Defined symbols to be placed in binding sections
Previously, we only allowed this for DylibSymbols. However, in order to
properly support `-flat_namespace` as well as `-interposable`, we need
to allow this for Defined symbols too. Therefore we hoist the
`lazyBindOffset` and the `stubsHelperIndex` into the parent Symbol
class.
The actual change to support interposition under `-flat_namespace` is in
{D119294}; the NFC changes here have been split out for easier review.
Perf regression isn't stat sig on my 3.2 GHz 16-Core Intel Xeon W linking
chromium_framework:
base diff difference (95% CI)
sys_time 1.227 ± 0.021 1.234 ± 0.031 [ -0.3% .. +1.5%]
user_time 3.665 ± 0.036 3.674 ± 0.035 [ -0.2% .. +0.7%]
wall_time 4.596 ± 0.055 4.609 ± 0.064 [ -0.3% .. +0.9%]
samples 34 47
Max RSS regression is barely stat sig:
base diff difference (95% CI)
time 1003664356.324 ± 15404053.912 1010380403.613 ± 10578309.455 [ +0.0% .. +1.3%]
samples 37 31
Reviewed By: modimo
Differential Revision: https://reviews.llvm.org/D121351
Commit: ceff23c6e39118fbbfb053e70d786fad40987c5b
https://github.com/llvm/llvm-project/commit/ceff23c6e39118fbbfb053e70d786fad40987c5b
Author: Jez Ng <jezng at fb.com>
Date: 2022-03-14 (Mon, 14 Mar 2022)
Changed paths:
M lld/MachO/SymbolTable.cpp
M lld/MachO/Symbols.cpp
M lld/MachO/Symbols.h
M lld/MachO/SyntheticSections.cpp
M lld/MachO/Writer.cpp
A lld/test/MachO/flat-namespace-dysyms.s
A lld/test/MachO/flat-namespace-interposable.s
R lld/test/MachO/flat-namespace.s
Log Message:
-----------
[lld-macho] -flat_namespace for dylibs should make all externs interposable
All references to interposable symbols can be redirected at runtime to
point to a different symbol definition (with the same name). For
example, if both dylib A and B define symbol _foo, and we load A before
B at runtime, then all references to _foo within dylib B will point to
the definition in dylib A.
ld64 makes all extern symbols interposable when linking with
`-flat_namespace`.
TODO 1: Support `-interposable` and `-interposable_list`, which should
just be a matter of parsing those CLI flags and setting the
`Defined::interposable` bit.
TODO 2: Set Reloc::FinalDefinitionInLinkageUnit correctly with this info
(we are currently not setting it at all, so we're erring on the
conservative side, but we should help the LTO backend generate more
optimal code.)
Reviewed By: modimo, MaskRay
Differential Revision: https://reviews.llvm.org/D119294
Compare: https://github.com/llvm/llvm-project/compare/0a0cc3c58a74...ceff23c6e391
More information about the All-commits
mailing list