Skip to content

Commit 6c48bfc

Browse files
authored
Merge pull request #7 from getditto/tk/llvm-cmdline
Problem: App Store rejects app containing Rust with bitcode error
2 parents 9a72808 + d135d34 commit 6c48bfc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

build.sh

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ cd rust
3838
git reset --hard
3939
git clean -f
4040
git checkout "$RUST_BRANCH"
41+
git apply ../../patches/rust_embed_cmdline.diff
4142
cd ..
4243
mkdir -p rust-build
4344
cd rust-build

config.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ RUST_BRANCH="tags/1.40.0"
1515
# 3. Select a name for the toolchain you want to install as. The toolchain will be installed
1616
# under $HOME/.rust-ios-arm64/toolchain-$RUST_TOOLCHAIN
1717

18-
RUST_TOOLCHAIN="1.40.0"
18+
RUST_TOOLCHAIN="1.40.0"
19+

patches/rust_embed_cmdline.diff

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
2+
index 52f3a1cbb5c..6014a1d8ade 100644
3+
--- a/src/librustc_codegen_llvm/back/write.rs
4+
+++ b/src/librustc_codegen_llvm/back/write.rs
5+
@@ -686,7 +686,9 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext<LlvmCodegenBackend>,
6+
llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage);
7+
llvm::LLVMSetGlobalConstant(llglobal, llvm::True);
8+
9+
- let llconst = common::bytes_in_context(llcx, &[]);
10+
+ let args = "-triple\0arm64-apple-ios11.0.0\0-emit-obj\0\
11+
+ -disable-llvm-passes\0-target-abi\0darwinpcs\0-Os\0";
12+
+ let llconst = common::bytes_in_context(llcx, args.as_bytes());
13+
let llglobal = llvm::LLVMAddGlobal(
14+
llmod,
15+
common::val_ty(llconst),

0 commit comments

Comments
 (0)