xref: /llvm-project/llvm/test/tools/llvm-readobj/XCOFF/relocations.test (revision 3034632a2708f3b79aa30f895dc42f35569c3647)
1## Test how relocations are dumped.
2
3# RUN: yaml2obj %s -o %t
4# RUN: llvm-readobj --relocs --expand-relocs %t | \
5# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCSEXP,NODEMANEXP
6# RUN: llvm-readobj --relocs %t | \
7# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCS,NODEMAN
8
9# RUN: llvm-readobj --relocs --expand-relocs --no-demangle %t | \
10# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCSEXP,NODEMANEXP
11# RUN: llvm-readobj --relocs --no-demangle %t | \
12# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCS,NODEMAN
13
14# RUN: llvm-readobj --relocs --expand-relocs --demangle %t | \
15# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCSEXP,DEMANEXP
16# RUN: llvm-readobj --relocs --demangle %t | \
17# RUN:   FileCheck %s --strict-whitespace --check-prefixes=RELOCS,DEMAN
18
19#      RELOCSEXP:Relocations [
20# RELOCSEXP-NEXT:  Section (index: 1) .text {
21# RELOCSEXP-NEXT:    Relocation {
22# RELOCSEXP-NEXT:      Virtual Address: 0x80
23# RELOCSEXP-NEXT:      Symbol: foo (0)
24# RELOCSEXP-NEXT:      IsSigned: No
25# RELOCSEXP-NEXT:      FixupBitValue: 0
26# RELOCSEXP-NEXT:      Length: 22
27# RELOCSEXP-NEXT:      Type: R_POS (0x0)
28# RELOCSEXP-NEXT:    }
29# RELOCSEXP-NEXT:    Relocation {
30# RELOCSEXP-NEXT:      Virtual Address: 0x100
31# RELOCSEXP-NEXT:      Symbol: foo (0)
32# RELOCSEXP-NEXT:      IsSigned: No
33# RELOCSEXP-NEXT:      FixupBitValue: 0
34# RELOCSEXP-NEXT:      Length: 21
35# RELOCSEXP-NEXT:      Type: R_REL (0x2)
36# RELOCSEXP-NEXT:    }
37# RELOCSEXP-NEXT:  }
38# RELOCSEXP-NEXT:  Section (index: 2) .data {
39# RELOCSEXP-NEXT:    Relocation {
40# RELOCSEXP-NEXT:      Virtual Address: 0x200
41# NODEMANEXP-NEXT:     Symbol: _Z3fwpv (1)
42# DEMANEXP-NEXT:       Symbol: fwp() (1)
43# RELOCSEXP-NEXT:      IsSigned: No
44# RELOCSEXP-NEXT:      FixupBitValue: 0
45# RELOCSEXP-NEXT:      Length: 20
46# RELOCSEXP-NEXT:      Type: R_TOC (0x3)
47# RELOCSEXP-NEXT:    }
48# RELOCSEXP-NEXT:  }
49# RELOCSEXP-NEXT:]
50
51#      RELOCS:Relocations [
52# RELOCS-NEXT:  Section (index: 1) .text {
53# RELOCS-NEXT:    0x80 R_POS foo(0) 0x15
54# RELOCS-NEXT:    0x100 R_REL foo(0) 0x14
55# RELOCS-NEXT:  }
56# RELOCS-NEXT:  Section (index: 2) .data {
57# NODEMAN-NEXT:  0x200 R_TOC _Z3fwpv(1) 0x13
58# DEMAN-NEXT:    0x200 R_TOC fwp()(1) 0x13
59# RELOCS-NEXT:  }
60# RELOCS-NEXT:]
61
62--- !XCOFF
63FileHeader:
64  MagicNumber: 0x01DF
65Sections:
66  - Name:  .text
67    Flags: [ STYP_TEXT ]
68    Relocations:
69      - Address: 0x80
70        Symbol:  0x0
71        Info:    0x15
72        Type:    0x0
73      - Address: 0x100
74        Symbol:  0x0
75        Info:    0x14
76        Type:    0x2
77  - Name:  .data
78    Flags: [ STYP_DATA ]
79    Relocations:
80      - Address: 0x200
81        Symbol:  0x1
82        Info:    0x13
83        Type:    0x3
84Symbols:
85  - Name:    foo
86    Value:   0x0
87    Section: .text
88  - Name:    _Z3fwpv
89    Value:   0x80
90    Section: .data
91