[lld] r332259 - [ELF][PPC64] Fix getRelExpr for R_PPC64_REL64
Zaara Syeda via llvm-commits
llvm-commits at lists.llvm.org
Mon May 14 09:39:45 PDT 2018
Author: syzaara
Date: Mon May 14 09:39:45 2018
New Revision: 332259
URL: http://llvm.org/viewvc/llvm-project?rev=332259&view=rev
Log:
[ELF][PPC64] Fix getRelExpr for R_PPC64_REL64
The relocation R_PPC64_REL64 should return R_PC for getRelExpr since it
computes S + A - P.
Differential Revision: https://reviews.llvm.org/D46766
Modified:
lld/trunk/ELF/Arch/PPC64.cpp
lld/trunk/test/ELF/ppc64-relocs.s
Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=332259&r1=332258&r2=332259&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Mon May 14 09:39:45 2018
@@ -164,6 +164,7 @@ RelExpr PPC64::getRelExpr(RelType Type,
case R_PPC64_REL16_LO:
case R_PPC64_REL16_HA:
case R_PPC64_REL32:
+ case R_PPC64_REL64:
return R_PC;
default:
return R_ABS;
Modified: lld/trunk/test/ELF/ppc64-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-relocs.s?rev=332259&r1=332258&r2=332259&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-relocs.s (original)
+++ lld/trunk/test/ELF/ppc64-relocs.s Mon May 14 09:39:45 2018
@@ -2,12 +2,12 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=rodataLE
+# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=DATALE
# RUN: llvm-objdump -D %t2 | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=rodataBE
+# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=DATABE
# RUN: llvm-objdump -D %t2 | FileCheck %s
.text
@@ -147,13 +147,13 @@ _start:
.LBB0_2:
add 3, 3, 4
-# rodataLE: Disassembly of section .rodata:
-# rodataLE: .rodata:
-# rodataLE: 10000190: b4 fe 00 00
-
-# rodataBE: Disassembly of section .rodata:
-# rodataBE: .rodata:
-# rodataBE: 10000190: 00 00 fe b4
+# DATALE: Disassembly of section .rodata:
+# DATALE: .rodata:
+# DATALE: 10000190: b4 fe 00 00
+
+# DATABE: Disassembly of section .rodata:
+# DATABE: .rodata:
+# DATABE: 10000190: 00 00 fe b4
# Address of rodata + value stored at rodata entry
# should equal address of LBB0_2.
@@ -163,3 +163,31 @@ _start:
# CHECK: 1001003c: {{.*}} addis 5, 2, -1
# CHECK: 10010040: {{.*}} ld 5, -32736(5)
# CHECK: 10010044: {{.*}} add 3, 3, 4
+
+.section .R_PPC64_REL64, "ax", at progbits
+.globl .FR_PPC64_REL64
+.FR_PPC64_REL64:
+ .cfi_startproc
+ .cfi_personality 148, __foo
+ li 0, 1
+ li 3, 55
+ sc
+ .cfi_endproc
+__foo:
+ li 3,0
+
+# Check that address of eh_frame entry + value stored
+# should equal the address of foo. Since it is not aligned,
+# the entry is not stored exactly at 100001a8. It starts at
+# address 0x100001aa and has the value 0xfeaa.
+# 0x100001aa + 0xfeaa = 0x10010054
+# DATALE: Disassembly of section .eh_frame:
+# DATALE: .eh_frame:
+# DATALE: 100001a8: {{.*}} aa fe
+
+# DATABE: Disassembly of section .eh_frame:
+# DATABE: .eh_frame:
+# DATABE: 100001b0: fe aa {{.*}}
+
+# CHECK: __foo
+# CHECK-NEXT: 10010054: {{.*}} li 3, 0
More information about the llvm-commits
mailing list