Joe_Groff
(Joe Groff)
April 9, 2021, 12:27am
2
It's not strictly necessary; it's a legacy of Swift's original priorities being to support dynamic libraries with stable ABIs, and we're working to make it unnecessary when building static libraries. See:
apple:main
← kubamracek:dead_strip1
opened 08:22PM - 12 Oct 20 UTC
Add a -emit-dead-strippable-symbols flag that emits functions/variable/metadata … in a dead_strip-friendly way. This enables static linking to remove unused functions and classes even across modules. For now, I'm adding the flag as an opt-in experimental mode, but the goal is to eventually be able to emit symbols this way for everything. This way we could see nice code size savings when e.g. including a lot of package dependencies where not everything is actually used.
As some people expressed interest in working on code size optimizations, I'd like to start a thread to share ideas what we could do to reduce code size.
Here are some items of my list:
Improve function merging: In the swift compiler, we are running a LLVM pass to merge "similar" functions (swift/LLVMMergeFunctions.cpp at main · apple/swift · GitHub ). Currently this is quite limited. If we extend the possibility to accept more "differences" (most importantly differing constant offsets of gete…
[Proposal] Opt-In Reflection metadata
Proposal: SE-NNNN
Authors: Max Ovtsin
Review Manager: TBD
Status: Pitch
Implementation: apple/swift#34199
Pitch #1
Introduction
Reflection can be a useful thing to create convenient and concise APIs for libraries. This proposal seeks to improve the safety of such APIs and to tackle the binary size problem by introducing a mechanism of selectively keeping reflection metadata only for types that need it and dead strip it for all others. Developers wi…
9 Likes