Home | History | Annotate | Download | only in COFF
      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
     25 LBB0_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:           _test_weak
     39 // CHECK-NEXT:   Value:          0
     40 // CHECK-NEXT:   Section:        IMAGE_SYM_UNDEFINED (0)
     41 // CHECK-NEXT:   BaseType:       Null
     42 // CHECK-NEXT:   ComplexType:    Null
     43 // CHECK-NEXT:   StorageClass:   WeakExternal
     44 // CHECK-NEXT:   AuxSymbolCount: 1
     45 // CHECK-NEXT:   AuxWeakExternal {
     46 // CHECK-NEXT:     Linked: .weak._test_weak.default
     47 // CHECK-NEXT:      Search: Library
     48 // CHECK-NEXT:   }
     49 // CHECK-NEXT: }
     50 
     51 // CHECK:      Symbol {
     52 // CHECK:        Name:                .weak._test_weak.default
     53 // CHECK-NEXT:   Value:               0
     54 // CHECK-NEXT:   Section:             IMAGE_SYM_ABSOLUTE (-1)
     55 // CHECK-NEXT:   BaseType:            Null
     56 // CHECK-NEXT:   ComplexType:         Null
     57 // CHECK-NEXT:   StorageClass:        External
     58 // CHECK-NEXT:   AuxSymbolCount:      0
     59 // CHECK-NEXT: }
     60 
     61 // CHECK:      Symbol {
     62 // CHECK:        Name:           _test_weak_alias
     63 // CHECK-NEXT:   Value:          0
     64 // CHECK-NEXT:   Section:        IMAGE_SYM_UNDEFINED (0)
     65 // CHECK-NEXT:   BaseType:       Null
     66 // CHECK-NEXT:   ComplexType:    Null
     67 // CHECK-NEXT:   StorageClass:   WeakExternal
     68 // CHECK-NEXT:   AuxSymbolCount: 1
     69 // CHECK-NEXT:   AuxWeakExternal {
     70 // CHECK-NEXT:     Linked: _main
     71 // CHECK-NEXT:      Search: Library
     72 // CHECK-NEXT:   }
     73 // CHECK-NEXT: }
     74