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 --match-full-lines --check-prefix=RELOCSEXP
6# RUN: llvm-readobj --relocs %t | \
7# RUN:   FileCheck %s --strict-whitespace --match-full-lines --check-prefix=RELOCS
8
9#      RELOCSEXP:Relocations [
10# RELOCSEXP-NEXT:  Section (index: 1) .text {
11# RELOCSEXP-NEXT:    Relocation {
12# RELOCSEXP-NEXT:      Virtual Address: 0x80
13# RELOCSEXP-NEXT:      Symbol: foo (0)
14# RELOCSEXP-NEXT:      IsSigned: No
15# RELOCSEXP-NEXT:      FixupBitValue: 0
16# RELOCSEXP-NEXT:      Length: 22
17# RELOCSEXP-NEXT:      Type: R_POS (0x0)
18# RELOCSEXP-NEXT:    }
19# RELOCSEXP-NEXT:    Relocation {
20# RELOCSEXP-NEXT:      Virtual Address: 0x100
21# RELOCSEXP-NEXT:      Symbol: foo (0)
22# RELOCSEXP-NEXT:      IsSigned: No
23# RELOCSEXP-NEXT:      FixupBitValue: 0
24# RELOCSEXP-NEXT:      Length: 21
25# RELOCSEXP-NEXT:      Type: R_REL (0x2)
26# RELOCSEXP-NEXT:    }
27# RELOCSEXP-NEXT:  }
28# RELOCSEXP-NEXT:  Section (index: 2) .data {
29# RELOCSEXP-NEXT:    Relocation {
30# RELOCSEXP-NEXT:      Virtual Address: 0x200
31# RELOCSEXP-NEXT:      Symbol: bar (1)
32# RELOCSEXP-NEXT:      IsSigned: No
33# RELOCSEXP-NEXT:      FixupBitValue: 0
34# RELOCSEXP-NEXT:      Length: 20
35# RELOCSEXP-NEXT:      Type: R_TOC (0x3)
36# RELOCSEXP-NEXT:    }
37# RELOCSEXP-NEXT:  }
38# RELOCSEXP-NEXT:]
39
40#      RELOCS:Relocations [
41# RELOCS-NEXT:  Section (index: 1) .text {
42# RELOCS-NEXT:    0x80 R_POS foo(0) 0x15
43# RELOCS-NEXT:    0x100 R_REL foo(0) 0x14
44# RELOCS-NEXT:  }
45# RELOCS-NEXT:  Section (index: 2) .data {
46# RELOCS-NEXT:    0x200 R_TOC bar(1) 0x13
47# RELOCS-NEXT:  }
48# RELOCS-NEXT:]
49
50--- !XCOFF
51FileHeader:
52  MagicNumber: 0x01DF
53Sections:
54  - Name:  .text
55    Flags: [ STYP_TEXT ]
56    Relocations:
57      - Address: 0x80
58        Symbol:  0x0
59        Info:    0x15
60        Type:    0x0
61      - Address: 0x100
62        Symbol:  0x0
63        Info:    0x14
64        Type:    0x2
65  - Name:  .data
66    Flags: [ STYP_DATA ]
67    Relocations:
68      - Address: 0x200
69        Symbol:  0x1
70        Info:    0x13
71        Type:    0x3
72Symbols:
73  - Name:    foo
74    Value:   0x0
75    Section: .text
76  - Name:    bar
77    Value:   0x80
78    Section: .data
79