Always preserve user-written comments in assembly
This commit is contained in:
parent
6292b2af62
commit
64a3bd84d8
@ -436,7 +436,8 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
|
||||
Options.FunctionSections = FunctionSections;
|
||||
Options.UniqueSectionNames = UniqueSectionNames;
|
||||
Options.MCOptions.AsmVerbose = AsmComments;
|
||||
Options.MCOptions.PreserveAsmComments = AsmComments;
|
||||
// Always preserve comments that were written by the user
|
||||
Options.MCOptions.PreserveAsmComments = true;
|
||||
Options.MCOptions.ABIName = ABIStr;
|
||||
if (SplitDwarfFile) {
|
||||
Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
|
||||
|
12
tests/assembly/asm-comments.rs
Normal file
12
tests/assembly/asm-comments.rs
Normal file
@ -0,0 +1,12 @@
|
||||
//@ assembly-output: emit-asm
|
||||
//@ only-x86_64
|
||||
// Check that comments in assembly get passed
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK-LABEL: test_comments:
|
||||
#[no_mangle]
|
||||
pub fn test_comments() {
|
||||
// CHECK: example comment
|
||||
unsafe { core::arch::asm!("nop // example comment") };
|
||||
}
|
Loading…
Reference in New Issue
Block a user