[PATCH] D73255: [ELF][PowerPC] Support R_PPC_COPY and R_PPC64_COPY
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 09:08:29 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf1dab29908d2: [ELF][PowerPC] Support R_PPC_COPY and R_PPC64_COPY (authored by MaskRay).
Changed prior to commit:
https://reviews.llvm.org/D73255?vs=240105&id=240224#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73255/new/
https://reviews.llvm.org/D73255
Files:
lld/ELF/Arch/PPC.cpp
lld/ELF/Arch/PPC64.cpp
lld/test/ELF/ppc-reloc-copy.s
llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-ppc64.test
Index: llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-ppc64.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-ppc64.test
+++ llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-ppc64.test
@@ -22,6 +22,7 @@
# CHECK: Type: R_PPC64_GOT16_LO (15)
# CHECK: Type: R_PPC64_GOT16_HI (16)
# CHECK: Type: R_PPC64_GOT16_HA (17)
+# CHECK: Type: R_PPC64_COPY (19)
# CHECK: Type: R_PPC64_GLOB_DAT (20)
# CHECK: Type: R_PPC64_JMP_SLOT (21)
# CHECK: Type: R_PPC64_RELATIVE (22)
@@ -144,6 +145,8 @@
- Offset: 0x0000000000000000
Type: R_PPC64_GOT16_HA
- Offset: 0x0000000000000000
+ Type: R_PPC64_COPY
+ - Offset: 0x0000000000000000
Type: R_PPC64_GLOB_DAT
- Offset: 0x0000000000000000
Type: R_PPC64_JMP_SLOT
Index: llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
===================================================================
--- llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
+++ llvm/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
@@ -26,6 +26,7 @@
#undef R_PPC64_GOT16_LO
#undef R_PPC64_GOT16_HI
#undef R_PPC64_GOT16_HA
+#undef R_PPC64_COPY
#undef R_PPC64_GLOB_DAT
#undef R_PPC64_JMP_SLOT
#undef R_PPC64_RELATIVE
@@ -119,6 +120,7 @@
ELF_RELOC(R_PPC64_GOT16_LO, 15)
ELF_RELOC(R_PPC64_GOT16_HI, 16)
ELF_RELOC(R_PPC64_GOT16_HA, 17)
+ELF_RELOC(R_PPC64_COPY, 19)
ELF_RELOC(R_PPC64_GLOB_DAT, 20)
ELF_RELOC(R_PPC64_JMP_SLOT, 21)
ELF_RELOC(R_PPC64_RELATIVE, 22)
Index: lld/test/ELF/ppc-reloc-copy.s
===================================================================
--- /dev/null
+++ lld/test/ELF/ppc-reloc-copy.s
@@ -0,0 +1,29 @@
+# REQUIRES: ppc
+# RUN: llvm-mc -filetype=obj -triple=powerpc %p/Inputs/relocation-copy.s -o %t1.32.o
+# RUN: ld.lld -shared %t1.32.o -soname=so -o %t1.32.so
+# RUN: llvm-mc -filetype=obj -triple=powerpc %s -o %t.32.o
+# RUN: ld.lld %t.32.o %t1.32.so -o %t.32
+# RUN: llvm-readobj -r %t.32 | FileCheck --check-prefix=REL32 %s
+# RUN: llvm-nm -S %t.32 | FileCheck --check-prefix=NM32 %s
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64 %p/Inputs/relocation-copy.s -o %t1.64.o
+# RUN: ld.lld -shared %t1.64.o -soname=so -o %t1.64.so
+# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.64.o
+# RUN: ld.lld %t.64.o %t1.64.so -o %t.64
+# RUN: llvm-readobj -r %t.64 | FileCheck --check-prefix=REL64 %s
+# RUN: llvm-nm -S %t.64 | FileCheck --check-prefix=NM64 %s
+
+# REL32: .rela.dyn {
+# REL32-NEXT: 0x10030210 R_PPC_COPY x 0x0
+# REL32-NEXT: }
+
+# NM32: 10030210 00000004 B x
+
+# REL64: .rela.dyn {
+# REL64-NEXT: 0x10030350 R_PPC64_COPY x 0x0
+# REL64-NEXT: }
+
+# NM64: 0000000010030350 0000000000000004 B x
+
+lis 3, x at ha
+lwz 3, x at l(3)
Index: lld/ELF/Arch/PPC64.cpp
===================================================================
--- lld/ELF/Arch/PPC64.cpp
+++ lld/ELF/Arch/PPC64.cpp
@@ -297,6 +297,7 @@
}
PPC64::PPC64() {
+ copyRel = R_PPC64_COPY;
gotRel = R_PPC64_GLOB_DAT;
noneRel = R_PPC64_NONE;
pltRel = R_PPC64_JMP_SLOT;
Index: lld/ELF/Arch/PPC.cpp
===================================================================
--- lld/ELF/Arch/PPC.cpp
+++ lld/ELF/Arch/PPC.cpp
@@ -140,6 +140,7 @@
}
PPC::PPC() {
+ copyRel = R_PPC_COPY;
gotRel = R_PPC_GLOB_DAT;
noneRel = R_PPC_NONE;
pltRel = R_PPC_JMP_SLOT;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73255.240224.patch
Type: text/x-patch
Size: 3440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/f1f345d6/attachment.bin>
More information about the llvm-commits
mailing list