[lld] r333203 - [PPC64] Set the IRelative relocation type.

Sean Fertile via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 09:32:15 PDT 2018


Author: sfertile
Date: Thu May 24 09:32:14 2018
New Revision: 333203

URL: http://llvm.org/viewvc/llvm-project?rev=333203&view=rev
Log:
[PPC64] Set the IRelative relocation type.

Set the IRelative relocation type and extend the related test to verify.
Differential Revision: https://reviews.llvm.org/D46877

Modified:
    lld/trunk/ELF/Arch/PPC64.cpp
    lld/trunk/test/ELF/ppc64-ifunc.s

Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=333203&r1=333202&r2=333203&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Thu May 24 09:32:14 2018
@@ -69,6 +69,7 @@ PPC64::PPC64() {
   GotRel = R_PPC64_GLOB_DAT;
   PltRel = R_PPC64_JMP_SLOT;
   RelativeRel = R_PPC64_RELATIVE;
+  IRelativeRel = R_PPC64_IRELATIVE;
   GotEntrySize = 8;
   PltEntrySize = 4;
   GotPltEntrySize = 8;

Modified: lld/trunk/test/ELF/ppc64-ifunc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-ifunc.s?rev=333203&r1=333202&r2=333203&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-ifunc.s (original)
+++ lld/trunk/test/ELF/ppc64-ifunc.s Thu May 24 09:32:14 2018
@@ -6,6 +6,7 @@
 # RUN: ld.lld %t.o %t2.so -o %t
 # RUN: llvm-objdump -D %t | FileCheck %s
 # RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
+# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
@@ -13,6 +14,7 @@
 # RUN: ld.lld %t.o %t2.so -o %t
 # RUN: llvm-objdump -D %t | FileCheck %s
 # RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
+# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
 
 # CHECK: Disassembly of section .text:
 
@@ -54,6 +56,14 @@
 # DT_PLTGOT should point to the start of the .plt section.
 # DT: 0x0000000000000003 PLTGOT 0x10030000
 
+# Check that we emit the correct dynamic relocation type for an ifunc
+# DYNREL: 'PLT' relocation section at offset 0x{{[0-9]+}} contains 48 bytes:
+# 48 bytes --> 2 Elf64_Rela relocations
+# DYNREL-NEXT: Offset        Info           Type               Symbol's Value  Symbol's Name + Addend
+# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}}  R_PPC64_JMP_SLOT      {{0+}}            foo + 0
+# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}}  R_PPC64_IRELATIVE     10010028
+
+
     .text
     .abiversion 2
 




More information about the llvm-commits mailing list