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

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 06:27:08 PDT 2018


sfertile created this revision.
sfertile added reviewers: syzaara, ruiu, rdhindsa.
Herald added subscribers: kbarton, arichardson, nemanjai, emaste.
Herald added a reviewer: espindola.

Set the IRelative relocation type and add a test to verify.

Depends on https://reviews.llvm.org/D46876


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D46877

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


Index: test/ELF/ppc64-ifunc.s
===================================================================
--- test/ELF/ppc64-ifunc.s
+++ 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: ELF/Arch/PPC64.cpp
===================================================================
--- ELF/Arch/PPC64.cpp
+++ 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.146804.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180515/49767bb7/attachment.bin>


More information about the llvm-commits mailing list