]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_llvm/attributes.rs
Rollup merge of #67363 - alexcrichton:wasm-import-modules, r=eddyb
[rust.git] / src / librustc_codegen_llvm / attributes.rs
index 5479a1f31445e8f7f6c74a5a5918b4f4cb5b86ea..3f2a51b45bd0645fbf56f1b9ff0d0b30a6e5f422 100644 (file)
@@ -344,6 +344,17 @@ pub fn from_fn_attrs(
                 const_cstr!("wasm-import-module"),
                 &module,
             );
+
+            let name = codegen_fn_attrs.link_name.unwrap_or_else(|| {
+                cx.tcx.item_name(instance.def_id())
+            });
+            let name = CString::new(&name.as_str()[..]).unwrap();
+            llvm::AddFunctionAttrStringValue(
+                llfn,
+                llvm::AttributePlace::Function,
+                const_cstr!("wasm-import-name"),
+                &name,
+            );
         }
     }
 }