@@ -1641,9 +1641,6 @@ unsafe extern "C" {
16411641 Name : * const c_char ,
16421642 ) -> & ' a Value ;
16431643
1644- /// Processes the module and writes it in an offload compatible way into a "host.out" file.
1645- pub ( crate ) fn LLVMRustBundleImages < ' a > ( M : & ' a Module , TM : & ' a TargetMachine ) -> bool ;
1646-
16471644 /// Writes a module to the specified path. Returns 0 on success.
16481645 pub ( crate ) fn LLVMWriteBitcodeToFile ( M : & Module , Path : * const c_char ) -> c_int ;
16491646
@@ -1721,6 +1718,37 @@ unsafe extern "C" {
17211718 ) -> & ' a Value ;
17221719}
17231720
1721+ #[ cfg( feature = "llvm_offload" ) ]
1722+ pub ( crate ) use self :: Offload :: * ;
1723+
1724+ #[ cfg( feature = "llvm_offload" ) ]
1725+ mod Offload {
1726+ use super :: * ;
1727+ unsafe extern "C" {
1728+ /// Processes the module and writes it in an offload compatible way into a "host.out" file.
1729+ pub ( crate ) fn LLVMRustBundleImages < ' a > ( M : & ' a Module , TM : & ' a TargetMachine ) -> bool ;
1730+ pub ( crate ) fn LLVMRustOffloadMapper < ' a > ( OldFn : & ' a Value , NewFn : & ' a Value ) ;
1731+ }
1732+ }
1733+
1734+ #[ cfg( not( feature = "llvm_offload" ) ) ]
1735+ pub ( crate ) use self :: Offload_fallback :: * ;
1736+
1737+ #[ cfg( not( feature = "llvm_offload" ) ) ]
1738+ mod Offload_fallback {
1739+ use super :: * ;
1740+ /// Processes the module and writes it in an offload compatible way into a "host.out" file.
1741+ /// Marked as unsafe to match the real offload wrapper which is unsafe due to FFI.
1742+ #[ allow( unused_unsafe) ]
1743+ pub ( crate ) unsafe fn LLVMRustBundleImages < ' a > ( _M : & ' a Module , _TM : & ' a TargetMachine ) -> bool {
1744+ unimplemented ! ( "This rustc version was not built with LLVM Offload support!" ) ;
1745+ }
1746+ #[ allow( unused_unsafe) ]
1747+ pub ( crate ) unsafe fn LLVMRustOffloadMapper < ' a > ( _OldFn : & ' a Value , _NewFn : & ' a Value ) {
1748+ unimplemented ! ( "This rustc version was not built with LLVM Offload support!" ) ;
1749+ }
1750+ }
1751+
17241752// FFI bindings for `DIBuilder` functions in the LLVM-C API.
17251753// Try to keep these in the same order as in `llvm/include/llvm-c/DebugInfo.h`.
17261754//
@@ -2028,7 +2056,6 @@ unsafe extern "C" {
20282056 ) -> & Attribute ;
20292057
20302058 // Operations on functions
2031- pub ( crate ) fn LLVMRustOffloadMapper < ' a > ( Fn : & ' a Value , Fn : & ' a Value ) ;
20322059 pub ( crate ) fn LLVMRustGetOrInsertFunction < ' a > (
20332060 M : & ' a Module ,
20342061 Name : * const c_char ,
0 commit comments