@@ -512,7 +512,7 @@ fn codegen_cgu_content(
512512 tcx : TyCtxt < ' _ > ,
513513 module : & mut dyn Module ,
514514 cgu_name : rustc_span:: Symbol ,
515- ) -> ( CodegenCx , Vec < CodegenedFunction > ) {
515+ ) -> ( CodegenCx , Vec < CodegenedFunction > , String ) {
516516 let _timer = tcx. prof . generic_activity_with_arg ( "codegen cgu" , cgu_name. as_str ( ) ) ;
517517
518518 let cgu = tcx. codegen_unit ( cgu_name) ;
@@ -524,6 +524,7 @@ fn codegen_cgu_content(
524524 tcx. sess . opts . debuginfo != DebugInfo :: None ,
525525 cgu_name,
526526 ) ;
527+ let mut global_asm = String :: new ( ) ;
527528 let mut type_dbg = TypeDebugContext :: default ( ) ;
528529 super :: predefine_mono_items ( tcx, module, & mono_items) ;
529530 let mut codegened_functions = vec ! [ ] ;
@@ -533,7 +534,7 @@ fn codegen_cgu_content(
533534 if tcx. codegen_fn_attrs ( instance. def_id ( ) ) . flags . contains ( CodegenFnAttrFlags :: NAKED )
534535 {
535536 rustc_codegen_ssa:: mir:: naked_asm:: codegen_naked_asm (
536- & mut GlobalAsmContext { tcx, global_asm : & mut cx . global_asm } ,
537+ & mut GlobalAsmContext { tcx, global_asm : & mut global_asm } ,
537538 instance,
538539 MonoItemData {
539540 linkage : RLinkage :: External ,
@@ -565,15 +566,15 @@ fn codegen_cgu_content(
565566 }
566567 MonoItem :: GlobalAsm ( item_id) => {
567568 rustc_codegen_ssa:: base:: codegen_global_asm (
568- & mut GlobalAsmContext { tcx, global_asm : & mut cx . global_asm } ,
569+ & mut GlobalAsmContext { tcx, global_asm : & mut global_asm } ,
569570 item_id,
570571 ) ;
571572 }
572573 }
573574 }
574575 crate :: main_shim:: maybe_create_entry_wrapper ( tcx, module, false , cgu. is_primary ( ) ) ;
575576
576- ( cx, codegened_functions)
577+ ( cx, codegened_functions, global_asm )
577578}
578579
579580fn module_codegen (
@@ -586,7 +587,8 @@ fn module_codegen(
586587) -> OngoingModuleCodegen {
587588 let mut module = make_module ( tcx. sess , cgu_name. as_str ( ) . to_string ( ) ) ;
588589
589- let ( mut cx, codegened_functions) = codegen_cgu_content ( tcx, & mut module, cgu_name) ;
590+ let ( mut cx, codegened_functions, mut global_asm) =
591+ codegen_cgu_content ( tcx, & mut module, cgu_name) ;
590592
591593 let cgu_name = cgu_name. as_str ( ) . to_owned ( ) ;
592594
@@ -610,6 +612,7 @@ fn module_codegen(
610612 & output_filenames,
611613 & mut cached_context,
612614 & mut module,
615+ & mut global_asm,
613616 codegened_func,
614617 ) ;
615618 }
@@ -620,7 +623,7 @@ fn module_codegen(
620623 crate :: global_asm:: compile_global_asm (
621624 & global_asm_config,
622625 & cgu_name,
623- & cx . global_asm ,
626+ global_asm,
624627 invocation_temp. as_deref ( ) ,
625628 )
626629 } ) ?;
0 commit comments