Uh oh!
There was an error while loading. Please reload this page.
rustc: Enable embedding LLVM bitcode for iOS - #48896
Conversation
rust-highfive
commented
Mar 9, 2018
(rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Mar 9, 2018
cc @comex, @michaeleiselsc, y'all may want to double check me on this! |
alexcrichton
commented
Mar 9, 2018
Some helpful links thanks to @comex
|
michaeleiselsc
commented
Mar 9, 2018
i'm still not sure if we want to always have bitcode on, i think it may cause binary bloat for internal distributions, @comex do you know? |
db9d67e to
d2855b0Comparecomex
commented
Mar 10, 2018
Well, I don't know of anything that would normally strip it out. (In particular, I'm building this PR locally and will at least do a basic test of whether I can build a Rust static library and link it into an iOS app with bitcode enabled, without the linker complaining about missing bitcode objects. That wouldn't guarantee that the bitcode is actually reasonable: in particular, rustc currently defaults to building against LLVM 6, while the latest Xcode is based on LLVM 5, and I have no idea what Apple's servers are running. But it's a start. |
michaeleiselsc
commented
Mar 10, 2018
a few more questions:
|
alexcrichton
commented
Mar 10, 2018
@comex thanks for testing! @michaeleiselsc I'm not so sure myself, I'm relying on y'all for guidance on what you need from rustc :( |
comex
commented
Mar 10, 2018
I tried to test it but ran into some issues with the standard library build - in particular, #48906, which I just filed, combined with an odd bug where |
michaeleiselsc
commented
Mar 11, 2018
It feels like there are a lot of potential issues with always generating bitcode, so although I can take a look at them, I feel like we should provide an option not to emit bitcode. In fact, because bitcode in Xcode is off by default IIRC, perhaps we should make the default be not to generate bitcode and just provide this as an option |
bors
commented
Mar 11, 2018
☔ The latest upstream changes (presumably #48549) made this pull request unmergeable. Please resolve the merge conflicts. |
Okay, I figured out what's going on.
For now, as a workaround for the LLVM bug, I think the best approach is to avoid Also, I agree with @michaeleiselsc that there should be an option to control the behavior. |
michaeleiselsc
commented
Mar 12, 2018
d2855b0 to
b9120a9Comparealexcrichton
commented
Mar 12, 2018
Thanks for the investigation @comex! I've updated to fix those various rustbuild issues you pointed out and went ahead and disabled this by default for iOS. It can be enabled with |
b9120a9 to
d9f6aebComparemichaelwoerister
commented
Mar 13, 2018
Ping me when this is ready for review. |
* Pass `opt_level(2)` when calculating CFLAGS to get the right flags on iOS * Unconditionally pass `-O2` when compiling libbacktrace This should... Closerust-lang#48903Closerust-lang#48906
d9f6aeb to
b284fbaCompareThis commit updates rustc to embed bitcode in each object file generated by default when compiling for iOS. This was determined in rust-lang#35968 as a step towards better compatibility with the iOS toolchain, so let's give it a spin and see how it turns out! Note that this also updates the `cc` dependency which should propagate this change of embedding bitcode for C dependencies as well.
b284fba to
0e0f74bComparealexcrichton
commented
Mar 13, 2018
Ok @michaelwoerister I think this should be ready! @michaeleiselsc errors like #46447may have been fixed by #46772, although maybe not as well |
| ".llvmbc\0" | ||
| }; | ||
| llvm::LLVMSetSection(llglobal, section.as_ptr() as *const _); | ||
| llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage); |
There was a problem hiding this comment.
I guess this is what clang is doing?
| fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> { | ||
| let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", ".libs")?; | ||
| let cflags = env::var("CFLAGS").unwrap_or_default() + " -fvisibility=hidden -O2"; |
There was a problem hiding this comment.
Is this related to bitcode embedding?
There was a problem hiding this comment.
Sort of tangentially yeah, but it's otherwise fixing issues that @comex brought up when testing this
There was a problem hiding this comment.
I later saw that this is in a separate commit with proper commit message anyway. Thanks for the info!
michaelwoerister
commented
Mar 13, 2018
Thanks, @alexcrichton! Looks good to me. @bors r+ |
bors
commented
Mar 13, 2018
📌 Commit 0e0f74b has been approved by |
bors
commented
Mar 16, 2018
…ster rustc: Enable embedding LLVM bitcode for iOS This commit updates rustc to embed bitcode in each object file generated by default when compiling for iOS. This was determined in #35968 as a step towards better compatibility with the iOS toolchain, so let's give it a spin and see how it turns out! Note that this also updates the `cc` dependency which should propagate this change of embedding bitcode for C dependencies as well.
bors
commented
Mar 16, 2018
☀️ Test successful - status-appveyor, status-travis |
This commit updates rustc to embed bitcode in each object file generated by
default when compiling for iOS. This was determined in #35968 as a step
towards better compatibility with the iOS toolchain, so let's give it a spin and
see how it turns out!
Note that this also updates the
ccdependency which should propagate thischange of embedding bitcode for C dependencies as well.