Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS fat binaries: should every arch include bitcode?

When building a library that is to be used in bitcode-enabled apps, does each arch in the fat binary need to be built with -fembed-bitcode or only one of them?

One of them because the bitcode is architecture-independent and will just be duplicated?

All of them because pre-processor commands may alter the code based on architecture (e.g. NSInteger width)?

Excluding x86 slices otherwise duplicate symbol _llvm.cmdline happens? - rdar://21884601

like image 344
OrangeDog Avatar asked Jul 22 '15 14:07

OrangeDog


People also ask

Should I enable Bitcode iOS?

By embedding bitcode (setting the flag to YES), we give Apple an opportunity to rebuild our application on their side and optimize it further, without being required to upload a new build. It can happen, if some bugs in the compiler are fixed, or a new device type with a new architecture type is introduced.

Does Apple require Bitcode?

Including Bitcode is optional for iOS apps, but mandatory for watchOS or tvOS apps.

What is iOS Bitcode?

Bitcode is an Apple technology that enables you to recompile your app to reduce its size. The recompilation happens when you upload your app to App Store Connect or export it for Ad Hoc, Development, or Enterprise distribution. To learn more about bitcode, see Distribution Options.


1 Answers

Bitcode is just another form of LLVM IR, which is architecture-dependent.

Which means that each slice in your fat binary should contain it's own bitcode section.

UPD. I wrote a blog-post about Bitcode, you may find there some useful details: Bitcode Demystified

like image 61
AlexDenisov Avatar answered Sep 30 '22 17:09

AlexDenisov