1 ## Here we document how yaml2obj handles relocation addend descriptions.
3 ## Case 1: Check a 64-bit object.
5 ## Case 1.1: Document we accept any hex/decimal addends in [INT64_MIN, UINT64_MAX].
7 ## INT64_MIN == -9223372036854775808
8 ## UINT64_MAX == 0xffffffffffffffff
10 ## Addend == UINT64_MAX.
11 # RUN: yaml2obj %s -o %t64.decimal.max -DADDEND=18446744073709551615
12 # RUN: llvm-readobj -r %t64.decimal.max | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFFFFFFFFFF
13 # RUN: yaml2obj %s -o %t64.hex.max -DADDEND=0xFFFFFFFFFFFFFFFF
14 # RUN: llvm-readobj -r %t64.hex.max | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFFFFFFFFFF
16 ## Addend == first positive integer.
17 # RUN: yaml2obj %s -o %t64.decimal.first.pos -DADDEND=1
18 # RUN: llvm-readobj -r %t64.decimal.first.pos | FileCheck %s --check-prefix=TEST -DADDEND=0x1
19 # RUN: yaml2obj %s -o %t64.hex.first.pos -DADDEND=0x1
20 # RUN: llvm-readobj -r %t64.hex.first.pos | FileCheck %s --check-prefix=TEST -DADDEND=0x1
23 # RUN: yaml2obj %s -o %t64.decimal.null -DADDEND=0
24 # RUN: llvm-readobj -r %t64.decimal.null | FileCheck %s --check-prefix=TEST -DADDEND=0x0
25 # RUN: yaml2obj %s -o %t64.hex.null -DADDEND=0x0
26 # RUN: llvm-readobj -r %t64.hex.null | FileCheck %s --check-prefix=TEST -DADDEND=0x0
28 ## Addend == first negative integer.
29 # RUN: yaml2obj %s -o %t64.decimal.first.neg -DADDEND=-1
30 # RUN: llvm-readobj -r %t64.decimal.first.neg | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFFFFFFFFFF
31 ## We do not accept negative hex addends.
32 # RUN: not yaml2obj %s -o /dev/null -DADDEND=-0x1 2>&1 | FileCheck %s --check-prefix=ERR
34 ## Addend == INT64_MIN.
35 # RUN: yaml2obj %s -o %t64.decimal.min -DADDEND=-9223372036854775808
36 # RUN: llvm-readobj -r %t64.decimal.min | FileCheck %s --check-prefix=TEST -DADDEND=0x8000000000000000
37 # TEST: 0x0 R_{{.*}}_PC32 foo [[ADDEND]]
39 # Case 1.2: Document we do not accept any hex/decimal addends outside of the range specified.
42 # RUN: not yaml2obj %s -o /dev/null -DADDEND=18446744073709551616 2>&1 | FileCheck %s --check-prefix=ERR
43 # RUN: not yaml2obj %s -o /dev/null -DADDEND=0x10000000000000000 2>&1 | FileCheck %s --check-prefix=ERR
45 ## Addend == INT64_MIN - 1.
46 # RUN: not yaml2obj %s -o /dev/null -DADDEND=-9223372036854775809 2>&1 | FileCheck %s --check-prefix=ERR
70 ## Case 2: Check a 32-bit object.
72 ## INT32_MIN == -2147483648
73 ## UINT32_MAX == 0xffffffff
75 ## Case 2.1: Document we accept any hex/decimal addends in [INT32_MIN, UINT32_MAX].
77 ## Addend == UINT32_MAX.
78 # RUN: yaml2obj --docnum=2 %s -o %t32.decimal.max -DADDEND=4294967295
79 # RUN: llvm-readobj -r %t32.decimal.max | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFF
80 # RUN: yaml2obj --docnum=2 %s -o %t32.hex.max -DADDEND=0xFFFFFFFF
81 # RUN: llvm-readobj -r %t32.hex.max | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFF
83 ## Addend == first positive integer.
84 # RUN: yaml2obj --docnum=2 %s -o %t32.decimal.first.pos -DADDEND=1
85 # RUN: llvm-readobj -r %t32.decimal.first.pos | FileCheck %s --check-prefix=TEST -DADDEND=0x1
86 # RUN: yaml2obj --docnum=2 %s -o %t32.hex.first.pos -DADDEND=0x1
87 # RUN: llvm-readobj -r %t32.hex.first.pos | FileCheck %s --check-prefix=TEST -DADDEND=0x1
90 # RUN: yaml2obj --docnum=2 %s -o %t32.decimal.null -DADDEND=0
91 # RUN: llvm-readobj -r %t32.decimal.null | FileCheck %s --check-prefix=TEST -DADDEND=0x0
92 # RUN: yaml2obj --docnum=2 %s -o %t32.hex.null -DADDEND=0x0
93 # RUN: llvm-readobj -r %t32.hex.null | FileCheck %s --check-prefix=TEST -DADDEND=0x0
95 ## Addend == first negative integer.
96 # RUN: yaml2obj --docnum=2 %s -o %t32.decimal.first.neg -DADDEND=-1
97 # RUN: llvm-readobj -r %t32.decimal.first.neg | FileCheck %s --check-prefix=TEST -DADDEND=0xFFFFFFFF
98 ## We do not accept negative hex addends.
99 # RUN: not yaml2obj --docnum=2 %s -o /dev/null -DADDEND=-0x1 2>&1 | FileCheck %s --check-prefix=ERR
101 ## Addend == INT32_MIN
102 # RUN: yaml2obj --docnum=2 %s -o %t32.decimal.min -DADDEND=-2147483648
103 # RUN: llvm-readobj -r %t32.decimal.min | FileCheck %s --check-prefix=TEST -DADDEND=0x80000000
105 # Case 2.2: Document we do not accept any hex/decimal addends outside of the range specified.
108 # RUN: not yaml2obj --docnum=2 %s -o /dev/null -DADDEND=4294967296 2>&1 | FileCheck %s --check-prefix=ERR
109 # RUN: not yaml2obj --docnum=2 %s -o /dev/null -DADDEND=0x100000000 2>&1 | FileCheck %s --check-prefix=ERR
111 ## Addend == INT32_MIN - 1.
112 # RUN: not yaml2obj --docnum=2 %s -o /dev/null -DADDEND=-2147483649 2>&1 | FileCheck %s --check-prefix=ERR
134 ## Case 3: Check we do not allow invalid values.
135 # RUN: not yaml2obj %s -D ADDEND=0x1122GGEE 2>&1 | FileCheck %s --check-prefix=ERR
136 # RUN: not yaml2obj %s -D ADDEND=-0x1122GGEE 2>&1 | FileCheck %s --check-prefix=ERR
137 # RUN: not yaml2obj %s -D ADDEND=1234G5 2>&1 | FileCheck %s --check-prefix=ERR
138 # RUN: not yaml2obj %s -D ADDEND=-1234G5 2>&1 | FileCheck %s --check-prefix=ERR
139 # RUN: not yaml2obj %s -D ADDEND=foo 2>&1 | FileCheck %s --check-prefix=ERR
140 # RUN: not yaml2obj %s -D ADDEND=- 2>&1 | FileCheck %s --check-prefix=ERR
141 # RUN: not yaml2obj %s -D ADDEND=--1234 2>&1 | FileCheck %s --check-prefix=ERR