• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy %t %t2
3# RUN: llvm-readobj --relocations %t2 | FileCheck %s
4
5!ELF
6FileHeader:
7  Class:           ELFCLASS64
8  Data:            ELFDATA2LSB
9  Type:            ET_EXEC
10  Machine:         EM_X86_64
11Sections:
12  - Name:            .text
13    Type:            SHT_PROGBITS
14    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
15    Address:         0x1000
16    AddressAlign:    0x0000000000000010
17    Content:         "0000000000000000"
18  - Name:            .rel.text
19    Type:            SHT_REL
20    Link:            .symtab
21    Info:            .text
22    Relocations:
23      - Offset: 0x1000
24        Symbol: foo
25        Type:   R_X86_64_PC32
26  - Name:            .data
27    Type:            SHT_PROGBITS
28    Flags:           [ SHF_ALLOC ]
29    Address:         0x2000
30    AddressAlign:    0x0000000000000010
31    Content:         "0000000000000000"
32  - Name:            .rel.data
33    Type:            SHT_REL
34    Link:            .symtab
35    Info:            .data
36    Relocations:
37      - Offset: 0x2000
38        Symbol: bar
39        Type:   R_X86_64_PC32
40  - Name:            .rela.data
41    Type:            SHT_RELA
42    Link:            .symtab
43    Info:            .data
44    Relocations:
45      - Offset: 0x2000
46        Symbol: barA
47        Type:   R_X86_64_PC32
48        Addend: 0x17
49  - Name:            .rela.text
50    Type:            SHT_RELA
51    Link:            .symtab
52    Info:            .text
53    Relocations:
54      - Offset: 0x1000
55        Symbol: fooA
56        Type:   R_X86_64_PC32
57        Addend: 0x13
58Symbols:
59  - Name:     _start
60    Type:     STT_FUNC
61    Section:  .text
62    Value:    0x1000
63    Size:     4
64    Binding:  STB_GLOBAL
65  - Name:     foo
66    Type:     STT_FUNC
67    Size:     4
68    Binding:  STB_GLOBAL
69  - Name:     fooA
70    Type:     STT_FUNC
71    Size:     4
72    Binding:  STB_GLOBAL
73  - Name:     bar
74    Type:     STT_OBJECT
75    Size:     4
76    Binding:  STB_GLOBAL
77  - Name:     barA
78    Type:     STT_OBJECT
79    Size:     4
80    Binding:  STB_GLOBAL
81
82# CHECK:     Relocations [
83# CHECK-NEXT:  Section (2) .rel.text {
84# CHECK-NEXT:    0x1000 R_X86_64_PC32 foo 0x0
85# CHECK-NEXT:  }
86# CHECK-NEXT:  Section (4) .rel.data {
87# CHECK-NEXT:    0x2000 R_X86_64_PC32 bar 0x0
88# CHECK-NEXT:  }
89# CHECK-NEXT:  Section (5) .rela.data {
90# CHECK-NEXT:    0x2000 R_X86_64_PC32 barA 0x17
91# CHECK-NEXT:  }
92# CHECK-NEXT:  Section (6) .rela.text {
93# CHECK-NEXT:    0x1000 R_X86_64_PC32 fooA 0x13
94# CHECK-NEXT:  }
95# CHECK-NEXT:]
96