18
18
// FIXME:
19
19
// I had to copy lto1, crtbegin.o from the system to /opt/…
20
20
// * sudo cp /usr/lib/gcc/x86_64-pc-linux-gnu/13.1.1/lto1 /opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/13.1.1/lto1
21
- // I had to copy liblto_plugin.so to /opt/gcc/lib/gcc
21
+ // I had to copy liblto_plugin.so/lto-wrapper to /opt/gcc/lib/gcc
22
22
23
23
use std:: ffi:: CString ;
24
24
use std:: fs:: { self , File } ;
@@ -29,7 +29,7 @@ use gccjit::{OutputKind, OptimizationLevel};
29
29
use object:: read:: archive:: ArchiveFile ;
30
30
use rustc_codegen_ssa:: back:: lto:: { LtoModuleCodegen , SerializedModule } ;
31
31
use rustc_codegen_ssa:: back:: symbol_export;
32
- use rustc_codegen_ssa:: back:: write:: { CodegenContext , FatLTOInput } ;
32
+ use rustc_codegen_ssa:: back:: write:: { CodegenContext , FatLtoInput } ;
33
33
use rustc_codegen_ssa:: traits:: * ;
34
34
use rustc_codegen_ssa:: { looks_like_rust_object_file, ModuleCodegen , ModuleKind } ;
35
35
use rustc_data_structures:: memmap:: Mmap ;
@@ -179,7 +179,7 @@ fn save_as_file(obj: &[u8], path: &Path) -> Result<(), LtoBitcodeFromRlib> {
179
179
/// for further optimization.
180
180
pub ( crate ) fn run_fat (
181
181
cgcx : & CodegenContext < GccCodegenBackend > ,
182
- modules : Vec < FatLTOInput < GccCodegenBackend > > ,
182
+ modules : Vec < FatLtoInput < GccCodegenBackend > > ,
183
183
cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > ,
184
184
) -> Result < LtoModuleCodegen < GccCodegenBackend > , FatalError > {
185
185
let diag_handler = cgcx. create_diag_handler ( ) ;
@@ -191,7 +191,7 @@ pub(crate) fn run_fat(
191
191
)
192
192
}
193
193
194
- fn fat_lto ( cgcx : & CodegenContext < GccCodegenBackend > , _diag_handler : & Handler , modules : Vec < FatLTOInput < GccCodegenBackend > > , cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > , mut serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > , tmp_path : TempDir ,
194
+ fn fat_lto ( cgcx : & CodegenContext < GccCodegenBackend > , _diag_handler : & Handler , modules : Vec < FatLtoInput < GccCodegenBackend > > , cached_modules : Vec < ( SerializedModule < ModuleBuffer > , WorkProduct ) > , mut serialized_modules : Vec < ( SerializedModule < ModuleBuffer > , CString ) > , tmp_path : TempDir ,
195
195
//symbols_below_threshold: &[*const libc::c_char],
196
196
) -> Result < LtoModuleCodegen < GccCodegenBackend > , FatalError > {
197
197
let _timer = cgcx. prof . generic_activity ( "LLVM_fat_lto_build_monolithic_module" ) ;
@@ -214,8 +214,8 @@ fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &Handler, mo
214
214
} ) ) ;
215
215
for module in modules {
216
216
match module {
217
- FatLTOInput :: InMemory ( m) => in_memory. push ( m) ,
218
- FatLTOInput :: Serialized { name, buffer } => {
217
+ FatLtoInput :: InMemory ( m) => in_memory. push ( m) ,
218
+ FatLtoInput :: Serialized { name, buffer } => {
219
219
info ! ( "pushing serialized module {:?}" , name) ;
220
220
let buffer = SerializedModule :: Local ( buffer) ;
221
221
serialized_modules. push ( ( buffer, CString :: new ( name) . unwrap ( ) ) ) ;
@@ -248,7 +248,7 @@ fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &Handler, mo
248
248
// all our inputs were incrementally reread from the cache and we're just
249
249
// re-executing the LTO passes. If that's the case deserialize the first
250
250
// module and create a linker with it.
251
- let module: ModuleCodegen < GccContext > = match costliest_module {
251
+ let mut module: ModuleCodegen < GccContext > = match costliest_module {
252
252
Some ( ( _cost, i) ) => in_memory. remove ( i) ,
253
253
None => {
254
254
unimplemented ! ( "Incremental" ) ;
@@ -303,7 +303,7 @@ fn fat_lto(cgcx: &CodegenContext<GccCodegenBackend>, _diag_handler: &Handler, mo
303
303
info ! ( "linking {:?}" , name) ;
304
304
match bc_decoded {
305
305
SerializedModule :: Local ( ref module_buffer) => {
306
- cgcx . backend . should_combine_object_files . store ( true , Ordering :: SeqCst ) ;
306
+ module . module_llvm . should_combine_object_files = true ;
307
307
module. module_llvm . context . add_driver_option ( module_buffer. 0 . to_str ( ) . expect ( "path" ) ) ;
308
308
} ,
309
309
SerializedModule :: FromRlib ( _) => unimplemented ! ( "from rlib" ) ,
0 commit comments