summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2018-08-12 17:59:18 +0000
committerwhitequark <whitequark@whitequark.org>2018-08-12 17:59:33 +0000
commit66fd1ebfae2fff815f27bf2be19469f40dd99c88 (patch)
tree9aa8acb591d49ab79de44669ff4ae63444b67476 /src/librustc_codegen_llvm
parent0aa8d0320266b5579428312095fe49af05ada972 (diff)
downloadrust-66fd1ebfae2fff815f27bf2be19469f40dd99c88.tar.gz
rust-66fd1ebfae2fff815f27bf2be19469f40dd99c88.zip
Make LLVM emit assembly comments with -Z asm-comments.
Fixes #35741.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/back/write.rs3
-rw-r--r--src/librustc_codegen_llvm/llvm/ffi.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index cdfa874b177..97f3cf614d6 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -182,6 +182,8 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
     let is_pie_binary = !find_features && is_pie_binary(sess);
     let trap_unreachable = sess.target.target.options.trap_unreachable;
 
+    let asm_comments = sess.asm_comments();
+
     Arc::new(move || {
         let tm = unsafe {
             llvm::LLVMRustCreateTargetMachine(
@@ -195,6 +197,7 @@ pub fn target_machine_factory(sess: &Session, find_features: bool)
                 fdata_sections,
                 trap_unreachable,
                 singlethread,
+                asm_comments,
             )
         };
 
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index a894f8e2fdb..d94645e61f2 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1455,7 +1455,8 @@ extern "C" {
                                        FunctionSections: bool,
                                        DataSections: bool,
                                        TrapUnreachable: bool,
-                                       Singlethread: bool)
+                                       Singlethread: bool,
+                                       AsmComments: bool)
                                        -> Option<&'static mut TargetMachine>;
     pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
     pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);