Bitcode linking with static libs + ARM assembly on Xcode 7

Hi,

I am not sure if this is the right place to post but wanted to give a try.

I have a static library created by the following commands which has ARM assembly code.

bash-3.2$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x assembler-with-cpp -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fmodules -gmodules -fmodules-prune-interval=86400 -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wno-newline-eof -DDEBUG=1 -isysroot

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -fstrict-aliasing -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -I/Users/sridhar/src/arm64/webrtc43/ios/src -Iwebrtc/common_audio/resampler/include -Iwebrtc/common_audio/signal_processing/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -fembed-bitcode -fvisibility=hidden -MMD -MT dependencies -MF webrtc/common_audio/signal_processing/common_audio.complex_bit_reverse_arm.d -c webrtc/common_audio/signal_processing/complex_bit_reverse_arm.S -o webrtc/common_audio/signal_processing/common_audio.complex_bit_reverse_arm.o

and then using libtool created archive file :

bash-3.2$ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -o libcommon_audio.a webrtc/common_audio/signal_processing/common_audio.complex_bit_reverse_arm.o

Then I tried to use the static lib into an iOS app with bitcode enabled. The following is the error from Xcode build output :

ld: could not open bitcode temp file: /Users/sridhar/src/arm64/webrtc43/ios/src/libcommon_audio.a(common_audio.complex_bit_reverse_arm.o) for architecture armv7

This is only happening with “ARM” assembly symbols, plain C symbols are fine.

May be @Greg have a clue on this.

Thanks,
Sri

Your static libraries need to enable bitcode when the .o files are generated. If you have plain assembly files that don't originate from source files, I am not sure there is a solution to get assembly files into bit code. I will check on this.

Actually the assembly file compiled with “-fembed-bitcode” flag in the static lib. In Apple developer forums, it was mentioned that, Including assembly files with “-fembed-bitcode” should just work fine. If I use a direct assembly file into Xcode App, then its working fine.

I did a bit research with the linker tool (ld) and I could see that, it was searching for .o file for assembly code externally which is not correct because it is an archive lib.