File: relocation-crel.yaml

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (92 lines) | stat: -rw-r--r-- 2,901 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# RUN: rm -rf %t && mkdir %t && cd %t
# RUN: yaml2obj %s -o out
# RUN: llvm-readelf -r out | FileCheck %s

# CHECK:      Relocation section '.crel.text' at offset {{.*}} contains 7 entries:
# CHECK-NEXT:     Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
# CHECK-NEXT: 0000000000000001  0000000100000004 R_X86_64_PLT32         0000000000000000 a0 - 4
# CHECK-NEXT: 0000000000000005  0000000200000004 R_X86_64_PLT32         0000000000000000 a1 - 4
# CHECK-NEXT: 000000000000000a  0000000300000004 R_X86_64_PLT32         0000000000000000 a2 + 0
# CHECK-NEXT: 0000000000000010  0000000200000001 R_X86_64_64            0000000000000000 a1 - 4
# CHECK-NEXT: 0000000000000018  0000000100000001 R_X86_64_64            0000000000000000 a0 + 80
# CHECK-NEXT: 0000000000000020  0000000000000008 R_X86_64_RELATIVE                 8000000000000000{{$}}
# CHECK-NEXT: 0000000000000028  0000000400000001 R_X86_64_64            0000000000000000 a3 + 7fffffffffffffff

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name: .text
    Type: SHT_PROGBITS
  - Name: .crel.text
    Type: SHT_CREL
    Info: .text
    Link: .symtab
    Relocations:
      - Offset: 1
        Type:   R_X86_64_PLT32
        Symbol: a0
        Addend: -4
      - Offset: 5
        Type:   R_X86_64_PLT32
        Symbol: a1
        Addend: -4
      - Offset: 10
        Type:   R_X86_64_PLT32
        Symbol: a2
        Addend: 0
      - Offset: 16
        Type:   R_X86_64_64
        Symbol: a1
        Addend: -4
      - Offset: 24
        Type:   R_X86_64_64
        Symbol: a0
        Addend: 128
      - Offset: 32
        Type:   R_X86_64_RELATIVE
        Addend: 0x8000000000000000
      - Offset: 40
        Type:   R_X86_64_64
        Symbol: a3
        Addend: 0x7fffffffffffffff
Symbols:
  - Name:    a0
  - Name:    a1
    Binding: STB_GLOBAL
  - Name:    a2
    Binding: STB_GLOBAL
  - Name:    a3
    Binding: STB_GLOBAL

## See output-limit.yaml. While estimating the size of the last byte of .crel.text
## (a SLEB128), checkLimit thinks 10 byte headroom is needed while only 1 is used.
## The file end is 1 byte away from the end of .crel.text (one-byte .strtab).
## Therefore, the --max-size= value has to be at least 10-1-1 larger than the
## actual file size.
# RUN: not yaml2obj %s --docnum=2 --max-size=76 -o /dev/null
# RUN: yaml2obj %s --docnum=2 --max-size=77 -o out
# RUN: %python -c 'import os; print(os.path.getsize("out"))' | FileCheck %s --check-prefix=SIZE

# SIZE: 69

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_REL
  Machine: EM_X86_64
Sections:
  - Name: .text
    Type: SHT_PROGBITS
  - Name: .crel.text
    Type: SHT_CREL
    Relocations:
      - Offset: 1
        Type:   R_X86_64_64
        Addend: -4
  - Type: SectionHeaderTable
    NoHeaders: true