Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit a549f69

Browse files
committed
[RuntimeDyld] Support R_390_PC64 relocation type
Summary: When the MCJIT generates ELF code, some DWARF data requires 64-bit PC-relative relocation (R_390_PC64). This patch adds support for R_390_PC64 relocation to RuntimeDyld::resolveSystemZRelocation, to avoid an assertion failure. Reviewers: uweigand Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D20033 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269436 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent affbafe commit a549f69

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,11 @@ void RuntimeDyldELF::resolveSystemZRelocation(const SectionEntry &Section,
10471047
case ELF::R_390_64:
10481048
writeInt64BE(LocalAddress, Value + Addend);
10491049
break;
1050+
case ELF::R_390_PC64: {
1051+
int64_t Delta = (Value + Addend) - Section.getLoadAddressWithOffset(Offset);
1052+
writeInt64BE(LocalAddress, Delta);
1053+
break;
1054+
}
10501055
}
10511056
}
10521057

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@foo = global i8 0
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Test that R_390_PC32 and R_390_PC64 relocations can be generated.
2+
// RUN: llvm-mc -triple s390x-linux-gnu -relocation-model=pic -filetype=obj %s -o - | llvm-readobj -s -sr -sd | FileCheck %s
3+
4+
// Test that RuntimeDyld can fix up such relocations.
5+
// RUN: llvm-mc -triple s390x-linux-gnu -relocation-model=pic -filetype=obj %s -o %T/test-s390x-cfi-relo-pc64.o
6+
// RUN: llc -mtriple=s390x-linux-gnu -relocation-model=pic -filetype=obj %S/Inputs/rtdyld-globals.ll -o %T/test-s390x-rtdyld-globals.o
7+
// RUN: llvm-rtdyld -triple=s390x-linux-gnu -verify %T/test-s390x-cfi-relo-pc64.o %T/test-s390x-rtdyld-globals.o
8+
9+
f1:
10+
.cfi_startproc
11+
.cfi_personality 0x9c, foo // DW_EH_PE_indirect|DW_EH_PE_pcrel|DW_EH_PE_sdata8 (0x9c)
12+
lr %r0, %r0
13+
.cfi_endproc
14+
15+
// CHECK: Section {
16+
// CHECK: Index:
17+
// CHECK: Name: .rela.eh_frame
18+
// CHECK-NEXT: Type: SHT_RELA
19+
// CHECK-NEXT: Flags [
20+
// CHECK-NEXT: ]
21+
// CHECK-NEXT: Address: 0x0
22+
// CHECK-NEXT: Offset:
23+
// CHECK-NEXT: Size: 48
24+
// CHECK-NEXT: Link:
25+
// CHECK-NEXT: Info:
26+
// CHECK-NEXT: AddressAlignment: 8
27+
// CHECK-NEXT: EntrySize: 24
28+
// CHECK-NEXT: Relocations [
29+
// CHECK-NEXT: 0x12 R_390_PC64 foo 0x0
30+
// CHECK-NEXT: 0x28 R_390_PC32 .text 0x0
31+
// CHECK-NEXT: ]
32+
// CHECK: }

0 commit comments

Comments
 (0)