llvm/llvm/test/tools/llvm-readobj/XCOFF/symbols.test

## This file tests the ability of llvm-readobj to display the symbol table for a
## 32-bit XCOFF object file.

# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj --symbols %t | FileCheck --check-prefixes=SYMBOL32,NODEMANGLE %s
# RUN: llvm-readobj --symbols --no-demangle %t | FileCheck --check-prefixes=SYMBOL32,NODEMANGLE %s
# RUN: llvm-readobj --symbols --demangle %t | FileCheck --check-prefixes=SYMBOL32,DEMANGLE %s

--- !XCOFF
FileHeader:
  MagicNumber: 0x1DF
Sections:
  - Name: .text
Symbols:
## The C_FILE symbol with File auxiliary entries.
  - Name:               .file
    Value:              0x0
    Section:            N_DEBUG
    Type:               0x0
    StorageClass:       C_FILE
    NumberOfAuxEntries: 3
    AuxEntries:
      - Type:             AUX_FILE
        FileNameOrString: "test"
        FileStringType:   XFT_FN
      - Type:             AUX_FILE
        FileNameOrString: "foo"
        FileStringType:   XFT_CT
      - Type:             AUX_FILE
        FileNameOrString: "bar"
        FileStringType:   XFT_CV
## The C_STAT symbol with a SECT auxiliary entry.
  - Name:               .text
    Value:              0x0
    Section:            .text
    Type:               0x0
    StorageClass:       C_STAT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:             AUX_STAT
        SectionLength:    256
        NumberOfRelocEnt: 4
        NumberOfLineNum:  4
## The C_HIDEXT symbol with a CSECT auxiliary entry.
  - Name:               .fun
    Value:              0x0
    Section:            .text
    Type:               0x0
    StorageClass:       C_HIDEXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        ParameterHashIndex:     2
        TypeChkSectNum:         3
        SymbolAlignmentAndType: 7
        StorageMappingClass:    XMC_PR
        SectionOrLength:        256
        StabInfoIndex:          5
        StabSectNum:            6
## The C_EXT symbol with a CSECT auxiliary entry.
  - Name:               ._Z5func1i
    Value:              0x0
    Section:            .text
    Type:               0x20
    StorageClass:       C_EXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        ParameterHashIndex:     1
        TypeChkSectNum:         2
        SymbolAlignmentAndType: 3
        StorageMappingClass:    XMC_PR
        SectionOrLength:        256
        StabInfoIndex:          4
        StabSectNum:            5
## The C_WEAKEXT symbol with a CSECT auxiliary entry.
  - Name:               .fun2
    Value:              0x0
    Section:            .text
    Type:               0x20
    StorageClass:       C_WEAKEXT
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_CSECT
        ParameterHashIndex:     8
        TypeChkSectNum:         9
        SymbolAlignmentAndType: 1
        StorageMappingClass:    XMC_PR
        SectionOrLength:        256
        StabInfoIndex:          2
        StabSectNum:            3
## The C_WEAKEXT symbol with a Function auxiliary entry and a CSECT auxiliary entry.
  - Name:               .fun3
    Value:              0x0
    Section:            N_DEBUG
    Type:               0x20
    StorageClass:       C_WEAKEXT
    NumberOfAuxEntries: 2
    AuxEntries:
      - Type:                 AUX_FCN
        OffsetToExceptionTbl: 2
        SizeOfFunction:       3
        SymIdxOfNextBeyond:   4
        PtrToLineNum:         5
      - Type:                   AUX_CSECT
        ParameterHashIndex:     11
        TypeChkSectNum:         22
        SymbolAlignmentAndType: 33
        StorageMappingClass:    XMC_PR
        SectionOrLength:        256
        StabInfoIndex:          44
        StabSectNum:            55
## The C_DWARF symbol with a SECT auxiliary entry.
  - Name:               .fun4
    Section:            N_DEBUG
    StorageClass:       C_DWARF
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:                   AUX_SECT
        LengthOfSectionPortion: 2
        NumberOfRelocEnt:       3
## The C_BLOCK symbol with a Block auxiliary entry.
  - Name:               .fun5
    StorageClass:       C_BLOCK
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:      AUX_SYM
        LineNumHi: 2
        LineNumLo: 3
## The C_FCN symbol with a Block auxiliary entry.
  - Name:               .fun6
    StorageClass:       C_FCN
    NumberOfAuxEntries: 1
    AuxEntries:
      - Type:      AUX_SYM
        LineNumHi: 2
        LineNumLo: 3

