summaryrefslogtreecommitdiffstats
path: root/lld/test
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2015-10-28 16:48:58 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2015-10-28 16:48:58 +0000
commitbc590feb2bdfdf0f3bc9bae450aef2f58109ebb9 (patch)
tree4553c92c24d47c97ea314cdb9b299a34889f5836 /lld/test
parent36e84c0fc73afbf0c0ec40bfc53c24a590715f3a (diff)
downloadbcm5719-llvm-bc590feb2bdfdf0f3bc9bae450aef2f58109ebb9.tar.gz
bcm5719-llvm-bc590feb2bdfdf0f3bc9bae450aef2f58109ebb9.zip
[ELF2] R_X86_64_COPY relocation implemented
Differential revision: http://reviews.llvm.org/D14090. llvm-svn: 251526
Diffstat (limited to 'lld/test')
-rw-r--r--lld/test/elf2/Inputs/relocation-copy.s14
-rw-r--r--lld/test/elf2/relocation-copy.s52
2 files changed, 66 insertions, 0 deletions
diff --git a/lld/test/elf2/Inputs/relocation-copy.s b/lld/test/elf2/Inputs/relocation-copy.s
new file mode 100644
index 00000000000..0cd0c4cb5ea
--- /dev/null
+++ b/lld/test/elf2/Inputs/relocation-copy.s
@@ -0,0 +1,14 @@
+.text
+.type x,@object
+.bss
+.globl x
+.align 4
+x:
+.long 0
+.size x, 4
+.type y,@object
+.globl y
+.align 4
+y:
+.long 0
+.size y, 4
diff --git a/lld/test/elf2/relocation-copy.s b/lld/test/elf2/relocation-copy.s
new file mode 100644
index 00000000000..3e8f6ca1b40
--- /dev/null
+++ b/lld/test/elf2/relocation-copy.s
@@ -0,0 +1,52 @@
+// REQUIRES: x86
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/relocation-copy.s -o %t2.o
+// RUN: ld.lld2 -shared %t2.o -o %t.so
+// RUN: ld.lld2 -e main %t.o %t.so -o %t3
+// RUN: llvm-readobj --program-headers --dynamic-table -t -s -dyn-symbols -section-data -r --expand-relocs %t3 | FileCheck %s
+// RUN: llvm-objdump -r -d %t3 | FileCheck -check-prefix=CODE %s
+
+.text
+.globl main
+.align 16, 0x90
+.type main,@function
+main:
+movl $5, x
+movl $7, y
+
+// CHECK: Name: .bss
+// CHECK-NEXT: Type: SHT_NOBITS (0x8)
+// CHECK-NEXT: Flags [ (0x3)
+// CHECK-NEXT: SHF_ALLOC (0x2)
+// CHECK-NEXT: SHF_WRITE (0x1)
+// CHECK-NEXT: ]
+// CHECK-NEXT: Address: 0x120A0
+// CHECK-NEXT: Offset: 0x20A0
+// CHECK-NEXT: Size: 20
+// CHECK-NEXT: Link: 0
+// CHECK-NEXT: Info: 0
+// CHECK-NEXT: AddressAlignment: 4
+// CHECK-NEXT: EntrySize: 0
+
+// CHECK: Relocations [
+// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Type: R_X86_64_COPY
+// CHECK-NEXT: Symbol: x
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset:
+// CHECK-NEXT: Type: R_X86_64_COPY
+// CHECK-NEXT: Symbol: y
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+
+// 73888 = 0x120A0
+// 16 is alignment here
+// 73892 = 0x120A0 + 16
+// CODE: Disassembly of section .text:
+// CODE-NEXT: main:
+// CODE-NEXT: 11000: c7 04 25 a0 20 01 00 05 00 00 00 movl $5, 73888
+// CODE-NEXT: 1100b: c7 04 25 b0 20 01 00 07 00 00 00 movl $7, 73904
OpenPOWER on IntegriCloud