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

Strip bitcode from imported dynamic frameworks and Swift standard libraries when building without bitcode #881

Merged
merged 1 commit into from
Aug 27, 2020

Conversation

thii
Copy link
Member

@thii thii commented Aug 20, 2020

Fixes #327.

@thii thii force-pushed the bitcode-strip branch 3 times, most recently from a91b938 to 1e49361 Compare August 20, 2020 08:11
@thii thii marked this pull request as draft August 20, 2020 08:13
@thii thii force-pushed the bitcode-strip branch 3 times, most recently from 4c76de5 to 48f3bd6 Compare August 20, 2020 09:56
@thii thii marked this pull request as ready for review August 20, 2020 10:06
@thii thii force-pushed the bitcode-strip branch 4 times, most recently from fc609f3 to 6dfcbd0 Compare August 20, 2020 12:36
@thii thii marked this pull request as draft August 21, 2020 02:00
@thii thii force-pushed the bitcode-strip branch 5 times, most recently from 652bbd6 to e2be06b Compare August 21, 2020 05:21
@thii thii marked this pull request as ready for review August 21, 2020 05:27
@thii
Copy link
Member Author

thii commented Aug 21, 2020

Please take a look.

return bitcode_mode_string

fail("Internal error: expected bitcode_mode to be one of: " +
"['embedded', 'embedded_markers', 'none'], but got '{}'".format(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: might be nice to extract out the array of allowed values, so we don't have to keep it in sync in both places

@@ -131,6 +135,10 @@ def _framework_import_partial_impl(ctx, targets, targets_to_avoid):
for build_arch in build_archs_found:
args.add("--slice", build_arch)

# TODO: Extract `bitcode_strip` into a separate action
Copy link
Contributor

Choose a reason for hiding this comment

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

what's the benefit of doing it as a separate action?

Copy link
Member Author

Choose a reason for hiding this comment

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

It gets cached separately which is more efficient. For example, if we have 2 build configugrations for 2 different archs, it will save us one bitcode_strip command (assuming we do bitcode_strip before lipo).

Copy link
Member

Choose a reason for hiding this comment

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

fyi - bundle & sign has historically been a single action because it actually is faster than two actions. Likewise, things like the thinning of imported frameworks/archives are thinned on import also also speed things up vs. two actions. On local builds, it doesn't really make a difference, but when you talk about remote builds. Copying everything to the machine, doing a job, copying them back, then copying things out, doing another job, and copying it back can end up being significantly slower that just doing one set of copies. Also, the more large copies, the more changes for retransmissions under the hood to the remote host can be required, slowing down the overall build.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the info. I have always been naïvely thinking that the smaller actions you split the compilation into, the faster incremental build you get. That probably only makes sense for actions that take text files as inputs.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, the key is number of inputs/size of inputs/outputs. The costs can also apply somewhat for local builds, but there it is really the counts that matter since the action needs a setup directory to run in, so the more inputs, the more symlinks that have to be created.

@thii
Copy link
Member Author

thii commented Aug 27, 2020

Gently ping for review/merge.

@segiddins segiddins merged commit 42d829b into bazelbuild:master Aug 27, 2020
@thii thii deleted the bitcode-strip branch August 27, 2020 23:25
@thii
Copy link
Member Author

thii commented Aug 27, 2020

Thanks!

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.

Strip symbols and bitcode from Swift standard libraries when building without bitcode
4 participants