[PATCH] D27678: [LLD][ARM] Add R_ARM_RELATIVE to relocations that can be applied to GotSection

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 02:52:34 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289527: [ELF] Add R_ARM_RELATIVE to relocations that can be applied to GotSection (authored by psmith).

Changed prior to commit:
  https://reviews.llvm.org/D27678?vs=81096&id=81207#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27678

Files:
  lld/trunk/ELF/Target.cpp
  lld/trunk/test/ELF/arm-pie-relative.s


Index: lld/trunk/ELF/Target.cpp
===================================================================
--- lld/trunk/ELF/Target.cpp
+++ lld/trunk/ELF/Target.cpp
@@ -1739,6 +1739,7 @@
   case R_ARM_GOT_BREL:
   case R_ARM_GOT_PREL:
   case R_ARM_REL32:
+  case R_ARM_RELATIVE:
   case R_ARM_TARGET1:
   case R_ARM_TARGET2:
   case R_ARM_TLS_GD32:
Index: lld/trunk/test/ELF/arm-pie-relative.s
===================================================================
--- lld/trunk/test/ELF/arm-pie-relative.s
+++ lld/trunk/test/ELF/arm-pie-relative.s
@@ -0,0 +1,25 @@
+// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t
+// RUN: ld.lld %t --pie -o %t2
+// RUN: llvm-readobj -r %t2 | FileCheck %s
+// RUN: llvm-objdump -s %t2 | FileCheck %s --check-prefix=GOT
+// REQUIRES: arm
+
+// Test that a R_ARM_GOT_BREL relocation with PIE results in a R_ARM_RELATIVE
+// dynamic relocation
+ .syntax unified
+ .text
+ .global _start
+_start:
+ .word sym(GOT)
+
+ .data
+ .global sym
+sym:
+ .word 0
+
+// CHECK:      Relocations [
+// CHECK-NEXT:   Section (4) .rel.dyn {
+// CHECK-NEXT:     0x2058 R_ARM_RELATIVE
+
+// GOT: Contents of section .got:
+// GOT-NEXT:  2058 00300000


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27678.81207.patch
Type: text/x-patch
Size: 1182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/7c8aa165/attachment.bin>


More information about the llvm-commits mailing list