Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stripping of macOS loadable bundles #13314

Closed
wants to merge 1 commit into from
Closed

Fix stripping of macOS loadable bundles #13314

wants to merge 1 commit into from

Conversation

cpsauer
Copy link
Contributor

@cpsauer cpsauer commented Apr 8, 2021

Adds -x flag to stripping of macOS loadable bundles.

Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in error: symbols referenced by indirect symbol table entries that can't be stripped.

-x instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)."

This should fix #11869

Adds `-x` flag to stripping of macOS loadable bundles.

Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in `error: symbols referenced by indirect symbol table entries that can't be stripped`.

`-x` instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)."

This should fix #11869
@cpsauer cpsauer requested a review from lberki as a code owner April 8, 2021 06:05
@google-cla google-cla bot added the cla: yes label Apr 8, 2021
@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 8, 2021

(I understand that --objc_enable_binary_stripping has other issues, but this seems like a clear bugfix that unblocks some useful functionality.)

@allevato
Copy link
Member

allevato commented Apr 8, 2021

cc @trybka

@trybka
Copy link
Contributor

trybka commented Apr 8, 2021

This seems like a perfectly reasonable tweak to improve bundle usage. 👍 Thanks!

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully we can get these hardcoded conditions/flags out of Bazel entirely at some point and moved into crosstool features instead, but adding one more check here doesn't really set us back in the meantime, either.

@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 8, 2021

Sweet! Thanks, all. Where do we go from here on merging?

@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 8, 2021

[With you, @allevato: Features look like a great, additional layer of indirection to wrap flags that differ across platforms. But in the meantime.]

@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 16, 2021

Hey all, quick bump. Now That it's approved, what's the path to merging?

@lberki
Copy link
Contributor

lberki commented Apr 16, 2021

I sent it to internal code review to @allevato right now

@bazel-io bazel-io closed this in 1a0285c Apr 16, 2021
@cpsauer
Copy link
Contributor Author

cpsauer commented Apr 26, 2021

Sweet! Thanks, all!

katre pushed a commit that referenced this pull request Jul 12, 2021
Adds `-x` flag to stripping of macOS loadable bundles.

Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in `error: symbols referenced by indirect symbol table entries that can't be stripped`.

`-x` instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)."

This should fix #11869

Closes #13314.

PiperOrigin-RevId: 368841977
katre pushed a commit that referenced this pull request Jul 19, 2021
Adds `-x` flag to stripping of macOS loadable bundles.

Loadable bundles--i.e. truly dynamically loadable libraries on macOS--cannot be stripped without this flag, since you'd be trying to strip away the all symbols, including those used for dynamic loading. Doing so results in `error: symbols referenced by indirect symbol table entries that can't be stripped`.

`-x` instead leads to the removal of the unneeded local symbols. As Apple notes in their man page: "For dynamic shared libraries, the maximum level of stripping is usually -x (to remove all non-global symbols)."

This should fix #11869

Closes #13314.

PiperOrigin-RevId: 368841977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS frameworks: symbol stripping fails
4 participants