about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-03 15:07:39 +0000
committerbors <bors@rust-lang.org>2022-12-03 15:07:39 +0000
commitcab4fd678c5b148a330f2bf255bf28a67dfea0fc (patch)
treeeb14414a1876cb31bc742ce555b708be3ecbb8a3 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent4bb15759d7eb519be70c9a955dba9be09e13c06d (diff)
parenta99838a1151ee0c8423a7c3d32789a7c03adbf41 (diff)
downloadrust-cab4fd678c5b148a330f2bf255bf28a67dfea0fc.tar.gz
rust-cab4fd678c5b148a330f2bf255bf28a67dfea0fc.zip
Auto merge of #97485 - bjorn3:new_archive_writer, r=wesleywiser
Rewrite LLVM's archive writer in Rust

This allows it to be used by other codegen backends.

Fixes https://github.com/bjorn3/rustc_codegen_cranelift/issues/1155
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 216c35d6da0..792d921c6a4 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1967,3 +1967,7 @@ extern "C" int32_t LLVMRustGetElementTypeArgIndex(LLVMValueRef CallSite) {
 #endif
     return -1;
 }
+
+extern "C" bool LLVMRustIsBitcode(char *ptr, size_t len) {
+  return identify_magic(StringRef(ptr, len)) == file_magic::bitcode;
+}