[PATCH] D14153: [ELF2] R_X86_64_64 plt relocation implemented.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 28 10:41:38 PDT 2015
grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: grimar, llvm-commits.
This little patch is a final point in fix for https://llvm.org/bugs/show_bug.cgi?id=25175.
It`s make sample from issue description to work with -O0 optimization flag (with -O0 it generates R_X86_64_64 plt relocation).
Previous patch that implemented copy relocations (http://reviews.llvm.org/D14090) fixed -O1,2,3 cases.
http://reviews.llvm.org/D14153
Files:
ELF/Target.cpp
test/elf2/dynamic-reloc-index.s
test/elf2/dynamic-reloc.s
Index: test/elf2/dynamic-reloc.s
===================================================================
--- test/elf2/dynamic-reloc.s
+++ test/elf2/dynamic-reloc.s
@@ -9,7 +9,7 @@
// CHECK: Index: 1
// CHECK-NEXT: Name: .dynsym
-// CHECK: Name: .rela.dyn
+// CHECK: Name: .rela.plt
// CHECK-NEXT: Type: SHT_RELA
// CHECK-NEXT: Flags [
// CHECK-NEXT: SHF_ALLOC
@@ -28,24 +28,25 @@
// CHECK-NEXT: SHF_ALLOC
// CHECK-NEXT: SHF_EXECINSTR
// CHECK-NEXT: ]
-// CHECK-NEXT: Address: [[ADDR:.*]]
+// CHECK-NEXT: Address: 0x11000
// CHECK: Relocations [
-// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
+// CHECK-NEXT: Section ({{.*}}) .rela.plt {
// CHECK-NEXT: Relocation {
-// CHECK-NEXT: Offset: [[ADDR]]
-// CHECK-NEXT: Type: R_X86_64_64
+// CHECK-NEXT: Offset: 0x120C8
+// CHECK-NEXT: Type: R_X86_64_JUMP_SLOT
// CHECK-NEXT: Symbol: bar
-// CHECK-NEXT: Addend: 0x42
+// CHECK-NEXT: Addend: 0x0
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK: DynamicSection [
// CHECK-NEXT: Tag Type Name/Value
-// CHECK-NEXT: 0x0000000000000007 RELA [[RELAADDR]]
-// CHECK-NEXT: 0x0000000000000008 RELASZ [[RELASIZE]] (bytes)
-// CHECK-NEXT: 0x0000000000000009 RELAENT 24 (bytes)
+// CHECK-NEXT: 0x0000000000000017 JMPREL 0x10200
+// CHECK-NEXT: 0x0000000000000002 PLTRELSZ 24 (bytes)
+// CHECK-NEXT: 0x0000000000000003 PLTGOT 0x120B0
+// CHECK-NEXT: 0x0000000000000014 PLTREL RELA
// CHECK-NEXT: 0x0000000000000006 SYMTAB
// CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes)
// CHECK-NEXT: 0x0000000000000005 STRTAB
@@ -55,7 +56,6 @@
// CHECK-NEXT: 0x0000000000000000 NULL 0x0
// CHECK-NEXT: ]
-
.global _start
_start:
.quad bar + 0x42
Index: test/elf2/dynamic-reloc-index.s
===================================================================
--- test/elf2/dynamic-reloc-index.s
+++ test/elf2/dynamic-reloc-index.s
@@ -7,8 +7,8 @@
// We used to record the wrong symbol index for this test
// CHECK: Relocations [
-// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
-// CHECK-NEXT: 0x11000 R_X86_64_64 bar 0x0
+// CHECK-NEXT: Section ({{.*}}) .rela.plt {
+// CHECK-NEXT: 0x120C8 R_X86_64_JUMP_SLOT bar 0x0
// CHECK-NEXT: }
// CHECK-NEXT: ]
Index: ELF/Target.cpp
===================================================================
--- ELF/Target.cpp
+++ ELF/Target.cpp
@@ -265,6 +265,8 @@
switch (Type) {
case R_X86_64_32:
return R_X86_64_32;
+ case R_X86_64_64:
+ return R_X86_64_64;
case R_X86_64_PC32:
case R_X86_64_PLT32:
return R_X86_64_PC32;
@@ -280,6 +282,7 @@
default:
return false;
case R_X86_64_32:
+ case R_X86_64_64:
case R_X86_64_PC32:
// This relocation is defined to have a value of (S + A - P).
// The problems start when a non PIC program calls a function in a shared
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14153.38672.patch
Type: text/x-patch
Size: 3025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151028/bcecf83f/attachment.bin>
More information about the llvm-commits
mailing list