Skip to content

Commit f87e4d6

Browse files
authored
Fix asm output (#42)
1 parent ff755d3 commit f87e4d6

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

gcc-test-backend/main

-14.4 MB
Binary file not shown.

src/back/write.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,13 @@ pub(crate) unsafe fn codegen(cgcx: &CodegenContext<GccCodegenBackend>, _diag_han
144144
}
145145

146146
if config.emit_asm {
147-
unimplemented!();
148-
/*let _timer = cgcx
147+
let _timer = cgcx
149148
.prof
150149
.generic_activity_with_arg("LLVM_module_codegen_emit_asm", &module.name[..]);
151150
let path = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
151+
context.compile_to_file(OutputKind::Assembler, path.to_str().expect("path to str"));
152152

153-
// We can't use the same module for asm and object code output,
154-
// because that triggers various errors like invalid IR or broken
155-
// binaries. So we must clone the module to produce the asm output
156-
// if we are also producing object code.
157-
let llmod = if let EmitObj::ObjectCode(_) = config.emit_obj {
158-
llvm::LLVMCloneModule(llmod)
159-
} else {
160-
llmod
161-
};
162-
with_codegen(tm, llmod, config.no_builtins, |cpm| {
153+
/*with_codegen(tm, llmod, config.no_builtins, |cpm| {
163154
write_output_file(diag_handler, tm, cpm, llmod, &path, llvm::FileType::AssemblyFile)
164155
})?;*/
165156
}

0 commit comments

Comments
 (0)