6c47262246abf1e3cc13e5744e1514cbdd4d3058
[oota-llvm.git] / test / ExecutionEngine / RuntimeDyld / Mips / ELF_O32_PIC_relocations.s
1 # RUN: llvm-mc -triple=mipsel-unknown-linux -relocation-model=pic -code-model=small -filetype=obj -o %T/test_ELF_O32.o %s
2 # RUN: llc -mtriple=mipsel-unknown-linux -relocation-model=pic -filetype=obj -o %T/test_ELF_ExternalFunction_O32.o %S/Inputs/ExternalFunction.ll
3 # RUN: llvm-rtdyld -triple=mipsel-unknown-linux -verify -map-section test_ELF_O32.o,.text=0x1000 -map-section test_ELF_ExternalFunction_O32.o,.text=0x10000 -check=%s %T/test_ELF_O32.o %T/test_ELF_ExternalFunction_O32.o
4
5 # RUN: llvm-mc -triple=mips-unknown-linux -relocation-model=pic -code-model=small -filetype=obj -o %T/test_ELF_O32.o %s
6 # RUN: llc -mtriple=mips-unknown-linux -relocation-model=pic -filetype=obj -o %/T/test_ELF_ExternalFunction_O32.o %S/Inputs/ExternalFunction.ll
7 # RUN: llvm-rtdyld -triple=mips-unknown-linux -verify -map-section test_ELF_O32.o,.text=0x1000 -map-section test_ELF_ExternalFunction_O32.o,.text=0x10000 -check=%s %T/test_ELF_O32.o %T/test_ELF_ExternalFunction_O32.o
8
9         .data
10 # rtdyld-check: *{4}R_MIPS_32 = foo[31:0]
11 R_MIPS_32:
12         .word foo
13 # rtdyld-check: *{4}(R_MIPS_32+4) = foo[31:0]
14         .4byte foo
15 # rtdyld-check: *{4}(R_MIPS_PC32) = (foo - R_MIPS_PC32)[31:0]
16 R_MIPS_PC32:
17         .word foo-.
18 # rtdyld-check: *{4}(R_MIPS_PC32 + 4) = (foo - tmp1)[31:0]
19 tmp1:
20         .4byte foo-tmp1
21
22         .text
23         .abicalls
24         .nan    legacy
25         .text
26         .set    nomicromips
27         .set    nomips16
28         .set    noreorder
29         .set    nomacro
30         .set    noat
31
32         .align  3
33         .globl  bar
34         .type   bar,@function
35 bar:
36 # rtdyld-check:  decode_operand(R_MIPS_26, 0)[27:0] = stub_addr(test_ELF_O32.o, .text, foo)[27:0]
37 # rtdyld-check:  decode_operand(R_MIPS_26, 0)[1:0] = 0
38 R_MIPS_26:
39         j   foo
40         nop
41
42 # rtdyld-check:  decode_operand(R_MIPS_PC16, 1)[17:0] = (foo - R_MIPS_PC16)[17:0]
43 R_MIPS_PC16:
44         bal   foo
45         nop
46
47 # rtdyld-check:  decode_operand(R_MIPS_HI16, 1)[15:0] = foo[31:16]
48 R_MIPS_HI16:
49         lui     $1, %hi(foo)
50
51 # rtdyld-check:  decode_operand(R_MIPS_LO16, 1)[15:0] = foo[15:0]
52 R_MIPS_LO16:
53         lui     $1, %lo(foo)
54
55         .size   bar, .-bar