diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-11-05 14:34:22 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-11-06 00:16:12 +0100 |
commit | e065a32128431bc24905226893c9c033c2a75a54 (patch) | |
tree | b82bd93a5b90c30147a47c2f3b60d948039eb1de /src/codegen/mod.rs | |
parent | 5de943ca7bf6c155f7bae1d91f1e3b1d91e8d901 (diff) |
codegen: Make the mangling name check work in presence of attribute(overloadable).
Fixes #1350
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r-- | src/codegen/mod.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index d8524a3d..983ee4dd 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -3377,12 +3377,6 @@ impl CodeGenerator for Function { attributes.push(attributes::doc(comment)); } - if let Some(mangled) = mangled_name { - attributes.push(attributes::link_name(mangled)); - } else if name != canonical_name { - attributes.push(attributes::link_name(name)); - } - // Handle overloaded functions by giving each overload its own unique // suffix. let times_seen = result.overload_number(&canonical_name); @@ -3390,6 +3384,14 @@ impl CodeGenerator for Function { write!(&mut canonical_name, "{}", times_seen).unwrap(); } + if let Some(mangled) = mangled_name { + if canonical_name != mangled { + attributes.push(attributes::link_name(mangled)); + } + } else if name != canonical_name { + attributes.push(attributes::link_name(name)); + } + let abi = match signature.abi() { Abi::ThisCall if !ctx.options().rust_features().thiscall_abi => { warn!("Skipping function with thiscall ABI that isn't supported by the configured Rust target"); |