@@ -39,12 +39,8 @@ enum EdgeKind_i386 : Edge::Kind {
39
39
// / Represents a data/control flow instruction using PC-relative addressing
40
40
// / to a target.
41
41
// /
42
- // / The fixup expression for this kind includes an implicit offset to account
43
- // / for the PC (unlike the Delta edges) so that a PCRel32 with a target
44
- // / T and addend zero is a call/branch to the start (offset zero) of T.
45
- // /
46
42
// / Fixup expression:
47
- // / Fixup <- Target - ( Fixup + 4) + Addend : int32
43
+ // / Fixup <- Target - Fixup + Addend : int32
48
44
// /
49
45
// / Errors:
50
46
// / - The result of the fixup expression must fit into an int32, otherwise
@@ -68,12 +64,8 @@ enum EdgeKind_i386 : Edge::Kind {
68
64
// / Represents a data/control flow instruction using PC-relative addressing
69
65
// / to a target.
70
66
// /
71
- // / The fixup expression for this kind includes an implicit offset to account
72
- // / for the PC (unlike the Delta edges) so that a PCRel16 with a target
73
- // / T and addend zero is a call/branch to the start (offset zero) of T.
74
- // /
75
67
// / Fixup expression:
76
- // / Fixup <- Target - ( Fixup + 4) + Addend : int16
68
+ // / Fixup <- Target - Fixup + Addend : int16
77
69
// /
78
70
// / Errors:
79
71
// / - The result of the fixup expression must fit into an int16, otherwise
@@ -86,7 +78,7 @@ enum EdgeKind_i386 : Edge::Kind {
86
78
// / Delta from the fixup to the target.
87
79
// /
88
80
// / Fixup expression:
89
- // / Fixup <- Target - Fixup + Addend : int64
81
+ // / Fixup <- Target - Fixup + Addend : int32
90
82
// /
91
83
// / Errors:
92
84
// / - The result of the fixup expression must fit into an int32, otherwise
@@ -130,12 +122,8 @@ enum EdgeKind_i386 : Edge::Kind {
130
122
// / Represents a PC-relative call or branch to a target. This can be used to
131
123
// / identify, record, and/or patch call sites.
132
124
// /
133
- // / The fixup expression for this kind includes an implicit offset to account
134
- // / for the PC (unlike the Delta edges) so that a Branch32PCRel with a target
135
- // / T and addend zero is a call/branch to the start (offset zero) of T.
136
- // /
137
125
// / Fixup expression:
138
- // / Fixup <- Target - ( Fixup + 4) + Addend : int32
126
+ // / Fixup <- Target - Fixup + Addend : int32
139
127
// /
140
128
// / Errors:
141
129
// / - The result of the fixup expression must fit into an int32, otherwise
@@ -164,7 +152,7 @@ enum EdgeKind_i386 : Edge::Kind {
164
152
// / target may be recorded to allow manipulation at runtime.
165
153
// /
166
154
// / Fixup expression:
167
- // / Fixup <- Target - Fixup + Addend - 4 : int32
155
+ // / Fixup <- Target - Fixup + Addend : int32
168
156
// /
169
157
// / Errors:
170
158
// / - The result of the fixup expression must fit into an int32, otherwise
@@ -180,7 +168,7 @@ enum EdgeKind_i386 : Edge::Kind {
180
168
// / is within range of the fixup location.
181
169
// /
182
170
// / Fixup expression:
183
- // / Fixup <- Target - Fixup + Addend - 4 : int32
171
+ // / Fixup <- Target - Fixup + Addend : int32
184
172
// /
185
173
// / Errors:
186
174
// / - The result of the fixup expression must fit into an int32, otherwise
@@ -215,8 +203,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
215
203
}
216
204
217
205
case i386::PCRel32: {
218
- int32_t Value =
219
- E.getTarget ().getAddress () - (FixupAddress + 4 ) + E.getAddend ();
206
+ int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
220
207
*(little32_t *)FixupPtr = Value;
221
208
break ;
222
209
}
@@ -231,8 +218,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
231
218
}
232
219
233
220
case i386::PCRel16: {
234
- int32_t Value =
235
- E.getTarget ().getAddress () - (FixupAddress + 4 ) + E.getAddend ();
221
+ int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
236
222
if (LLVM_LIKELY (isInt<16 >(Value)))
237
223
*(little16_t *)FixupPtr = Value;
238
224
else
@@ -257,8 +243,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
257
243
case i386::BranchPCRel32:
258
244
case i386::BranchPCRel32ToPtrJumpStub:
259
245
case i386::BranchPCRel32ToPtrJumpStubBypassable: {
260
- int32_t Value =
261
- E.getTarget ().getAddress () - (FixupAddress + 4 ) + E.getAddend ();
246
+ int32_t Value = E.getTarget ().getAddress () - FixupAddress + E.getAddend ();
262
247
*(little32_t *)FixupPtr = Value;
263
248
break ;
264
249
}
0 commit comments