Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for 32-bit bitcode targets #11

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions patches/rust_embed_cmdline.diff
Original file line number Diff line number Diff line change
@@ -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<LlvmCodegenBackend>,
@@ -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,
Expand Down