diff options
| author | James Dietz <jamesthespeedy@gmail.com> | 2023-04-28 17:23:40 -0400 |
|---|---|---|
| committer | James Dietz <jamesthespeedy@gmail.com> | 2023-05-04 20:29:38 -0400 |
| commit | 9aa596a014d2582c1c51166953bd3fd85c71cca8 (patch) | |
| tree | 75801813d18bc867dd994014adfc0ff3783b9416 /compiler/rustc_codegen_llvm/src | |
| parent | ea17aa9141cde9f26ec09b423ca2efe8aa08cc33 (diff) | |
| download | rust-9aa596a014d2582c1c51166953bd3fd85c71cca8.tar.gz rust-9aa596a014d2582c1c51166953bd3fd85c71cca8.zip | |
moved default CPU message inline
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index c95148013eb..53d97f35201 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -2249,7 +2249,7 @@ extern "C" { pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool; - pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine); + pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine, cpu: *const c_char); pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t; pub fn LLVMRustGetTargetFeature( T: &TargetMachine, diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 71fe8d36132..1baef931ff9 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -330,11 +330,9 @@ pub(crate) fn print(req: PrintRequest, sess: &Session) { let tm = create_informational_target_machine(sess); match req { PrintRequest::TargetCPUs => { - println!( - "Default CPU for this target:\n {}", - handle_native(sess.target.cpu.as_ref()) - ); - unsafe { llvm::LLVMRustPrintTargetCPUs(tm, handle_native(sess.target.cpu.as_ref())) }; + let cpu_cstring = CString::new(handle_native(sess.target.cpu.as_ref())) + .expect("failed to convert to cstring"); + unsafe { llvm::LLVMRustPrintTargetCPUs(tm, cpu_cstring.as_ptr()) }; } PrintRequest::TargetFeatures => print_target_features(sess, tm), _ => bug!("rustc_codegen_llvm can't handle print request: {:?}", req), |
