@@ -205,7 +205,7 @@ fn prefix_and_suffix<'tcx>(
205205 let mut end = String :: new ( ) ;
206206 match asm_binary_format {
207207 BinaryFormat :: Elf => {
208- let section = link_section. unwrap_or ( format ! ( ".text.{asm_name}" ) ) ;
208+ let section = link_section. unwrap_or_else ( || format ! ( ".text.{asm_name}" ) ) ;
209209
210210 let progbits = match is_arm {
211211 true => "%progbits" ,
@@ -239,7 +239,7 @@ fn prefix_and_suffix<'tcx>(
239239 }
240240 }
241241 BinaryFormat :: MachO => {
242- let section = link_section. unwrap_or ( "__TEXT,__text" . to_string ( ) ) ;
242+ let section = link_section. unwrap_or_else ( || "__TEXT,__text" . to_string ( ) ) ;
243243 writeln ! ( begin, ".pushsection {},regular,pure_instructions" , section) . unwrap ( ) ;
244244 writeln ! ( begin, ".balign {align_bytes}" ) . unwrap ( ) ;
245245 write_linkage ( & mut begin) . unwrap ( ) ;
@@ -256,7 +256,7 @@ fn prefix_and_suffix<'tcx>(
256256 }
257257 }
258258 BinaryFormat :: Coff => {
259- let section = link_section. unwrap_or ( format ! ( ".text.{asm_name}" ) ) ;
259+ let section = link_section. unwrap_or_else ( || format ! ( ".text.{asm_name}" ) ) ;
260260 writeln ! ( begin, ".pushsection {},\" xr\" " , section) . unwrap ( ) ;
261261 writeln ! ( begin, ".balign {align_bytes}" ) . unwrap ( ) ;
262262 write_linkage ( & mut begin) . unwrap ( ) ;
@@ -273,7 +273,7 @@ fn prefix_and_suffix<'tcx>(
273273 }
274274 }
275275 BinaryFormat :: Wasm => {
276- let section = link_section. unwrap_or ( format ! ( ".text.{asm_name}" ) ) ;
276+ let section = link_section. unwrap_or_else ( || format ! ( ".text.{asm_name}" ) ) ;
277277
278278 writeln ! ( begin, ".section {section},\" \" ,@" ) . unwrap ( ) ;
279279 // wasm functions cannot be aligned, so skip
0 commit comments