-
Notifications
You must be signed in to change notification settings - Fork 25
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
Upcoming changes around -Zembed-bitcode
#9
Comments
Hi, thanks for the welcome news! It will be great not to require I'd thought about upstreaming that patch but I wasn't sure whether it would be desirable or where it would fit in, but you've just answered both those questions for me! I'll look into it. I agree embedding bitcode is a sensible default for any iOS target, in |
Oh I thought that this was actually already implemented but it appears I was wrong! I think what you'll want to do is:
|
…r=alexcrichton Improve bitcode generation for Apple platforms Some improvements for iOS bitcode support suggested by Alex over at getditto/rust-bitcode#9. r? @alexcrichton This improves Rust's bitcode generation so that provided you have a compatible LLVM version, Rust targeting iOS should work out of the box when compiled into bitcode-enabled apps, and when submitted to the App Store. I've tested these changes using Xcode 11.4.1 and Apple's vendored LLVM, [tag `swift-5.2.3-RELEASE`](https://github.com/apple/llvm-project/releases/tag/swift-5.2.3-RELEASE). 1. Force `aarch64-apple-ios` and `aarch64-apple-tvos` targets to always emit full bitcode sections, even when cargo is trying to optimise by invoking `rustc` with `-Cembed-bitcode=no`. Since Apple recommends bitcode on iOS and requires it on tvOS it is likely that this is what developers intend. Currently you need to override the codegen options with `RUSTFLAGS`, which is far from obvious. 2. Provide an LLVM cmdline in the target spec. Apple's bitcode verification process looks for some arguments. For Rust modules to be accepted we must pretend they were produced similarly. A suitable default is provided in `TargetOptions` for iOS, copied directly from the a clang equivalent section. In the context of Apple platforms, the predominant purpose of bitcode is App Store submissions, so simulator and 32-bit targets are not relevant. I'm hoping that the cmdline strings will not be a maintenance burden to keep up-to-date. If the event of any future incompatibilities, hopefully a custom target config would offer enough flexibility to work around it. It's impossible to say for sure. Due to unrelated build errors I haven't been able to build and test a full tvOS toolchain. I've stopped short of providing a similar `bitcode_llvm_cmdline` until I can actually test it.
Building on the work mentioned in OP, the cmdline patch is now upstreamed along with a tweak that means aarch64-apple-ios will always embed bitcode without needing to use any Presumably these improvements will land in 1.44.0, after which this repo will have less work to do and we can simplify things a bit. 🎉 For Ditto's purposes we'll most likely drop back to the stable channel. If there's anyone relying on the binaries who wants the nightly channel we could keep publishing those also. |
Hello! I found this through an article today, and wanted to give y'all a heads up at some possible changes which may make things easier for y'all here.
rust-lang/rust#71528 is an effort to move all of rustc's storage of LLVM bitcode into object files by default instead of having some extra
*.bc.z
files in rlibs. Once that lands we'll be stabilizing-Cembed-bitcode
as well so you won't have to use a-Z
flag.Some other notes that I saw while reading some scripts here:
-fembed-bitcode
on by default incc
so you don't have to specify an extra env varThe text was updated successfully, but these errors were encountered: