Conversation
Passing `-Wl,-exported_symbols_list,/dev/null` has been generally recommended to reduce app size. Since we have the `exported_symbols_list` attribute, if those are never set, we can do this by default. This does require folks export things that they actually need.
|
One compatibility concern before making I verified this on a reduced Would it make sense to retain only that symbol for app-like executables instead? On the same reduced input this changed four exports to one while leaving I put together an opt-in, product-scoped implementation with analysis tests for default-off behavior, opt-out, apps, extensions, additive custom exports, and framework exclusion: main...karim-alweheshy:rules_apple:codex/restrict-application-exports |
|
yea i think if we want to move forward with this including that symbol by default would be fine |
|
Separately, I prototyped the framework-side counterpart as a reusable A final Mach-O test covers the unrestricted negative control, the retained client-used Swift API, the removed unused Swift API, and the conservative C runtime root. I kept this independent from the application feature for focused review: main...karim-alweheshy:rules_apple:codex/derive-private-framework-exports |
|
@keith I opened #3073 as a small draft companion PR targeting your branch, preserving your existing commits. It keeps __mh_execute_header for executable Mach-Os while retaining your bundle/dylib, bundle-loader, and explicit export-policy behavior. There are no new production build actions. The runtime regression test fails with the original no-export policy and passes with the fix; all 14 focused tests pass on Bazel 8.0.1 and 9.1.1rc1 with Xcode 26.5. You can merge the companion into this branch or cherry-pick d2aee46. I kept the framework-export work separate. Would you be happy to take this follow-up when refreshing #3024 for review? |
Passing
-Wl,-no_exported_symbolshas been generallyrecommended to reduce app size. Since we have the
exported_symbols_listattribute, if those are never set, we can dothis by default. This does require folks export things that they
actually need.