1// This tests that default-null weak symbols (a GNU extension) are created 2// properly via the .weak directive. 3 4// RUN: llvm-mc -filetype=obj -triple i686-pc-win32 %s | llvm-readobj -t | FileCheck %s 5// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -t | FileCheck %s 6 7 .def _main; 8 .scl 2; 9 .type 32; 10 .endef 11 .text 12 .globl _main 13 .align 16, 0x90 14_main: # @main 15# BB#0: # %entry 16 subl $4, %esp 17 movl $_test_weak, %eax 18 testl %eax, %eax 19 je LBB0_2 20# BB#1: # %if.then 21 call _test_weak 22 movl $1, %eax 23 addl $4, %esp 24 ret 25LBB0_2: # %return 26 xorl %eax, %eax 27 addl $4, %esp 28 ret 29 30 .weak _test_weak 31 32 .weak _test_weak_alias 33 _test_weak_alias=_main 34 35// CHECK: Symbols [ 36 37// CHECK: Symbol { 38// CHECK: Name: _main 39// CHECK-NEXT: Value: 0 40// CHECK-NEXT: Section: .text 41// CHECK-NEXT: BaseType: Null 42// CHECK-NEXT: ComplexType: Function 43// CHECK-NEXT: StorageClass: External 44// CHECK-NEXT: AuxSymbolCount: 0 45// CHECK-NEXT: } 46 47// CHECK: Symbol { 48// CHECK: Name: _test_weak 49// CHECK-NEXT: Value: 0 50// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0) 51// CHECK-NEXT: BaseType: Null 52// CHECK-NEXT: ComplexType: Null 53// CHECK-NEXT: StorageClass: WeakExternal 54// CHECK-NEXT: AuxSymbolCount: 1 55// CHECK-NEXT: AuxWeakExternal { 56// CHECK-NEXT: Linked: .weak._test_weak.default 57// CHECK-NEXT: Search: Library 58// CHECK-NEXT: } 59// CHECK-NEXT: } 60 61// CHECK: Symbol { 62// CHECK: Name: .weak._test_weak.default 63// CHECK-NEXT: Value: 0 64// CHECK-NEXT: Section: IMAGE_SYM_ABSOLUTE (-1) 65// CHECK-NEXT: BaseType: Null 66// CHECK-NEXT: ComplexType: Null 67// CHECK-NEXT: StorageClass: External 68// CHECK-NEXT: AuxSymbolCount: 0 69// CHECK-NEXT: } 70 71// CHECK: Symbol { 72// CHECK: Name: _test_weak_alias 73// CHECK-NEXT: Value: 0 74// CHECK-NEXT: Section: IMAGE_SYM_UNDEFINED (0) 75// CHECK-NEXT: BaseType: Null 76// CHECK-NEXT: ComplexType: Null 77// CHECK-NEXT: StorageClass: WeakExternal 78// CHECK-NEXT: AuxSymbolCount: 1 79// CHECK-NEXT: AuxWeakExternal { 80// CHECK-NEXT: Linked: .weak._test_weak_alias.default 81// CHECK-NEXT: Search: Library 82// CHECK-NEXT: } 83// CHECK-NEXT: } 84 85// CHECK: Symbol { 86// CHECK: Name: .weak._test_weak_alias.default 87// CHECK-NEXT: Value: 0 88// CHECK-NEXT: Section: .text 89// CHECK-NEXT: BaseType: Null 90// CHECK-NEXT: ComplexType: Null 91// CHECK-NEXT: StorageClass: External 92// CHECK-NEXT: AuxSymbolCount: 0 93// CHECK-NEXT: } 94