[PATCH] D46877: [PPC64] Set the IRelative relocation type.

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 09:36:22 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333203: [PPC64] Set the IRelative relocation type. (authored by sfertile, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D46877?vs=146804&id=148431#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D46877

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


Index: lld/trunk/test/ELF/ppc64-ifunc.s
===================================================================
--- lld/trunk/test/ELF/ppc64-ifunc.s
+++ lld/trunk/test/ELF/ppc64-ifunc.s
@@ -6,13 +6,15 @@
 # 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
 # RUN: ld.lld -shared %t2.o -o %t2.so
 # 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
 
Index: lld/trunk/ELF/Arch/PPC64.cpp
===================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp
+++ lld/trunk/ELF/Arch/PPC64.cpp
@@ -69,6 +69,7 @@
   GotRel = R_PPC64_GLOB_DAT;
   PltRel = R_PPC64_JMP_SLOT;
   RelativeRel = R_PPC64_RELATIVE;
+  IRelativeRel = R_PPC64_IRELATIVE;
   GotEntrySize = 8;
   PltEntrySize = 4;
   GotPltEntrySize = 8;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46877.148431.patch
Type: text/x-patch
Size: 1913 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180524/e92f6446/attachment.bin>


More information about the llvm-commits mailing list