diff --git a/patches/rust_embed_cmdline.diff b/patches/rust_embed_cmdline.diff index 46cdafe..79f3f45 100644 --- a/patches/rust_embed_cmdline.diff +++ b/patches/rust_embed_cmdline.diff @@ -1,14 +1,31 @@ diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs -index 52f3a1cbb5c..6014a1d8ade 100644 +index 0c243128104..514ef813b43 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs -@@ -686,7 +686,9 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext, +@@ -848,12 +848,26 @@ unsafe fn embed_bitcode( + let is_apple = cgcx.opts.target_triple.triple().contains("-ios") + || cgcx.opts.target_triple.triple().contains("-darwin"); + ++ let mut triple = String::from(cgcx.opts.target_triple.triple()); ++ let mut abi = "darwinpcs"; ++ if triple == "aarch64-apple-ios" { ++ triple = String::from("arm64-apple-ios"); ++ } else if triple == "armv7-apple-ios" { ++ triple = String::from("thumbv7-apple-ios"); ++ abi = "apcs-gnu"; ++ } ++ if triple.contains("-ios") { ++ triple.push_str("9.0.0"); ++ } ++ + let section = if is_apple { "__LLVM,__bitcode\0" } else { ".llvmbc\0" }; + llvm::LLVMSetSection(llglobal, section.as_ptr().cast()); llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage); llvm::LLVMSetGlobalConstant(llglobal, llvm::True); - + - let llconst = common::bytes_in_context(llcx, &[]); -+ let args = "-triple\0arm64-apple-ios11.0.0\0-emit-obj\0\ -+ -disable-llvm-passes\0-target-abi\0darwinpcs\0-Os\0"; ++ let args = format!("-triple\0{}\0-emit-obj\0\ ++ -disable-llvm-passes\0-target-abi\0{}\0-Os\0", triple, abi); + let llconst = common::bytes_in_context(llcx, args.as_bytes()); let llglobal = llvm::LLVMAddGlobal( llmod,