Derive private framework exports from client link graphs - #3039
Derive private framework exports from client link graphs#3039karim-alweheshy wants to merge 2 commits into
Conversation
|
CI audit: the currently red Bazel 8.x, Bazel 9.x, and last-green lanes all stopped before checkout after repeated pull-ref fetches ended with a mirror bus error. The Bazel 8.0.1 lane did check out the same head and completed the full public test matrix, including all five exported-symbol-list tests. I found no code failure in this run; the remaining red statuses need an infrastructure retry. |
|
@adincebic, could you rerun the failed Buildkite lanes when convenient? Bazel 8.x, 9.x, and last-green all stopped before checkout on repeated mirror fetch bus errors; the Bazel 8.0.1 lane checked out this same head and passed the full public suite, including all five new exported-symbol-list tests. Once the infrastructure lanes are green, a review of the linker/export aspect would be appreciated. |
Sure. |
bcc926c to
4ac300b
Compare
|
Rebased this onto current
Current local verification passes the Python export-analysis tests, all exported-symbol Starlark integration tests, linker Stardoc consistency, Buildifier/lint, Python compilation, |
Summary
Adds an opt-in
apple_exported_symbols_listrule for closed-world, app-private dynamic frameworks assembled from static libraries.The rule:
CcInfolink graphs;dlsym;llvm-nmexecutable;Motivation
Private dynamic frameworks can publish implementation-detail symbols even when only a closed set of applications and extensions load them. Restricting the exported ABI reduces that surface without requiring a manually maintained list of every statically referenced Swift symbol.
Bazel cannot discover reverse consumers, so callers provide the complete client link roots explicitly. This rule is intended for app-private frameworks with a closed client set, not public frameworks whose current consumers do not define a stable ABI.
Architecture and runtime-symbol handling
exported_symbols_listsfollows the same Apple split configuration as the corresponding link action. Each architecture therefore analyzes its own framework and client inputs and passes only its matching generated list to the linker.Authored entries from
additional_exported_symbols_listsare retained only when the current architecture's framework inputs define them. Missing authored entries are omitted from the linker input and listed in the target'sreportoutput group.preserve_all_non_swift_exportsdefaults toTrue. Projects should disable it only after auditing Objective-C runtime anddlsymusage and declaring all runtime-discovered roots explicitly.Validation
main.git diff --check, and pre-commit checks passed.aqueryconfirmed the arm64 and x86_64 link actions each consume the generated export list from their own split configuration.