about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-01 16:41:05 +0100
committerGitHub <noreply@github.com>2025-02-01 16:41:05 +0100
commit2a82ebdcb7512b818da18eb04d1d11f623d6e38c (patch)
tree869cab603a15f4c6b1de22ec2ee905a12af7dc5b /compiler
parent15a5f5f5e03292d0f92c3bd43541ffe1c4344da2 (diff)
parentce7cb312fa2a51d7f2cf4603d9707811f76ed611 (diff)
downloadrust-2a82ebdcb7512b818da18eb04d1d11f623d6e38c.tar.gz
rust-2a82ebdcb7512b818da18eb04d1d11f623d6e38c.zip
Rollup merge of #136374 - saethlin:enzyme-linkage, r=oli-obk
Add link attribute for Enzyme's LLVMRust FFI

Since https://github.com/rust-lang/rust/pull/133429 landed, the compiler doesn't build with `-Zcross-crate-inline-threshold=always`. I don't expect anyone else to test or fix issues with that goofy configuration, so I'm fixing it.

This PR adds a link attribute just like https://github.com/rust-lang/rust/pull/118142 for all the new LLVMRust functions. They were actually added in https://github.com/rust-lang/rust/pull/130060 but weren't used until just now.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
index ae813fe5ebf..92b0ce8ffe1 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs
@@ -4,6 +4,8 @@ use libc::{c_char, c_uint};
 
 use super::ffi::{BasicBlock, Metadata, Module, Type, Value};
 use crate::llvm::Bool;
+
+#[link(name = "llvm-wrapper", kind = "static")]
 extern "C" {
     // Enzyme
     pub fn LLVMRustHasMetadata(I: &Value, KindID: c_uint) -> bool;
@@ -12,10 +14,13 @@ extern "C" {
     pub fn LLVMRustDIGetInstMetadata(I: &Value) -> Option<&Metadata>;
     pub fn LLVMRustEraseInstFromParent(V: &Value);
     pub fn LLVMRustGetTerminator<'a>(B: &BasicBlock) -> &'a Value;
-    pub fn LLVMDumpModule(M: &Module);
-    pub fn LLVMDumpValue(V: &Value);
     pub fn LLVMRustVerifyFunction(V: &Value, action: LLVMRustVerifierFailureAction) -> Bool;
+}
 
+extern "C" {
+    // Enzyme
+    pub fn LLVMDumpModule(M: &Module);
+    pub fn LLVMDumpValue(V: &Value);
     pub fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
     pub fn LLVMGetReturnType(T: &Type) -> &Type;
     pub fn LLVMGetParams(Fnc: &Value, parms: *mut &Value);