@@ -24,19 +24,15 @@ pub(crate) unsafe fn codegen(
2424 {
2525 let context = & module. module_llvm . context ;
2626
27- let module_name = module. name . clone ( ) ;
28-
2927 let should_combine_object_files = module. module_llvm . should_combine_object_files ;
3028
31- let module_name = Some ( & module_name[ ..] ) ;
32-
3329 // NOTE: Only generate object files with GIMPLE when this environment variable is set for
3430 // now because this requires a particular setup (same gcc/lto1/lto-wrapper commit as libgccjit).
3531 // TODO(antoyo): remove this environment variable.
3632 let fat_lto = env:: var ( "EMBED_LTO_BITCODE" ) . as_deref ( ) == Ok ( "1" ) ;
3733
38- let bc_out = cgcx. output_filenames . temp_path ( OutputType :: Bitcode , module_name ) ;
39- let obj_out = cgcx. output_filenames . temp_path ( OutputType :: Object , module_name ) ;
34+ let bc_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Bitcode , & module . name ) ;
35+ let obj_out = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Object , & module . name ) ;
4036
4137 if config. bitcode_needed ( ) {
4238 if fat_lto {
@@ -117,14 +113,15 @@ pub(crate) unsafe fn codegen(
117113 }
118114
119115 if config. emit_ir {
120- let out = cgcx. output_filenames . temp_path ( OutputType :: LlvmAssembly , module_name) ;
116+ let out =
117+ cgcx. output_filenames . temp_path_for_cgu ( OutputType :: LlvmAssembly , & module. name ) ;
121118 std:: fs:: write ( out, "" ) . expect ( "write file" ) ;
122119 }
123120
124121 if config. emit_asm {
125122 let _timer =
126123 cgcx. prof . generic_activity_with_arg ( "GCC_module_codegen_emit_asm" , & * module. name ) ;
127- let path = cgcx. output_filenames . temp_path ( OutputType :: Assembly , module_name ) ;
124+ let path = cgcx. output_filenames . temp_path_for_cgu ( OutputType :: Assembly , & module . name ) ;
128125 context. compile_to_file ( OutputKind :: Assembler , path. to_str ( ) . expect ( "path to str" ) ) ;
129126 }
130127
0 commit comments