- if (is_cdecl && (!blhe || (blhe && blhe->type != bfd_link_hash_undefined)))
- {
- sprintf (name, "%s%s",U (""), imp[i].internal_name);
- blhe = pe_find_cdecl_alias_match (linfo, name);
- include_jmp_stub = TRUE;
- if (blhe)
- is_undef = (blhe->type == bfd_link_hash_undefined);
- }
+ /* Include the jump stub for <sym> only if the <sym>
+ is undefined. */
+ if (!blhe || (blhe && blhe->type != bfd_link_hash_undefined))
+ {
+ if (lead_at)
+ sprintf (name, "%s%s", "__imp_", imp[i].internal_name);
+ else
+ sprintf (name, "%s%s%s", "__imp_", U (""),
+ imp[i].internal_name);
+
+ blhe = bfd_link_hash_lookup (linfo->hash, name,
+ false, false, false);
+ if (blhe)
+ is_undef = (blhe->type == bfd_link_hash_undefined);
+
+ if (is_cdecl && (!blhe || !is_undef))
+ {
+ blhe = pe_find_cdecl_alias_match (linfo, name + 6);
+ include_jmp_stub = true;
+ if (blhe)
+ is_undef = (blhe->type == bfd_link_hash_undefined);
+ }
+ }
+ else
+ {
+ include_jmp_stub = true;
+ is_undef = (blhe->type == bfd_link_hash_undefined);
+ }