1 ## Check how llvm-readobj and llvm-readelf tools dump addends of relocations.
3 # RUN: yaml2obj --docnum=1 -DENCODE=LSB -DTYPE=SHT_RELA %s -o %t.le64.rela
4 # RUN: llvm-readobj -r %t.le64.rela | FileCheck %s --check-prefix=LLVM-RELA64
5 # RUN: llvm-readelf -r %t.le64.rela | FileCheck %s --check-prefix=GNU-RELA64
7 # LLVM-RELA64: R_X86_64_NONE - 0x0{{$}}
8 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0x1{{$}}
9 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0xFFFFFFFFFFFFFFFF{{$}}
10 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0x7FFFFFFFFFFFFFFF{{$}}
11 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0x8000000000000000{{$}}
12 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0xFFFFFFFFFFFFCFC7{{$}}
13 # LLVM-RELA64-NEXT: R_X86_64_NONE - 0x12345{{$}}
15 ## FIXME: GNU readelf prints addends differently.
16 ## See https://bugs.llvm.org/show_bug.cgi?id=45235.
17 # GNU-RELA64: Type Symbol's Value Symbol's Name + Addend
18 # GNU-RELA64-NEXT: R_X86_64_NONE 0{{$}}
19 # GNU-RELA64-NEXT: R_X86_64_NONE 1{{$}}
20 # GNU-RELA64-NEXT: R_X86_64_NONE ffffffffffffffff{{$}}
21 # GNU-RELA64-NEXT: R_X86_64_NONE 7fffffffffffffff{{$}}
22 # GNU-RELA64-NEXT: R_X86_64_NONE 8000000000000000{{$}}
23 # GNU-RELA64-NEXT: R_X86_64_NONE ffffffffffffcfc7{{$}}
24 # GNU-RELA64-NEXT: R_X86_64_NONE 12345{{$}}
26 # RUN: yaml2obj --docnum=1 -DENCODE=MSB -DTYPE=SHT_RELA %s -o %t.be64.rela
27 # RUN: llvm-readobj -r %t.be64.rela | FileCheck %s --check-prefix=LLVM-RELA64
28 # RUN: llvm-readelf -r %t.be64.rela | FileCheck %s --check-prefix=GNU-RELA64
30 # RUN: yaml2obj --docnum=1 -DENCODE=LSB -DTYPE=SHT_REL %s -o %t.le64.rel
31 # RUN: llvm-readobj -r %t.le64.rel | FileCheck %s --check-prefix=LLVM-REL64
32 # RUN: llvm-readelf -r %t.le64.rel | FileCheck %s --check-prefix=GNU-REL64
34 # LLVM-REL64-COUNT-7: R_X86_64_NONE -{{$}}
37 # GNU-REL64: Type Symbol's Value Symbol's Name{{$}}
38 # GNU-REL64-COUNT-7: R_X86_64_NONE {{$}}
41 # RUN: yaml2obj --docnum=1 -DENCODE=MSB -DTYPE=SHT_REL %s -o %t.be64.rel
42 # RUN: llvm-readobj -r %t.be64.rel | FileCheck %s --check-prefix=LLVM-REL64
43 # RUN: llvm-readelf -r %t.be64.rel | FileCheck %s --check-prefix=GNU-REL64
48 Data: ELFDATA2[[ENCODE]]
58 ## Addend == first positive int64/uint64 == 1.
61 ## Addend == first negative int64 == -1.
62 - Addend: 0xffffffffffffffff
64 ## Addend == max possible int64 == 0x7FFFFFFFFFFFFFFF.
65 - Addend: 0x7FFFFFFFFFFFFFFF
67 ## Addend == min possible int64 == 0x8000000000000000.
68 - Addend: 0x8000000000000000
70 ## Addend == an arbitrary negative number.
71 - Addend: 0xFFFFFFFFFFFFCFC7 ## -12345
73 ## Addend == an arbitrary positive number.
77 ## Starting from here we check ELFCLASS32 objects.
79 # RUN: yaml2obj --docnum=2 -DENCODE=LSB -DTYPE=SHT_RELA %s -o %t.le32.rela
80 # RUN: llvm-readobj -r %t.le32.rela | FileCheck %s --check-prefix=LLVM-RELA32
81 # RUN: llvm-readelf -r %t.le32.rela | FileCheck %s --check-prefix=GNU-RELA32
83 # LLVM-RELA32: R_386_NONE - 0x0{{$}}
84 # LLVM-RELA32-NEXT: R_386_NONE - 0x1{{$}}
85 # LLVM-RELA32-NEXT: R_386_NONE - 0xFFFFFFFF{{$}}
86 # LLVM-RELA32-NEXT: R_386_NONE - 0x7FFFFFFF{{$}}
87 # LLVM-RELA32-NEXT: R_386_NONE - 0x80000000{{$}}
88 # LLVM-RELA32-NEXT: R_386_NONE - 0xFFFFCFC7{{$}}
90 ## FIXME: GNU readelf prints addends differently.
91 ## See https://bugs.llvm.org/show_bug.cgi?id=45235.
92 # GNU-RELA32: Type Sym. Value Symbol's Name + Addend
93 # GNU-RELA32-NEXT: R_386_NONE 0{{$}}
94 # GNU-RELA32-NEXT: R_386_NONE 1{{$}}
95 # GNU-RELA32-NEXT: R_386_NONE ffffffffffffffff{{$}}
96 # GNU-RELA32-NEXT: R_386_NONE 7fffffff{{$}}
97 # GNU-RELA32-NEXT: R_386_NONE ffffffff80000000{{$}}
98 # GNU-RELA32-NEXT: R_386_NONE ffffffffffffcfc7{{$}}
100 # RUN: yaml2obj --docnum=2 -DENCODE=MSB -DTYPE=SHT_RELA %s -o %t.be32.rela
101 # RUN: llvm-readobj -r %t.be32.rela | FileCheck %s --check-prefix=LLVM-RELA32
102 # RUN: llvm-readelf -r %t.be32.rela | FileCheck %s --check-prefix=GNU-RELA32
104 # RUN: yaml2obj --docnum=2 -DENCODE=LSB -DTYPE=SHT_REL %s -o %t.le32.rel
105 # RUN: llvm-readobj -r %t.le32.rel | FileCheck %s --check-prefix=LLVM-REL32
106 # RUN: llvm-readelf -r %t.le32.rel | FileCheck %s --check-prefix=GNU-REL32
108 # LLVM-REL32-COUNT-7: R_386_NONE -{{$}}
112 # GNU-REL32-COUNT-7: R_386_NONE {{$}}
115 # RUN: yaml2obj --docnum=2 -DENCODE=MSB -DTYPE=SHT_REL %s -o %t.be32.rel
116 # RUN: llvm-readobj -r %t.be32.rel | FileCheck %s --check-prefix=LLVM-REL32
117 # RUN: llvm-readelf -r %t.be32.rel | FileCheck %s --check-prefix=GNU-REL32
122 Data: ELFDATA2[[ENCODE]]
132 ## Addend == first positive int32/uint32 == 1.
135 ## Addend == first negative int32 == -1.
138 ## Addend == max possible int32 == 0x7FFFFFFF.
141 ## Addend == min possible int32 == 0x80000000.
144 ## Addend == an arbitrary negative number.
145 - Addend: 0xFFFFCFC7 ## -12345
147 ## Addend == an arbitrary positive number.