Skip to content

Commit 433bd14

Browse files
committed
wip
1 parent cd02b90 commit 433bd14

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ pub(crate) fn gen_image_wrapper_module<'ll>(
7474
let zeroinit = cx.const_null(offload_entry_arr);
7575
llvm::set_initializer(llglobal, zeroinit);
7676

77+
let c_name = CString::new("llvm.compiler.used").unwrap();
78+
let arr_val = cx.const_array(tptr, &[llglobal]);
79+
let c_section_name = CString::new("llvm.metadata").unwrap();
80+
let llglobal = add_global(&cx, "llvm.compiler.used", arr_val, AppendingLinkage);
81+
llvm::set_section(llglobal, &c_section_name);
82+
llvm::set_global_constant(llglobal, false);
83+
84+
//@llvm.compiler.used = appending global [1 x ptr] [ptr @__dummy.omp_offloading_entries], section "llvm.metadata"
85+
7786
let mapper_fn_ty = cx.type_func(&[tptr], cx.type_void());
7887
let foo = crate::declare::declare_simple_fn(
7988
&cx,

0 commit comments

Comments
 (0)