[Interop][watchos_arm64] Fix platform libs generation

Pass -O2 flag to Clang to avoid inline asm in wrappers.
This commit is contained in:
Sergey Bogolepov
2019-12-18 18:16:56 +07:00
committed by Sergey Bogolepov
parent cb226dfff1
commit 178ba2944b
@@ -381,6 +381,12 @@ internal fun buildNativeLibrary(
val compilerOpts: List<String> = mutableListOf<String>().apply {
addAll(def.config.compilerOpts)
addAll(tool.defaultCompilerOpts)
// We compile with -O2 because Clang may insert inline asm in bitcode at -O0.
// It is undesirable in case of watchos_arm64 since we target armv7k
// for this target instead of arm64_32 because it is not supported in LLVM 8.
//
// Note that PCH and the *.c file should be compiled with the same optimization level.
add("-O2")
addAll(additionalCompilerOpts)
addAll(getCompilerFlagsForVfsOverlay(arguments.headerFilterPrefix.toTypedArray(), def))
addAll(when (language) {