MC asm parser: allow ?'s in symbol names, and handle @'s in names in MS asm
[oota-llvm.git] / test / MC / COFF / tricky-names.ll
1 ; Check how tricky symbols are printed in the asm output.
2 ; RUN: llc -mtriple=i686-pc-win32 %s -o - | FileCheck %s --check-prefix=ASM
3
4 ; Check that we can roundtrip these names through our assembler.
5 ; RUN: llc -mtriple=i686-pc-win32 %s -o - | llvm-mc -triple i686-pc-win32 -filetype=obj | llvm-readobj -t | FileCheck %s --check-prefix=READOBJ
6
7
8 @"\01??__E_Generic_object@?$_Error_objects@H@std@@YAXXZ" = global i32 0
9 @"\01__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4" = global i32 0
10 @"\01@foo.bar" = global i32 0
11
12 define weak i32 @"\01??_B?$num_put@_WV?$back_insert_iterator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@std@@@std@@51"() section ".text" {
13   %a = load i32* @"\01??__E_Generic_object@?$_Error_objects@H@std@@YAXXZ"
14   %b = load i32* @"\01__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4"
15   %c = load i32* @"\01@foo.bar"
16   %x = add i32 %a, %b
17   %y = add i32 %x, %c
18   ret i32 %y
19 }
20
21 ; Check that these symbols are not quoted. They occur in output that gets passed to GAS.
22 ; ASM: .globl __ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4
23 ; ASM-NOT: .globl "__ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4"
24 ; ASM: .globl @foo.bar
25 ; ASM-NOT: .globl "@foo.bar"
26
27 ; READOBJ: Symbol
28 ; READOBJ: Name: .text$??_B?$num_put@_WV?$back_insert_iterator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@std@@@std@@51
29 ; READOBJ: Section: .text$??_B?$num_put@_WV?$back_insert_iterator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@std@@@std@@51
30 ; READOBJ: Symbol
31 ; READOBJ: Name: ??_B?$num_put@_WV?$back_insert_iterator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@std@@@std@@51
32 ; READOBJ: Section: .text$??_B?$num_put@_WV?$back_insert_iterator@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@std@@@std@@51
33 ; READOBJ: Symbol
34 ; READOBJ: Name: ??__E_Generic_object@?$_Error_objects@H@std@@YAXXZ
35 ; READOBJ: Symbol
36 ; READOBJ: Name: __ZL16ExceptionHandlerP19_EXCEPTION_POINTERS@4
37 ; READOBJ: Symbol
38 ; READOBJ: Name: @foo.bar