# RUN: yaml2obj < %s | llvm-nm - | FileCheck -strict-whitespace %s

# Check that wasm weak function/global/data symbols are displayed correctly

--- !WASM
FileHeader:
  Version:         0x00000001
Sections:
  - Type:            TYPE
    Signatures:
      - Index:           0
        ParamTypes:
          - I32
        ReturnTypes:
          - I32
  - Type:            IMPORT
    Imports:
      - Module:          env
        Field:           weak_import_func
        Kind:            FUNCTION
        SigIndex:        0
  - Type:            FUNCTION
    FunctionTypes: [ 0 ]
  - Type:            GLOBAL
    Globals:
      - Index:       0
        Type:        I32
        Mutable:     false
        InitExpr:
          Opcode:          I64_CONST
          Value:           32
  - Type:            CODE
    Functions:
      - Index:           1
        Locals:
        Body:            00
  - Type:            DATA
    Segments:
      - SectionOffset:   6
        InitFlags:       0
        Offset:
          Opcode:          I32_CONST
          Value:           0
        Content:         '616263'
  - Type:            CUSTOM
    Name:            linking
    Version:         2
    SymbolTable:
       - Index:           0
         Kind:            DATA
         Name:            weak_defined_data
         Flags:           [ BINDING_WEAK ]
         Segment:         0
         Size:            3
       - Index:           1
         Kind:            FUNCTION
         Name:            weak_defined_func
         Flags:           [ BINDING_WEAK ]
         Function:        1
       - Index:           2
         Kind:            GLOBAL
         Name:            weak_defined_global
         Flags:           [ BINDING_WEAK ]
         Global:          0
       - Index:           3
         Kind:            DATA
         Name:            weak_import_data
         Flags:           [ BINDING_WEAK, UNDEFINED ]
       - Index:           4
         Kind:            FUNCTION
         Name:            weak_import_func
         Flags:           [ BINDING_WEAK, UNDEFINED ]
         Function:        0
    SegmentInfo:
      - Index:           0
        Name:            .rodata.constantData
        Alignment:       1
        Flags:           [  ]


# CHECK:      00000000 W weak_defined_data
# CHECK-NEXT: 00000001 W weak_defined_func
# CHECK-NEXT: 00000001 W weak_defined_global
# CHECK-NEXT:          w weak_import_data
# CHECK-NEXT:          w weak_import_func
