Skip to content

Commit ba3785e

Browse files
committed
add targetarch for CodegenContext
1 parent b5febe7 commit ba3785e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/librustc_codegen_llvm/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -795,10 +795,10 @@ fn create_msvc_imps(
795795
return
796796
}
797797
// The x86 ABI seems to require that leading underscores are added to symbol
798-
// names, so we need an extra underscore on 32-bit. There's also a leading
798+
// names, so we need an extra underscore on x86. There's also a leading
799799
// '\x01' here which disables LLVM's symbol mangling (e.g., no extra
800800
// underscores added in front).
801-
let prefix = if cgcx.target_pointer_width == "32" {
801+
let prefix = if cgcx.target_arch == "x86" {
802802
"\x01__imp__"
803803
} else {
804804
"\x01__imp_"

src/librustc_codegen_ssa/back/write.rs

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
248248
pub tm_factory: TargetMachineFactory<B>,
249249
pub msvc_imps_needed: bool,
250250
pub target_pointer_width: String,
251+
pub target_arch: String,
251252
pub debuginfo: config::DebugInfo,
252253

253254
// Number of cgus excluding the allocator/metadata modules
@@ -1103,6 +1104,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
11031104
total_cgus,
11041105
msvc_imps_needed: msvc_imps_needed(tcx),
11051106
target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
1107+
target_arch: tcx.sess.target.target.arch.clone(),
11061108
debuginfo: tcx.sess.opts.debuginfo,
11071109
assembler_cmd,
11081110
};

0 commit comments

Comments
 (0)