add targetarch for CodegenContext

This commit is contained in:
Chandler Deng 2019-05-16 15:05:56 -07:00
parent b5febe72bb
commit ba3785ec0a
2 changed files with 4 additions and 2 deletions

View File

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

View File

@ -248,6 +248,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
pub tm_factory: TargetMachineFactory<B>, pub tm_factory: TargetMachineFactory<B>,
pub msvc_imps_needed: bool, pub msvc_imps_needed: bool,
pub target_pointer_width: String, pub target_pointer_width: String,
pub target_arch: String,
pub debuginfo: config::DebugInfo, pub debuginfo: config::DebugInfo,
// Number of cgus excluding the allocator/metadata modules // Number of cgus excluding the allocator/metadata modules
@ -1103,6 +1104,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
total_cgus, total_cgus,
msvc_imps_needed: msvc_imps_needed(tcx), msvc_imps_needed: msvc_imps_needed(tcx),
target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(), target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
target_arch: tcx.sess.target.target.arch.clone(),
debuginfo: tcx.sess.opts.debuginfo, debuginfo: tcx.sess.opts.debuginfo,
assembler_cmd, assembler_cmd,
}; };