diff --git a/nac3artiq/src/lib.rs b/nac3artiq/src/lib.rs index 7148255e..6da4dcf3 100644 --- a/nac3artiq/src/lib.rs +++ b/nac3artiq/src/lib.rs @@ -782,34 +782,36 @@ impl Nac3 { CodeModel::Default, ) .expect("couldn't create target machine"); - target_machine - .write_to_file(&main, FileType::Object, &working_directory.join("module.o")) - .expect("couldn't write module to file"); + let object_file = target_machine + .write_to_memory_buffer(&main, FileType::Object) + .expect("couldn't write module to object file buffer") + .create_object_file() + .expect("couldn't convert memory buffer into object file"); - let mut linker_args = vec![ - "-shared".to_string(), - "--eh-frame-hdr".to_string(), - "-x".to_string(), - "-o".to_string(), - filename.to_string(), - working_directory.join("module.o").to_string_lossy().to_string(), - ]; - if isa != Isa::Host { - linker_args.push( - "-T".to_string() - + self.working_directory.path().join("kernel.ld").to_str().unwrap(), - ); - } + // let mut linker_args = vec![ + // "-shared".to_string(), + // "--eh-frame-hdr".to_string(), + // "-x".to_string(), + // "-o".to_string(), + // filename.to_string(), + // working_directory.join("module.o").to_string_lossy().to_string(), + // ]; + // if isa != Isa::Host { + // linker_args.push( + // "-T".to_string() + // + self.working_directory.path().join("kernel.ld").to_str().unwrap(), + // ); + // } - if let Ok(linker_status) = Command::new("ld.lld").args(linker_args).status() { - if !linker_status.success() { - return Err(CompileError::new_err("failed to start linker")); - } - } else { - return Err(CompileError::new_err( - "linker returned non-zero status code", - )); - } + // if let Ok(linker_status) = Command::new("ld.lld").args(linker_args).status() { + // if !linker_status.success() { + // return Err(CompileError::new_err("failed to start linker")); + // } + // } else { + // return Err(CompileError::new_err( + // "linker returned non-zero status code", + // )); + // } Ok(()) }