[PATCH] D40826: [LLD] Use Rela on PowerPC too

Nicholas Allegra via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 21 00:08:40 PST 2018


comex updated this revision to Diff 130799.
comex added a comment.
Herald added a subscriber: kbarton.

Sorry for the delay; here's an updated diff with a test.  (The test didn't seem to clearly belong in any existing .s file I saw, so I just made a new one.)


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D40826

Files:
  ELF/Driver.cpp
  test/ELF/ppc-rela.s


Index: test/ELF/ppc-rela.s
===================================================================
--- test/ELF/ppc-rela.s
+++ test/ELF/ppc-rela.s
@@ -0,0 +1,11 @@
+# REQUIRES: ppc
+# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t
+# RUN: ld.lld %t -o %t2 -shared
+# RUN: llvm-readobj -r %t2 | FileCheck %s
+
+.data
+  .long foo
+
+// CHECK:      Section ({{.*}}) .rela.dyn {
+// CHECK-NEXT:   0x1000 R_PPC_ADDR32 foo 0x0
+// CHECK-NEXT: }
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -805,7 +805,8 @@
   Config->Endianness =
       Config->IsLE ? support::endianness::little : support::endianness::big;
   Config->IsMips64EL = (Kind == ELF64LEKind && Machine == EM_MIPS);
-  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi;
+  Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi ||
+                   Machine == EM_PPC;
   Config->Pic = Config->Pie || Config->Shared;
   Config->Wordsize = Config->Is64 ? 8 : 4;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40826.130799.patch
Type: text/x-patch
Size: 1042 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180121/75c0b1e0/attachment.bin>


More information about the llvm-commits mailing list