xref: /llvm-project/llvm/test/tools/llvm-readobj/XCOFF/loader-section-relocation.test (revision 3034632a2708f3b79aa30f895dc42f35569c3647)
1## Test the --loader-section-relocations option.
2
3# RUN: yaml2obj --docnum=1 %s -o %t_xcoff32.o
4# RUN: yaml2obj --docnum=2  %s -o %t_xcoff64.o
5# RUN: llvm-readobj --loader-section-relocations --expand-relocs %t_xcoff32.o | FileCheck --check-prefixes=COMMON,EXPAND,NODEMANEXP %s
6# RUN: llvm-readobj --loader-section-relocations --expand-relocs %t_xcoff64.o | FileCheck --check-prefixes=COMMON,EXPAND,NODEMANEXP %s
7# RUN: llvm-readobj --loader-section-relocations %t_xcoff32.o | FileCheck --check-prefixes=COMMON,NOEXPAND32,NODEMAN32 %s
8# RUN: llvm-readobj --loader-section-relocations %t_xcoff64.o | FileCheck --check-prefixes=COMMON,NOEXPAND64,NODEMAN64 %s
9
10# RUN: llvm-readobj --loader-section-relocations --expand-relocs --no-demangle %t_xcoff32.o | FileCheck --check-prefixes=COMMON,EXPAND,NODEMANEXP %s
11# RUN: llvm-readobj --loader-section-relocations --expand-relocs --no-demangle %t_xcoff64.o | FileCheck --check-prefixes=COMMON,EXPAND,NODEMANEXP %s
12# RUN: llvm-readobj --loader-section-relocations --no-demangle %t_xcoff32.o | FileCheck --check-prefixes=COMMON,NOEXPAND32,NODEMAN32 %s
13# RUN: llvm-readobj --loader-section-relocations --no-demangle %t_xcoff64.o | FileCheck --check-prefixes=COMMON,NOEXPAND64,NODEMAN64 %s
14
15# RUN: llvm-readobj --loader-section-relocations --expand-relocs --demangle %t_xcoff32.o | FileCheck --check-prefixes=COMMON,EXPAND,DEMANEXP %s
16# RUN: llvm-readobj --loader-section-relocations --expand-relocs --demangle %t_xcoff64.o | FileCheck --check-prefixes=COMMON,EXPAND,DEMANEXP %s
17# RUN: llvm-readobj --loader-section-relocations --demangle %t_xcoff32.o | FileCheck --check-prefixes=COMMON,NOEXPAND32,DEMAN32 %s
18# RUN: llvm-readobj --loader-section-relocations --demangle %t_xcoff64.o | FileCheck --check-prefixes=COMMON,NOEXPAND64,DEMAN64 %s
19--- !XCOFF
20FileHeader:
21  MagicNumber:       0x1DF
22Sections:
23  - Name:            .loader
24    Flags:           [ STYP_LOADER ]
25    SectionData:     "0000000100000001000000020000016D00000001000000A400000000000000505f5a3466756e63762000028000021105000000000000000020000294000000011f0000022000029c000000031f000002"
26##                    ^-------                                                           -Version=1
27##                            ^-------                                                   -NumberOfSymbolEntries=1
28##                                    ^-------                                           -NumberOfRelocationEntries=2
29##                                            ^-------                                   -LengthOfImportFileIDStringTable=365
30##                                                    ^-------                           -NumberOfImportFileIDs=1
31##                                                            ^-------                   -OffsetToImportFileIDs=0xA4
32##                                                                    ^-------           -LengthOfStringTable=0
33##                                                                            ^-------   -OffsetToStringTable=0
34##                                                                                    ^---------------         SymbolName=_Z4funcv
35##                                                                                                    ^------- Value=0x20000280
36##                                                                                                            ^---  sectionNumber = 2
37##                                                                                                                ^- SymbolType=0x11
38##                                                                                                                  ^- StorageClass=0x05
39##                                                                                                                    ^-------   ImportFileID=0
40##                                                                                                                            ^-------ParameterCheckType=0
41##                                                                                                                                    ^-------    Virtual Address = 0x20000294
42##                                                                                                                                            ^------- SymbolIndex = 1
43##                                                                                                                                                    ^--- Type =0x1f00
44##                                                                                                                                                        ^--- Section Num =2
45##                                                                                                                                                            ^-------    Virtual Address = 0x20000294
46##                                                                                                                                                                    ^------- SymbolIndex = 3
47##                                                                                                                                                                            ^--- Type =0x1f00
48##                                                                                                                                                                                ^--- Section Num =2
49
50--- !XCOFF
51FileHeader:
52  MagicNumber:       0x1F7
53Sections:
54  - Name:            .loader
55    Flags:           [ STYP_LOADER ]
56    SectionData:     "0000000200000001000000020000016D000000010000001200000000000000D000000000000000700000000000000038000000000000005000000001100003000000000200021105000000000000000000000000200002941f00000200000001000000002000029C1f0000020000000300095f5a3466756e63760000"
57##                    ^-------                                                           -Version=2
58##                            ^-------                                                   -NumberOfSymbolEntries=1
59##                                    ^-------                                           -NumberOfRelocationEntries=2
60##                                            ^-------                                   -LengthOfImportFileIDStringTable=365
61##                                                    ^-------                           -NumberOfImportFileIDs=1
62##                                                            ^-------                   --LengthOfStringTable=0x12
63##                                                                    ^---------------   -OffsetToImportFileIDs=0xD0
64##                                                                                    ^---------------   -OffsetToStringTable=0x70
65##                                                                                                    ^---------------  -OffsetToSymbolTable=0x38
66##                                                                                                                    ^---------------   -OffsetToRelocationEntries=0x50
67##                                                                                                                                    ^---------------         Value=0x0000000110000300
68##                                                                                                                                                    ^------- OffsetToStringTbl=2
69##                                                                                                                                                            ^---  sectionNumber = 2
70##                                                                                                                                                                ^- SymbolType=0x11
71##                                                                                                                                                                  ^- StorageClass=0x05
72##                                                                                                                                                                    ^-------   ImportFileID=0
73##                                                                                                                                                                            ^-------ParameterCheckType=0
74##                                                                                                                                                                                    ^--------------- VirtualAddress= 0x20000294
75##                                                                                                                                                                                                    ^--- Type= 1f00
76##                                                                                                                                                                                                        ^---SectionNumber = 2
77##                                                                                                                                                                                                            ^------- SymbolIndex =1
78##                                                                                                                                                                                                                    ^--------------- VirtualAddress= 0x2000029C
79##                                                                                                                                                                                                                                    ^--- Type= 1f00
80##                                                                                                                                                                                                                                        ^---SectionNumber = 2
81##                                                                                                                                                                                                                                            ^------- SymbolIndex =3
82##                                                                                                                                                                                                                                                    ^-------------------StringTable
83
84# COMMON:      Loader Section {
85# COMMON-NEXT:     Loader Section Relocations {
86# NOEXPAND64-NEXT:           Vaddr            Type        SecNum  SymbolName (Index)
87# NOEXPAND64-NEXT:     0x0000000020000294 0x1f00 (R_POS)       2    .data (1)
88# NODEMAN64-NEXT:      0x000000002000029c 0x1f00 (R_POS)       2    _Z4funcv (3)
89# DEMAN64-NEXT:        0x000000002000029c 0x1f00 (R_POS)       2    func() (3)
90# NOEXPAND32-NEXT:        Vaddr        Type        SecNum  SymbolName (Index)
91# NOEXPAND32-NEXT:      0x20000294 0x1f00 (R_POS)       2    .data (1)
92# NODEMAN32-NEXT:       0x2000029c 0x1f00 (R_POS)       2    _Z4funcv (3)
93# DEMAN32-NEXT:         0x2000029c 0x1f00 (R_POS)       2    func() (3)
94# EXPAND-NEXT:       Relocation {
95# EXPAND-NEXT:         Virtual Address: 0x20000294
96# EXPAND-NEXT:         Symbol: .data (1)
97# EXPAND-NEXT:         IsSigned: No
98# EXPAND-NEXT:         FixupBitValue: 0
99# EXPAND-NEXT:         Length: 32
100# EXPAND-NEXT:         Type: R_POS (0x0)
101# EXPAND-NEXT:         SectionNumber: 2
102# EXPAND-NEXT:       }
103# EXPAND-NEXT:       Relocation {
104# EXPAND-NEXT:         Virtual Address: 0x2000029C
105# NODEMANEXP-NEXT:     Symbol: _Z4funcv (3)
106# DEMANEXP-NEXT:       Symbol: func() (3)
107# EXPAND-NEXT:         IsSigned: No
108# EXPAND-NEXT:         FixupBitValue: 0
109# EXPAND-NEXT:         Length: 32
110# EXPAND-NEXT:         Type: R_POS (0x0)
111# EXPAND-NEXT:         SectionNumber: 2
112# EXPAND-NEXT:       }
113# EXPAND-NEXT:     }
114# EXPAND-NEXT: }
115