Skip to content

Commit 5c118d3

Browse files
author
anoopkg6
committed
Incorporate code review feedback
1 parent dc19225 commit 5c118d3

File tree

7 files changed

+84
-160
lines changed

7 files changed

+84
-160
lines changed

llvm/include/llvm/ExecutionEngine/JITLink/systemz.h

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -203,63 +203,6 @@ enum EdgeKind_systemz : Edge::Kind {
203203
/// an out-of-range error will be returned.
204204
NegDelta32,
205205

206-
/// A GOT entry getter/constructor, transformed to Delta64FromGOT pointing
207-
/// at the GOT entry for the original target.
208-
///
209-
/// Indicates that this edge should be transformed into a Delta64FromGOT
210-
/// targeting the GOT entry for the edge's current target, maintaining the
211-
/// same addend. A GOT entry for the target should be created if one does
212-
/// not already exist.
213-
///
214-
/// Edges of this kind are usually handled by a GOT builder pass inserted by
215-
/// default.
216-
///
217-
/// Fixup expression:
218-
/// NONE
219-
///
220-
/// Errors:
221-
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
222-
///
223-
RequestGOTAndTransformToDelta64FromGOT,
224-
225-
/// A GOT entry getter/constructor, transformed to Delta32FromGOT pointing
226-
/// at the GOT entry for the original target.
227-
///
228-
/// Indicates that this edge should be transformed into a Delta32FromGOT
229-
/// targeting the GOT entry for the edge's current target, maintaining the
230-
/// same addend. A GOT entry for the target should be created if one does
231-
/// not already exist.
232-
///
233-
/// Edges of this kind are usually handled by a GOT builder pass inserted by
234-
/// default.
235-
///
236-
/// Fixup expression:
237-
/// NONE
238-
///
239-
/// Errors:
240-
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
241-
///
242-
RequestGOTAndTransformToDelta32FromGOT,
243-
244-
/// A GOT entry getter/constructor, transformed to Delta16FromGOT pointing
245-
/// at the GOT entry for the original target.
246-
///
247-
/// Indicates that this edge should be transformed into a Delta16FromGOT
248-
/// targeting the GOT entry for the edge's current target, maintaining the
249-
/// same addend. A GOT entry for the target should be created if one does
250-
/// not already exist.
251-
///
252-
/// Edges of this kind are usually handled by a GOT builder pass inserted by
253-
/// default.
254-
///
255-
/// Fixup expression:
256-
/// NONE
257-
///
258-
/// Errors:
259-
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
260-
///
261-
RequestGOTAndTransformToDelta16FromGOT,
262-
263206
/// A 32-bit Delta shifted by 1.
264207
///
265208
/// Delta from the fixup to the PLT slot for the target. This will lead to
@@ -448,6 +391,44 @@ enum EdgeKind_systemz : Edge::Kind {
448391
///
449392
Delta12FromGOT,
450393

394+
/// A GOT entry getter/constructor, transformed to Delta64FromGOT pointing
395+
/// at the GOT entry for the original target.
396+
///
397+
/// Indicates that this edge should be transformed into a Delta64FromGOT
398+
/// targeting the GOT entry for the edge's current target, maintaining the
399+
/// same addend. A GOT entry for the target should be created if one does
400+
/// not already exist.
401+
///
402+
/// Edges of this kind are usually handled by a GOT builder pass inserted by
403+
/// default.
404+
///
405+
/// Fixup expression:
406+
/// NONE
407+
///
408+
/// Errors:
409+
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
410+
///
411+
RequestGOTAndTransformToDelta64FromGOT,
412+
413+
/// A GOT entry getter/constructor, transformed to Delta32FromGOT pointing
414+
/// at the GOT entry for the original target.
415+
///
416+
/// Indicates that this edge should be transformed into a Delta32FromGOT
417+
/// targeting the GOT entry for the edge's current target, maintaining the
418+
/// same addend. A GOT entry for the target should be created if one does
419+
/// not already exist.
420+
///
421+
/// Edges of this kind are usually handled by a GOT builder pass inserted by
422+
/// default.
423+
///
424+
/// Fixup expression:
425+
/// NONE
426+
///
427+
/// Errors:
428+
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
429+
///
430+
RequestGOTAndTransformToDelta32FromGOT,
431+
451432
/// A GOT entry getter/constructor, transformed to Delta20FromGOT pointing
452433
/// at the GOT entry for the original target.
453434
///
@@ -467,6 +448,25 @@ enum EdgeKind_systemz : Edge::Kind {
467448
///
468449
RequestGOTAndTransformToDelta20FromGOT,
469450

451+
/// A GOT entry getter/constructor, transformed to Delta16FromGOT pointing
452+
/// at the GOT entry for the original target.
453+
///
454+
/// Indicates that this edge should be transformed into a Delta16FromGOT
455+
/// targeting the GOT entry for the edge's current target, maintaining the
456+
/// same addend. A GOT entry for the target should be created if one does
457+
/// not already exist.
458+
///
459+
/// Edges of this kind are usually handled by a GOT builder pass inserted by
460+
/// default.
461+
///
462+
/// Fixup expression:
463+
/// NONE
464+
///
465+
/// Errors:
466+
/// - *ASSERTION* Failure to handle edges of this kind prior to the fixup
467+
///
468+
RequestGOTAndTransformToDelta16FromGOT,
469+
470470
/// A GOT entry getter/constructor, transformed to Delta12FromGOT pointing
471471
/// at the GOT entry for the original target.
472472
///
@@ -638,7 +638,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
638638
}
639639
case Delta32dbl:
640640
case DeltaPLT32dbl: {
641-
int64_t Value = (S + A - P);
641+
int64_t Value = S + A - P;
642642
if (!LLVM_UNLIKELY(isInt<33>(Value)))
643643
return makeTargetOutOfRangeError(G, B, E);
644644
if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
@@ -648,7 +648,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
648648
}
649649
case Delta24dbl:
650650
case DeltaPLT24dbl: {
651-
int64_t Value = (S + A - P);
651+
int64_t Value = S + A - P;
652652
if (!LLVM_UNLIKELY(isInt<25>(Value)))
653653
return makeTargetOutOfRangeError(G, B, E);
654654
if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
@@ -660,7 +660,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
660660
}
661661
case Delta16dbl:
662662
case DeltaPLT16dbl: {
663-
int64_t Value = (S + A - P);
663+
int64_t Value = S + A - P;
664664
if (!LLVM_UNLIKELY(isInt<17>(Value)))
665665
return makeTargetOutOfRangeError(G, B, E);
666666
if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
@@ -670,7 +670,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
670670
}
671671
case Delta12dbl:
672672
case DeltaPLT12dbl: {
673-
int64_t Value = (S + A - P);
673+
int64_t Value = S + A - P;
674674
if (!LLVM_UNLIKELY(isInt<13>(Value)))
675675
return makeTargetOutOfRangeError(G, B, E);
676676
if (!LLVM_UNLIKELY(isAlignmentCorrect(Value, 2)))
@@ -700,14 +700,14 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
700700
case Delta64PLTFromGOT:
701701
case Delta64FromGOT: {
702702
assert(GOTSymbol && "No GOT section symbol");
703-
int64_t Value = (S + A - GOTBase);
703+
int64_t Value = S + A - GOTBase;
704704
write64be(FixupPtr, Value);
705705
break;
706706
}
707707
case Delta32PLTFromGOT:
708708
case Delta32FromGOT: {
709709
assert(GOTSymbol && "No GOT section symbol");
710-
int64_t Value = (S + A - GOTBase);
710+
int64_t Value = S + A - GOTBase;
711711
if (!LLVM_UNLIKELY(isInt<32>(Value)))
712712
return makeTargetOutOfRangeError(G, B, E);
713713
write32be(FixupPtr, Value);
@@ -716,7 +716,7 @@ inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
716716
case Delta16PLTFromGOT:
717717
case Delta16FromGOT: {
718718
assert(GOTSymbol && "No GOT section symbol");
719-
int64_t Value = (S + A - GOTBase);
719+
int64_t Value = S + A - GOTBase;
720720
if (!LLVM_UNLIKELY(isInt<16>(Value)))
721721
return makeTargetOutOfRangeError(G, B, E);
722722
write16be(FixupPtr, Value);

llvm/lib/ExecutionEngine/JITLink/ELF_systemz.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,15 @@ class ELFLinkGraphBuilder_systemz
277277
}
278278
// Relocations targeting the actual symbol (just relative to the GOT).
279279
case ELF::R_390_GOTOFF64: {
280-
Kind = systemz::RequestGOTAndTransformToDelta64FromGOT;
280+
Kind = systemz::Delta64FromGOT;
281281
break;
282282
}
283283
case ELF::R_390_GOTOFF: {
284-
Kind = systemz::RequestGOTAndTransformToDelta32FromGOT;
284+
Kind = systemz::Delta32FromGOT;
285285
break;
286286
}
287287
case ELF::R_390_GOTOFF16: {
288-
Kind = systemz::RequestGOTAndTransformToDelta16FromGOT;
288+
Kind = systemz::Delta16FromGOT;
289289
break;
290290
}
291291
// Relocations targeting the GOT entry associated with the symbol.

llvm/test/ExecutionEngine/JITLink/systemz/ELF_systemz_got.s

Lines changed: 0 additions & 78 deletions
This file was deleted.

llvm/test/ExecutionEngine/JITLink/systemz/ELF_systemz_reloc_call_pic.s

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ named_func:
2626
br %r14
2727
.size named_func, .-named_func
2828

29-
# Check R_390_PLT32DBL handling with a call to a local function in the text
30-
# section. This produces a Branch32 edge that is resolved like a regular
31-
# BranchPCRelPLT32dbl(no PLT entry created).
29+
# Check R_390_PC32DBL handling with a call to a local function in the text
30+
# section. This produces a Delta32dbl edge that is resolved like a regular
31+
# direct relative branches(no PLT entry created).
3232
#
3333
# jitlink-check: decode_operand(test_call_local, 1) = \
3434
# jitlink-check: named_func - test_call_local
@@ -40,8 +40,8 @@ test_call_local:
4040

4141
.size test_call_local, .-test_call_local
4242

43-
# Check R_390_PLT32dbl(BranchPCRelPLT32dbl) handling with a call to an
44-
# external via PLT. This produces a Branch32ToStub edge, because externals are
43+
# Check R_390_PLT32dbl(DeltaPLT32dbl) handling with a call to an
44+
# external via PLT. This produces a Delta32dbl edge, because externals are
4545
# not defined locally. As the target is out-of-range from the callsite,
4646
# the edge keeps using its PLT entry.
4747
#
@@ -58,8 +58,8 @@ test_call_extern_plt:
5858

5959
.size test_call_extern_plt, .-test_call_extern_plt
6060

61-
# Check R_390_PLT32(BranchPCRelPLT32dbl) handling with a call to an external.
62-
# This produces a Branch32ToStub edge, because externals are not defined
61+
# Check R_390_PLT32(DeltaPLT32dbl) handling with a call to an external.
62+
# This produces a Delta32dbl edge, because externals are not defined
6363
# locally. During resolution, the target turns out to be in-range from the
6464
# callsite.
6565
### TODO: edge can be relaxed in post-allocation optimization, it will then

llvm/test/ExecutionEngine/JITLink/systemz/ELF_systemz_reloc_gotrel.s

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,41 @@ main:
1818

1919
.data
2020
.globl test_gotoff16_bar
21-
# jitlink-check: *{2}test_gotoff16_bar = \
22-
# jitlink-check: (got_addr(elf_reloc.o, bar) - _GLOBAL_OFFSET_TABLE_)
21+
# jitlink-check: *{2}test_gotoff16_bar = (bar - _GLOBAL_OFFSET_TABLE_) & 0xffff
2322
test_gotoff16_bar:
2423
.reloc ., R_390_GOTOFF16, bar
2524
.space 2
2625
.size test_gotoff16_bar, .-test_gotoff16_bar
2726

2827
.globl test_pltoff16_foo
2928
# jitlink-check: *{2}test_pltoff16_foo = \
30-
# jitlink-check: (stub_addr(elf_reloc.o, foo) - _GLOBAL_OFFSET_TABLE_)
29+
# jitlink-check: (stub_addr(elf_reloc.o, foo) - _GLOBAL_OFFSET_TABLE_) \
30+
# jitlink-check: & 0xffff
3131
test_pltoff16_foo:
3232
.reloc ., R_390_PLTOFF16, foo
3333
.space 2
3434
.size test_pltoff16_foo, .-test_pltoff16_foo
3535

3636

3737
.globl test_gotoff32_bar
38-
# jitlink-check: *{4}test_gotoff32_bar = \
39-
# jitlink-check: (got_addr(elf_reloc.o, bar) - _GLOBAL_OFFSET_TABLE_)
38+
# jitlink-check: *{4}test_gotoff32_bar = (bar - _GLOBAL_OFFSET_TABLE_) \
39+
# jitlink-check: & 0xffffffff
4040
test_gotoff32_bar:
4141
.reloc ., R_390_GOTOFF, bar
4242
.space 4
4343
.size test_gotoff32_bar, .-test_gotoff32_bar
4444

4545
.globl test_pltoff32_foo
4646
# jitlink-check: *{4}test_pltoff32_foo = \
47-
# jitlink-check: (stub_addr(elf_reloc.o, foo) - _GLOBAL_OFFSET_TABLE_)
47+
# jitlink-check: (stub_addr(elf_reloc.o, foo) - _GLOBAL_OFFSET_TABLE_) \
48+
# jitlink-check: & 0xffffffff
4849
test_pltoff32_foo:
4950
.reloc ., R_390_PLTOFF32, foo
5051
.space 4
5152
.size test_pltoff32_foo, .-test_pltoff32_foo
5253

5354
.globl test_gotoff64_bar
54-
# jitlink-check: *{8}test_gotoff64_bar = \
55-
# jitlink-check: (got_addr(elf_reloc.o, bar) - _GLOBAL_OFFSET_TABLE_)
55+
# jitlink-check: *{8}test_gotoff64_bar = bar - _GLOBAL_OFFSET_TABLE_
5656
test_gotoff64_bar:
5757
.reloc ., R_390_GOTOFF64, bar
5858
.space 8

llvm/test/ExecutionEngine/JITLink/systemz/ELF_systemz_reloc_pc16.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# RUN: FileCheck -check-prefix=CHECK-ERROR %s
1515
#
1616
# jitlink-check: *{2}test_pc16 = OFFSET
17+
# jitlink-check: *{2}test_pc16dbl = OFFSET
1718

1819
# CHECK-ERROR: {{.*}} is out of range of Delta16 fixup
1920

llvm/test/ExecutionEngine/JITLink/systemz/ELF_systemz_reloc_pc32.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# RUN: FileCheck -check-prefix=CHECK-ERROR %s
1515
#
1616
# jitlink-check: *{4}test_pc32 = OFFSET
17+
# jitlink-check: *{4}test_pc32dbl = OFFSET
1718

1819
# CHECK-ERROR: {{.*}} is out of range of Delta32 fixup
1920

0 commit comments

Comments
 (0)