@@ -258,9 +258,14 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
258
258
}
259
259
260
260
InlineAsmOperandRef :: SymFn { instance } => {
261
+ // TODO(@Amanieu): Additional mangling is needed on
262
+ // some targets to add a leading underscore (Mach-O)
263
+ // or byte count suffixes (x86 Windows).
261
264
constants_len += self . tcx . symbol_name ( instance) . name . len ( ) ;
262
265
}
263
266
InlineAsmOperandRef :: SymStatic { def_id } => {
267
+ // TODO(@Amanieu): Additional mangling is needed on
268
+ // some targets to add a leading underscore (Mach-O).
264
269
constants_len += self . tcx . symbol_name ( Instance :: mono ( self . tcx , def_id) ) . name . len ( ) ;
265
270
}
266
271
}
@@ -412,13 +417,16 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
412
417
}
413
418
414
419
InlineAsmOperandRef :: SymFn { instance } => {
420
+ // TODO(@Amanieu): Additional mangling is needed on
421
+ // some targets to add a leading underscore (Mach-O)
422
+ // or byte count suffixes (x86 Windows).
415
423
let name = self . tcx . symbol_name ( instance) . name ;
416
424
template_str. push_str ( name) ;
417
425
}
418
426
419
427
InlineAsmOperandRef :: SymStatic { def_id } => {
420
- // TODO(@Commeownist ): This may not be sufficient for all kinds of statics.
421
- // Some statics may need the `@plt` suffix, like thread-local vars .
428
+ // TODO(@Amanieu ): Additional mangling is needed on
429
+ // some targets to add a leading underscore (Mach-O) .
422
430
let instance = Instance :: mono ( self . tcx , def_id) ;
423
431
let name = self . tcx . symbol_name ( instance) . name ;
424
432
template_str. push_str ( name) ;
@@ -656,8 +664,8 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
656
664
}
657
665
}
658
666
659
- impl < ' gcc , ' tcx > AsmMethods for CodegenCx < ' gcc , ' tcx > {
660
- fn codegen_global_asm ( & self , template : & [ InlineAsmTemplatePiece ] , operands : & [ GlobalAsmOperandRef ] , options : InlineAsmOptions , _line_spans : & [ Span ] ) {
667
+ impl < ' gcc , ' tcx > AsmMethods < ' tcx > for CodegenCx < ' gcc , ' tcx > {
668
+ fn codegen_global_asm ( & self , template : & [ InlineAsmTemplatePiece ] , operands : & [ GlobalAsmOperandRef < ' tcx > ] , options : InlineAsmOptions , _line_spans : & [ Span ] ) {
661
669
let asm_arch = self . tcx . sess . asm_arch . unwrap ( ) ;
662
670
663
671
// Default to Intel syntax on x86
@@ -690,6 +698,22 @@ impl<'gcc, 'tcx> AsmMethods for CodegenCx<'gcc, 'tcx> {
690
698
// here unlike normal inline assembly.
691
699
template_str. push_str ( string) ;
692
700
}
701
+
702
+ GlobalAsmOperandRef :: SymFn { instance } => {
703
+ // TODO(@Amanieu): Additional mangling is needed on
704
+ // some targets to add a leading underscore (Mach-O)
705
+ // or byte count suffixes (x86 Windows).
706
+ let name = self . tcx . symbol_name ( instance) . name ;
707
+ template_str. push_str ( name) ;
708
+ }
709
+
710
+ GlobalAsmOperandRef :: SymStatic { def_id } => {
711
+ // TODO(@Amanieu): Additional mangling is needed on
712
+ // some targets to add a leading underscore (Mach-O).
713
+ let instance = Instance :: mono ( self . tcx , def_id) ;
714
+ let name = self . tcx . symbol_name ( instance) . name ;
715
+ template_str. push_str ( name) ;
716
+ }
693
717
}
694
718
}
695
719
}
0 commit comments