From 1de946251b79bcc00a626fdbf3c5d86a5ce3b3ba Mon Sep 17 00:00:00 2001 From: termux-pacman-bot Date: Wed, 21 Sep 2022 11:37:23 +0000 Subject: [PATCH] chore(main/rust): update llvm-15 patch The PR it was taken from was updated before merge. --- packages/rust/rust-1.63.0-llvm-wrapper.patch | 44 +++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/packages/rust/rust-1.63.0-llvm-wrapper.patch b/packages/rust/rust-1.63.0-llvm-wrapper.patch index 3b419c960c..20da0a9dc8 100644 --- a/packages/rust/rust-1.63.0-llvm-wrapper.patch +++ b/packages/rust/rust-1.63.0-llvm-wrapper.patch @@ -1,37 +1,37 @@ https://github.com/rust-lang/rust/commit/fe02ee8be97fc94166e3920d16d550bd6994fabd https://github.com/rust-lang/rust/commit/a89d014a211386f2b0ead0d309a588c625d45514 -https://github.com/rust-lang/rust/commit/d9103d656cac3aec380e50b5c73d647d462a2dd5 +https://github.com/rust-lang/rust/commit/a3a88c73f104d11849a31ebbf1c4ff4b10fc1e8d -From d9103d656cac3aec380e50b5c73d647d462a2dd5 Mon Sep 17 00:00:00 2001 +From a3a88c73f104d11849a31ebbf1c4ff4b10fc1e8d Mon Sep 17 00:00:00 2001 From: Krasimir Georgiev -Date: Wed, 29 Jun 2022 13:03:18 +0000 +Date: Wed, 29 Jun 2022 14:00:40 +0000 Subject: [PATCH] llvm-wrapper: adapt for LLVMConstExtractValue removal --- - compiler/rustc_codegen_llvm/src/common.rs | 2 +- - compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 6 +----- - compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 14 ++++++++++++++ - src/tools/rust-installer | 2 +- - 4 files changed, 17 insertions(+), 7 deletions(-) + compiler/rustc_codegen_llvm/src/common.rs | 3 +-- + compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 6 +----- + compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 8 ++++++++ + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs -index b69d7a000ee9ab..c9ec08dbaadaad 100644 +index b69d7a000ee9..d37aadeb523a 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs -@@ -110,7 +110,7 @@ impl<'ll> CodegenCx<'ll, '_> { +@@ -109,8 +109,7 @@ pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value { + pub fn const_get_elt(&self, v: &'ll Value, idx: u64) -> &'ll Value { unsafe { assert_eq!(idx as c_uint as u64, idx); - let us = &[idx as c_uint]; +- let us = &[idx as c_uint]; - let r = llvm::LLVMConstExtractValue(v, us.as_ptr(), us.len() as c_uint); -+ let r = llvm::LLVMRustGetAggregateElement(v, idx as c_uint); ++ let r = llvm::LLVMGetAggregateElement(v, idx as c_uint).unwrap(); debug!("const_get_elt(v={:?}, idx={}, r={:?})", v, idx, r); diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -index b831423994f240..5a3b8cf670b206 100644 +index b831423994f2..d92d9d96fe2c 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs -@@ -1134,11 +1134,7 @@ extern "C" { +@@ -1134,11 +1134,7 @@ pub fn LLVMRustConstInBoundsGEP2<'a>( pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value; @@ -40,29 +40,23 @@ index b831423994f240..5a3b8cf670b206 100644 - IdxList: *const c_uint, - NumIdx: c_uint, - ) -> &Value; -+ pub fn LLVMRustGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> &Value; ++ pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>; // Operations on global variables, functions, and aliases (globals) pub fn LLVMIsDeclaration(Global: &Value) -> Bool; diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -index a52d534024206e..cfd4cd90ee6ce3 100644 +index a52d53402420..8c5b4e2dc96f 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp -@@ -1865,3 +1865,17 @@ extern "C" void LLVMRustGetMangledName(LLVMValueRef V, RustStringRef Str) { +@@ -1865,3 +1865,11 @@ extern "C" void LLVMRustGetMangledName(LLVMValueRef V, RustStringRef Str) { GlobalValue *GV = unwrap(V); Mangler().getNameWithPrefix(OS, GV, true); } + +// LLVMGetAggregateElement was added in LLVM 15. For earlier LLVM versions just +// use its implementation. -+#if LLVM_VERSION_GE(15, 0) -+extern "C" LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx); -+ -+extern "C" LLVMValueRef LLVMRustGetAggregateElement(LLVMValueRef C, unsigned Idx) { -+ return LLVMGetAggregateElement(C, Idx); -+} -+#else -+extern "C" LLVMValueRef LLVMRustGetAggregateElement(LLVMValueRef C, unsigned Idx) { ++#if LLVM_VERSION_LT(15, 0) ++extern "C" LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx) { + return wrap(unwrap(C)->getAggregateElement(Idx)); +} +#endif