Search code examples
iosapp-storeios9lipobitcode

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


Solution

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

    Which means that each slice in your fat binary should contain its own bitcode section.

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