Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 78bb5ee

Browse files
committedNov 8, 2024
Auto merge of #132756 - workingjubilee:rollup-bed2akn, r=workingjubilee
Rollup of 10 pull requests Successful merges: - #130586 (Set "symbol name" in raw-dylib import libraries to the decorated name) - #131913 (Add `{ignore,needs}-{rustc,std}-debug-assertions` directive support) - #132095 (Fix #131977 parens mangled in shared mut static lint suggestion) - #132131 ([StableMIR] API to retrieve definitions from crates) - #132639 (core: move intrinsics.rs into intrinsics folder) - #132696 (Compile `test_num_f128` conditionally on `reliable_f128_math` config) - #132737 (bootstrap: Print better message if lock pid isn't available) - #132739 (Fix `librustdoc/scrape_examples.rs` formatting) - #132740 (Update test for LLVM 20's new vector splat syntax) - #132741 (Update mips64 data layout to match LLVM 20 change) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5b20c45 + 97dbab9 commit 78bb5ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+569
-141
lines changed
 

‎compiler/rustc_codegen_gcc/src/archive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::path::Path;
22

33
use rustc_codegen_ssa::back::archive::{
44
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
5+
ImportLibraryItem,
56
};
67
use rustc_session::Session;
78

@@ -16,7 +17,7 @@ impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
1617
&self,
1718
_sess: &Session,
1819
_lib_name: &str,
19-
_import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
20+
_items: Vec<ImportLibraryItem>,
2021
_output_path: &Path,
2122
) {
2223
unimplemented!("creating dll imports is not yet supported");

‎compiler/rustc_codegen_llvm/src/callee.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ pub(crate) fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'t
4444
let llfn = if tcx.sess.target.arch == "x86"
4545
&& let Some(dllimport) = crate::common::get_dllimport(tcx, instance_def_id, sym)
4646
{
47+
// When calling functions in generated import libraries, MSVC needs
48+
// the fully decorated name (as would have been in the declaring
49+
// object file), but MinGW wants the name as exported (as would be
50+
// in the def file) which may be missing decorations.
51+
let mingw_gnu_toolchain = common::is_mingw_gnu_toolchain(&tcx.sess.target);
52+
let llfn = cx.declare_fn(
53+
&common::i686_decorated_name(
54+
dllimport,
55+
mingw_gnu_toolchain,
56+
true,
57+
!mingw_gnu_toolchain,
58+
),
59+
fn_abi,
60+
Some(instance),
61+
);
62+
4763
// Fix for https://github.com/rust-lang/rust/issues/104453
4864
// On x86 Windows, LLVM uses 'L' as the prefix for any private
4965
// global symbols, so when we create an undecorated function symbol
@@ -55,15 +71,6 @@ pub(crate) fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'t
5571
// LLVM will prefix the name with `__imp_`. Ideally, we'd like the
5672
// existing logic below to set the Storage Class, but it has an
5773
// exemption for MinGW for backwards compatibility.
58-
let llfn = cx.declare_fn(
59-
&common::i686_decorated_name(
60-
dllimport,
61-
common::is_mingw_gnu_toolchain(&tcx.sess.target),
62-
true,
63-
),
64-
fn_abi,
65-
Some(instance),
66-
);
6774
unsafe {
6875
llvm::LLVMSetDLLStorageClass(llfn, llvm::DLLStorageClass::DllImport);
6976
}

0 commit comments

Comments
 (0)
Please sign in to comment.