summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_llvm/src/callee.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/callee.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/callee.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/callee.rs b/compiler/rustc_codegen_llvm/src/callee.rs
index 72155d874..b83c1e8f0 100644
--- a/compiler/rustc_codegen_llvm/src/callee.rs
+++ b/compiler/rustc_codegen_llvm/src/callee.rs
@@ -6,11 +6,11 @@
use crate::abi::FnAbiLlvmExt;
use crate::attributes;
+use crate::common;
use crate::context::CodegenCx;
use crate::llvm;
use crate::value::Value;
use rustc_codegen_ssa::traits::*;
-use tracing::debug;
use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt};
use rustc_middle::ty::{self, Instance, TypeVisitable};
@@ -79,13 +79,18 @@ pub fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>) ->
llfn
}
} else {
- let llfn = cx.declare_fn(sym, fn_abi);
+ let instance_def_id = instance.def_id();
+ let llfn = if tcx.sess.target.arch == "x86" &&
+ let Some(dllimport) = common::get_dllimport(tcx, instance_def_id, sym)
+ {
+ cx.declare_fn(&common::i686_decorated_name(&dllimport, common::is_mingw_gnu_toolchain(&tcx.sess.target), true), fn_abi)
+ } else {
+ cx.declare_fn(sym, fn_abi)
+ };
debug!("get_fn: not casting pointer!");
attributes::from_fn_attrs(cx, llfn, instance);
- let instance_def_id = instance.def_id();
-
// Apply an appropriate linkage/visibility value to our item that we
// just declared.
//