aboutsummaryrefslogtreecommitdiff
path: root/test/ELF/mips-26.s
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:48:50 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:48:50 +0000
commit1c98619801a5705c688e683be3ef9d70169a0686 (patch)
tree8422105cd1a94c368315f2db16b9ac746cf7c000 /test/ELF/mips-26.s
parentf4f3ce4613680903220815690ad79fc7ba0a2e26 (diff)
downloadsrc-1c98619801a5705c688e683be3ef9d70169a0686.tar.gz
src-1c98619801a5705c688e683be3ef9d70169a0686.zip
Vendor import of lld release_39 branch r276489:vendor/lld/lld-release_39-r276489
Notes
Notes: svn path=/vendor/lld/dist/; revision=303239 svn path=/vendor/lld/lld-release_39-r276489/; revision=303240; tag=vendor/lld/lld-release_39-r276489
Diffstat (limited to 'test/ELF/mips-26.s')
-rw-r--r--test/ELF/mips-26.s95
1 files changed, 95 insertions, 0 deletions
diff --git a/test/ELF/mips-26.s b/test/ELF/mips-26.s
new file mode 100644
index 000000000000..b463c1ac2127
--- /dev/null
+++ b/test/ELF/mips-26.s
@@ -0,0 +1,95 @@
+# Check R_MIPS_26 relocation handling.
+
+# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t1.o
+# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
+# RUN: %S/Inputs/mips-dynamic.s -o %t2.o
+# RUN: ld.lld %t2.o -shared -o %t.so
+# RUN: ld.lld %t1.o %t.so -o %t.exe
+# RUN: llvm-objdump -d %t.exe | FileCheck %s
+# RUN: llvm-readobj -dynamic-table -s -r -mips-plt-got %t.exe \
+# RUN: | FileCheck -check-prefix=REL %s
+
+# REQUIRES: mips
+
+# CHECK: Disassembly of section .text:
+# CHECK-NEXT: bar:
+# CHECK-NEXT: 20000: 0c 00 80 06 jal 131096 <loc>
+# CHECK-NEXT: 20004: 00 00 00 00 nop
+#
+# CHECK: __start:
+# CHECK-NEXT: 20008: 0c 00 80 00 jal 131072 <bar>
+# CHECK-NEXT: 2000c: 00 00 00 00 nop
+# CHECK-NEXT: 20010: 0c 00 80 10 jal 131136
+# ^-- 0x20040 gotplt[foo0]
+# CHECK-NEXT: 20014: 00 00 00 00 nop
+#
+# CHECK: loc:
+# CHECK-NEXT: 20018: 00 00 00 00 nop
+# CHECK-NEXT: Disassembly of section .plt:
+# CHECK-NEXT: .plt:
+# CHECK-NEXT: 20020: 3c 1c 00 04 lui $gp, 4
+# CHECK-NEXT: 20024: 8f 99 00 04 lw $25, 4($gp)
+# CHECK-NEXT: 20028: 27 9c 00 04 addiu $gp, $gp, 4
+# CHECK-NEXT: 2002c: 03 1c c0 23 subu $24, $24, $gp
+# CHECK-NEXT: 20030: 03 e0 78 25 move $15, $ra
+# CHECK-NEXT: 20034: 00 18 c0 82 srl $24, $24, 2
+# CHECK-NEXT: 20038: 03 20 f8 09 jalr $25
+# CHECK-NEXT: 2003c: 27 18 ff fe addiu $24, $24, -2
+# CHECK-NEXT: 20040: 3c 0f 00 04 lui $15, 4
+# CHECK-NEXT: 20044: 8d f9 00 0c lw $25, 12($15)
+# CHECK-NEXT: 20048: 03 20 00 08 jr $25
+# CHECK-NEXT: 2004c: 25 f8 00 0c addiu $24, $15, 12
+
+# REL: Name: .plt
+# REL-NEXT: Type: SHT_PROGBITS
+# REL-NEXT: Flags [ (0x6)
+# REL-NEXT: SHF_ALLOC
+# REL-NEXT: SHF_EXECINSTR
+# REL-NEXT: ]
+# REL-NEXT: Address: 0x[[PLTADDR:[0-9A-F]+]]
+
+# REL: Name: .got.plt
+# REL-NEXT: Type: SHT_PROGBITS
+# REL-NEXT: Flags [ (0x3)
+# REL-NEXT: SHF_ALLOC
+# REL-NEXT: SHF_WRITE
+# REL-NEXT: ]
+# REL-NEXT: Address: 0x[[GOTPLTADDR:[0-9A-F]+]]
+
+# REL: Relocations [
+# REL-NEXT: Section (7) .rel.plt {
+# REL-NEXT: 0x[[PLTSLOT:[0-9A-F]+]] R_MIPS_JUMP_SLOT foo0 0x0
+# REL-NEXT: }
+# REL-NEXT: ]
+
+# REL: 0x70000032 MIPS_PLTGOT 0x[[GOTPLTADDR]]
+
+# REL: Primary GOT {
+# REL: Local entries [
+# REL-NEXT: ]
+# REL-NEXT: Global entries [
+# REL-NEXT: ]
+# REL: PLT GOT {
+# REL: Entries [
+# REL-NEXT: Entry {
+# REL-NEXT: Address: 0x[[PLTSLOT]]
+# REL-NEXT: Initial: 0x[[PLTADDR]]
+# REL-NEXT: Value: 0x0
+# REL-NEXT: Type: Function
+# REL-NEXT: Section: Undefined
+# REL-NEXT: Name: foo0
+# REL-NEXT: }
+# REL-NEXT: ]
+
+ .text
+ .globl bar
+bar:
+ jal loc # R_MIPS_26 against .text + offset
+
+ .globl __start
+__start:
+ jal bar # R_MIPS_26 against global 'bar' from object file
+ jal foo0 # R_MIPS_26 against 'foo0' from DSO
+
+loc:
+ nop