forked from OSchip/llvm-project
[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 llvm-svn: 332259
This commit is contained in:
parent
bb818b4421
commit
6b8b868db5
|
@ -164,6 +164,7 @@ RelExpr PPC64::getRelExpr(RelType Type, const Symbol &S,
|
|||
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;
|
||||
|
|
|
@ -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
|
||||
# DATALE: Disassembly of section .rodata:
|
||||
# DATALE: .rodata:
|
||||
# DATALE: 10000190: b4 fe 00 00
|
||||
|
||||
# rodataBE: Disassembly of section .rodata:
|
||||
# rodataBE: .rodata:
|
||||
# rodataBE: 10000190: 00 00 fe b4
|
||||
# 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",@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
|
||||
|
|
Loading…
Reference in New Issue