xref: /llvm-project/llvm/test/tools/llvm-readobj/XCOFF/symbols-invalid.test (revision f31099ce581d33fdb64e35fee4b56d0a1145cab1)
1## Test that we report warnings or dump raw data when symbols are invalid.
2
3--- !XCOFF
4FileHeader:
5  MagicNumber: 0x1DF
6Symbols:
7  - Name: .sym
8  - Name:               .fun
9    StorageClass:       [[STORAGECLASS='C_EXT']]
10    NumberOfAuxEntries: 2
11
12# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_STAT' -o %t1
13# RUN: llvm-readobj --syms %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=CASE1
14
15# CASE1: warning: '[[FILE]]': the C_STAT symbol at index 1 should not have more than 1 auxiliary entry
16
17# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_DWARF' -o %t2
18# RUN: llvm-readobj --syms %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=CASE2
19
20# CASE2: warning: '[[FILE]]': the C_DWARF symbol at index 1 should not have more than 1 auxiliary entry
21
22# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_BLOCK' -o %t3
23# RUN: llvm-readobj --syms %t3 2>&1 | FileCheck %s -DFILE=%t3 --check-prefix=CASE3
24
25# CASE3: warning: '[[FILE]]': the C_BLOCK symbol at index 1 should not have more than 1 auxiliary entry
26
27# RUN: yaml2obj %s --docnum=1 -DSTORAGECLASS='C_FCN' -o %t4
28# RUN: llvm-readobj --syms %t4 2>&1 | FileCheck %s -DFILE=%t4 --check-prefix=CASE4
29
30# CASE4: warning: '[[FILE]]': the C_FCN symbol at index 1 should not have more than 1 auxiliary entry
31
32## This case tests the raw data output ability when a file auxiliary entry does
33## not have the matching auxiliary type.
34# RUN: yaml2obj %s --docnum=2 -o %t5
35# RUN: llvm-readobj --syms %t5 | FileCheck %s --strict-whitespace --match-full-lines --check-prefix=CASE5
36
37#      CASE5:Symbols [
38# CASE5-NEXT:  Symbol {
39# CASE5-NEXT:    Index: 0
40# CASE5-NEXT:    Name: .fun
41# CASE5-NEXT:    Value (SymbolTableIndex): 0x0
42# CASE5-NEXT:    Section: N_UNDEF
43# CASE5-NEXT:    Source Language ID: TB_C (0x0)
44# CASE5-NEXT:    CPU Version ID: TCPU_INVALID (0x0)
45# CASE5-NEXT:    StorageClass: C_FILE (0x67)
46# CASE5-NEXT:    NumberOfAuxEntries: 1
47# CASE5-NEXT:    !Unexpected raw auxiliary entry data:
48# CASE5-NEXT:    00000000 00000001 00020300 00000000 00fb
49# CASE5-NEXT:  }
50# CASE5-NEXT:]
51
52--- !XCOFF
53FileHeader:
54  MagicNumber: 0x1F7
55Symbols:
56  - Name:         .fun
57    StorageClass: C_FILE
58    AuxEntries:
59      - Type:                   AUX_CSECT
60        ParameterHashIndex:     1
61        TypeChkSectNum:         2
62        SymbolAlignmentAndType: 3
63        StorageMappingClass:    XMC_PR
64