##The C_WEAKEXT symbol with two Function auxiliary entries and a CSECT auxiliary entry.
  - Name:               .fun7
    Value:              0x0
    Section:            .text
    Type:               0x00
    StorageClass:       C_WEAKEXT
    NumberOfAuxEntries: 3
    AuxEntries:
      - Type:                 AUX_FCN
        OffsetToExceptionTbl: 2
        SizeOfFunction:       3
        SymIdxOfNextBeyond:   4
        PtrToLineNum:         5
      - Type:                 AUX_FCN
        OffsetToExceptionTbl: 8
        SizeOfFunction:       5
        SymIdxOfNextBeyond:   8
        PtrToLineNum:         5
      - Type:                   AUX_CSECT
        ParameterHashIndex:     11
        TypeChkSectNum:         22
        SymbolAlignmentAndType: 33
        StorageMappingClass:    XMC_PR
        SectionOrLength:        256
        StabInfoIndex:          44
        StabSectNum:            55

# SYMBOL32:      Symbols [
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 0
# SYMBOL32-NEXT:     Name: .file
# SYMBOL32-NEXT:     Value (SymbolTableIndex): 0x0
# SYMBOL32-NEXT:     Section: N_DEBUG
# SYMBOL32-NEXT:     Source Language ID: TB_C (0x0)
# SYMBOL32-NEXT:     CPU Version ID: 0x0
# SYMBOL32-NEXT:     StorageClass: C_FILE (0x67)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 3
# SYMBOL32-NEXT:     File Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 1
# SYMBOL32-NEXT:       Name: test
# SYMBOL32-NEXT:       Type: XFT_FN (0x0)
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:     File Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 2
# SYMBOL32-NEXT:       Name: foo
# SYMBOL32-NEXT:       Type: XFT_CT (0x1)
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:     File Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 3
# SYMBOL32-NEXT:       Name: bar
# SYMBOL32-NEXT:       Type: XFT_CV (0x2)
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 4
# SYMBOL32-NEXT:     Name: .text
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: .text
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_STAT (0x3)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     Sect Auxiliary Entry For Stat {
# SYMBOL32-NEXT:       Index: 5
# SYMBOL32-NEXT:       SectionLength: 256
# SYMBOL32-NEXT:       NumberOfRelocEnt: 4
# SYMBOL32-NEXT:       NumberOfLineNum: 4
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 6
# SYMBOL32-NEXT:     Name: .fun
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: .text
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_HIDEXT (0x6B)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     CSECT Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 7
# SYMBOL32-NEXT:       SectionLen: 256
# SYMBOL32-NEXT:       ParameterHashIndex: 0x2
# SYMBOL32-NEXT:       TypeChkSectNum: 0x3
# SYMBOL32-NEXT:       SymbolAlignmentLog2: 0
# SYMBOL32-NEXT:       SymbolType: 0x7
# SYMBOL32-NEXT:       StorageMappingClass: XMC_PR (0x0)
# SYMBOL32-NEXT:       StabInfoIndex: 0x5
# SYMBOL32-NEXT:       StabSectNum: 0x6
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 8
# NODEMANGLE-NEXT:   Name: ._Z5func1i
# DEMANGLE-NEXT:     Name: .func1(int)
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: .text
# SYMBOL32-NEXT:     Type: 0x20
# SYMBOL32-NEXT:     StorageClass: C_EXT (0x2)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     CSECT Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 9
# SYMBOL32-NEXT:       SectionLen: 256
# SYMBOL32-NEXT:       ParameterHashIndex: 0x1
# SYMBOL32-NEXT:       TypeChkSectNum: 0x2
# SYMBOL32-NEXT:       SymbolAlignmentLog2: 0
# SYMBOL32-NEXT:       SymbolType: XTY_CM (0x3)
# SYMBOL32-NEXT:       StorageMappingClass: XMC_PR (0x0)
# SYMBOL32-NEXT:       StabInfoIndex: 0x4
# SYMBOL32-NEXT:       StabSectNum: 0x5
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 10
# SYMBOL32-NEXT:     Name: .fun2
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: .text
# SYMBOL32-NEXT:     Type: 0x20
# SYMBOL32-NEXT:     StorageClass: C_WEAKEXT (0x6F)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     CSECT Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 11
# SYMBOL32-NEXT:       SectionLen: 256
# SYMBOL32-NEXT:       ParameterHashIndex: 0x8
# SYMBOL32-NEXT:       TypeChkSectNum: 0x9
# SYMBOL32-NEXT:       SymbolAlignmentLog2: 0
# SYMBOL32-NEXT:       SymbolType: XTY_SD (0x1)
# SYMBOL32-NEXT:       StorageMappingClass: XMC_PR (0x0)
# SYMBOL32-NEXT:       StabInfoIndex: 0x2
# SYMBOL32-NEXT:       StabSectNum: 0x3
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 12
# SYMBOL32-NEXT:     Name: .fun3
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: N_DEBUG
# SYMBOL32-NEXT:     Type: 0x20
# SYMBOL32-NEXT:     StorageClass: C_WEAKEXT (0x6F)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 2
# SYMBOL32-NEXT:     Function Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 13
# SYMBOL32-NEXT:       OffsetToExceptionTable: 0x2
# SYMBOL32-NEXT:       SizeOfFunction: 0x3
# SYMBOL32-NEXT:       PointerToLineNum: 0x5
# SYMBOL32-NEXT:       SymbolIndexOfNextBeyond: 4
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:     CSECT Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 14
# SYMBOL32-NEXT:       SectionLen: 256
# SYMBOL32-NEXT:       ParameterHashIndex: 0xB
# SYMBOL32-NEXT:       TypeChkSectNum: 0x16
# SYMBOL32-NEXT:       SymbolAlignmentLog2: 4
# SYMBOL32-NEXT:       SymbolType: XTY_SD (0x1)
# SYMBOL32-NEXT:       StorageMappingClass: XMC_PR (0x0)
# SYMBOL32-NEXT:       StabInfoIndex: 0x2C
# SYMBOL32-NEXT:       StabSectNum: 0x37
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 15
# SYMBOL32-NEXT:     Name: .fun4
# SYMBOL32-NEXT:     Value (OffsetInDWARF): 0x0
# SYMBOL32-NEXT:     Section: N_DEBUG
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_DWARF (0x70)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     Sect Auxiliary Entry For DWARF {
# SYMBOL32-NEXT:       Index: 16
# SYMBOL32-NEXT:       LengthOfSectionPortion: 0x2
# SYMBOL32-NEXT:       NumberOfRelocEntries: 3
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 17
# SYMBOL32-NEXT:     Name: .fun5
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: N_UNDEF
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_BLOCK (0x64)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     Block Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 18
# SYMBOL32-NEXT:       LineNumber (High 2 Bytes): 0x2
# SYMBOL32-NEXT:       LineNumber (Low 2 Bytes): 0x3
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 19
# SYMBOL32-NEXT:     Name: .fun6
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: N_UNDEF
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_FCN (0x65)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 1
# SYMBOL32-NEXT:     Block Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 20
# SYMBOL32-NEXT:       LineNumber (High 2 Bytes): 0x2
# SYMBOL32-NEXT:       LineNumber (Low 2 Bytes): 0x3
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT:   Symbol {
# SYMBOL32-NEXT:     Index: 21
# SYMBOL32-NEXT:     Name: .fun7
# SYMBOL32-NEXT:     Value (RelocatableAddress): 0x0
# SYMBOL32-NEXT:     Section: .text
# SYMBOL32-NEXT:     Type: 0x0
# SYMBOL32-NEXT:     StorageClass: C_WEAKEXT (0x6F)
# SYMBOL32-NEXT:     NumberOfAuxEntries: 3
# SYMBOL32-NEXT:     Function Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 22
# SYMBOL32-NEXT:       OffsetToExceptionTable: 0x2
# SYMBOL32-NEXT:       SizeOfFunction: 0x3
# SYMBOL32-NEXT:       PointerToLineNum: 0x5
# SYMBOL32-NEXT:       SymbolIndexOfNextBeyond: 4
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:     Function Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 23
# SYMBOL32-NEXT:       OffsetToExceptionTable: 0x8
# SYMBOL32-NEXT:       SizeOfFunction: 0x5
# SYMBOL32-NEXT:       PointerToLineNum: 0x5
# SYMBOL32-NEXT:       SymbolIndexOfNextBeyond: 8
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:     CSECT Auxiliary Entry {
# SYMBOL32-NEXT:       Index: 24
# SYMBOL32-NEXT:       SectionLen: 256
# SYMBOL32-NEXT:       ParameterHashIndex: 0xB
# SYMBOL32-NEXT:       TypeChkSectNum: 0x16
# SYMBOL32-NEXT:       SymbolAlignmentLog2: 4
# SYMBOL32-NEXT:       SymbolType: XTY_SD (0x1)
# SYMBOL32-NEXT:       StorageMappingClass: XMC_PR (0x0)
# SYMBOL32-NEXT:       StabInfoIndex: 0x2C
# SYMBOL32-NEXT:       StabSectNum: 0x37
# SYMBOL32-NEXT:     }
# SYMBOL32-NEXT:   }
# SYMBOL32-NEXT: ]