1
1
use std:: { env, fs} ;
2
2
3
- use gccjit:: { Context , OutputKind } ;
3
+ use gccjit:: OutputKind ;
4
4
use rustc_codegen_ssa:: back:: link:: ensure_removed;
5
5
use rustc_codegen_ssa:: back:: write:: { BitcodeSection , CodegenContext , EmitObj , ModuleConfig } ;
6
6
use rustc_codegen_ssa:: { CompiledModule , ModuleCodegen } ;
@@ -34,10 +34,10 @@ pub(crate) unsafe fn codegen(
34
34
// TODO: remove this environment variable.
35
35
let fat_lto = env:: var ( "EMBED_LTO_BITCODE" ) . as_deref ( ) == Ok ( "1" ) ;
36
36
37
- if cgcx. msvc_imps_needed {
37
+ /* if cgcx.msvc_imps_needed {
38
38
println!("************************************************** Imps needed");
39
39
create_msvc_imps(cgcx, context);
40
- }
40
+ }*/
41
41
42
42
let bc_out = cgcx. output_filenames . temp_path ( OutputType :: Bitcode , module_name) ;
43
43
let obj_out = cgcx. output_filenames . temp_path ( OutputType :: Object , module_name) ;
@@ -58,56 +58,67 @@ pub(crate) unsafe fn codegen(
58
58
}*/
59
59
60
60
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
61
- let _timer = cgcx
62
- . prof
63
- . generic_activity_with_arg ( "GCC_module_codegen_emit_bitcode" , & * module. name ) ;
61
+ let _timer = cgcx. prof . generic_activity_with_arg (
62
+ "GCC_module_codegen_emit_bitcode" ,
63
+ & * module. name ,
64
+ ) ;
64
65
context. add_command_line_option ( "-flto=auto" ) ;
65
66
context. add_command_line_option ( "-flto-partition=one" ) ;
66
67
// TODO: remove since we don't want fat objects when it is for Bitcode only.
67
68
context. add_command_line_option ( "-ffat-lto-objects" ) ;
68
- context
69
- . compile_to_file ( OutputKind :: ObjectFile , bc_out. to_str ( ) . expect ( "path to str" ) ) ;
69
+ context. compile_to_file (
70
+ OutputKind :: ObjectFile ,
71
+ bc_out. to_str ( ) . expect ( "path to str" ) ,
72
+ ) ;
70
73
}
71
74
72
75
if config. emit_obj == EmitObj :: ObjectCode ( BitcodeSection :: Full ) {
73
- let _timer = cgcx
74
- . prof
75
- . generic_activity_with_arg ( "GCC_module_codegen_embed_bitcode" , & * module. name ) ;
76
+ let _timer = cgcx. prof . generic_activity_with_arg (
77
+ "GCC_module_codegen_embed_bitcode" ,
78
+ & * module. name ,
79
+ ) ;
76
80
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
77
81
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
78
82
79
83
context. add_command_line_option ( "-flto=auto" ) ;
80
84
context. add_command_line_option ( "-flto-partition=one" ) ;
81
85
context. add_command_line_option ( "-ffat-lto-objects" ) ;
82
86
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
83
- context
84
- . compile_to_file ( OutputKind :: ObjectFile , bc_out. to_str ( ) . expect ( "path to str" ) ) ;
87
+ context. compile_to_file (
88
+ OutputKind :: ObjectFile ,
89
+ bc_out. to_str ( ) . expect ( "path to str" ) ,
90
+ ) ;
85
91
}
86
- }
87
- else {
92
+ } else {
88
93
if config. emit_bc || config. emit_obj == EmitObj :: Bitcode {
89
- let _timer = cgcx
90
- . prof
91
- . generic_activity_with_arg ( "GCC_module_codegen_emit_bitcode" , & * module. name ) ;
92
- context
93
- . compile_to_file ( OutputKind :: ObjectFile , bc_out. to_str ( ) . expect ( "path to str" ) ) ;
94
+ let _timer = cgcx. prof . generic_activity_with_arg (
95
+ "GCC_module_codegen_emit_bitcode" ,
96
+ & * module. name ,
97
+ ) ;
98
+ context. compile_to_file (
99
+ OutputKind :: ObjectFile ,
100
+ bc_out. to_str ( ) . expect ( "path to str" ) ,
101
+ ) ;
94
102
}
95
103
96
104
if config. emit_obj == EmitObj :: ObjectCode ( BitcodeSection :: Full ) {
97
105
// TODO: we might want to emit to emit an error here, saying to set the
98
106
// environment variable EMBED_LTO_BITCODE.
99
- let _timer = cgcx
100
- . prof
101
- . generic_activity_with_arg ( "GCC_module_codegen_embed_bitcode" , & * module. name ) ;
107
+ let _timer = cgcx. prof . generic_activity_with_arg (
108
+ "GCC_module_codegen_embed_bitcode" ,
109
+ & * module. name ,
110
+ ) ;
102
111
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
103
112
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
104
113
105
114
context. add_command_line_option ( "-flto=auto" ) ;
106
115
context. add_command_line_option ( "-flto-partition=one" ) ;
107
116
context. add_command_line_option ( "-ffat-lto-objects" ) ;
108
117
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
109
- context
110
- . compile_to_file ( OutputKind :: ObjectFile , bc_out. to_str ( ) . expect ( "path to str" ) ) ;
118
+ context. compile_to_file (
119
+ OutputKind :: ObjectFile ,
120
+ bc_out. to_str ( ) . expect ( "path to str" ) ,
121
+ ) ;
111
122
}
112
123
}
113
124
}
@@ -230,10 +241,7 @@ pub(crate) fn save_temp_bitcode(
230
241
}*/
231
242
}
232
243
233
- fn create_msvc_imps < ' gcc > (
234
- cgcx : & CodegenContext < GccCodegenBackend > ,
235
- _context : & Context < ' gcc > ,
236
- ) {
244
+ /*fn create_msvc_imps<'gcc>(cgcx: &CodegenContext<GccCodegenBackend>, _context: &Context<'gcc>) {
237
245
if !cgcx.msvc_imps_needed {
238
246
return;
239
247
}
@@ -259,4 +267,4 @@ fn create_msvc_imps<'gcc>(
259
267
llvm::set_linkage(imp, llvm::Linkage::ExternalLinkage);
260
268
}
261
269
}*/
262
- }
270
+ }*/
0 commit comments