xref: /llvm-project/llvm/test/ExecutionEngine/RuntimeDyld/Mips/ELF_O32_PIC_relocations.s (revision c7c1f21525f88d8efd13a01ece50504d10d012fa)
1# RUN: rm -rf %t && mkdir -p %t
2# RUN: llvm-mc -triple=mipsel-unknown-linux -filetype=obj -o %t/test_ELF_O32.o %s
3# RUN: llc -mtriple=mipsel-unknown-linux -filetype=obj -o %t/test_ELF_ExternalFunction_O32.o %S/Inputs/ExternalFunction.ll
4# RUN: llvm-rtdyld -triple=mipsel-unknown-linux -verify -map-section test_ELF_O32.o,"<common symbols>"=0x7FF8 -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
5
6# RUN: llvm-mc -triple=mips-unknown-linux -filetype=obj -o %t/test_ELF_O32.o %s
7# RUN: llc -mtriple=mips-unknown-linux -filetype=obj -o %t/test_ELF_ExternalFunction_O32.o %S/Inputs/ExternalFunction.ll
8# RUN: llvm-rtdyld -triple=mips-unknown-linux -verify -map-section test_ELF_O32.o,"<common symbols>"=0x7FF8 -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
9
10        .data
11# rtdyld-check: *{4}R_MIPS_32 = foo[31:0]
12R_MIPS_32:
13        .word foo
14# rtdyld-check: *{4}(R_MIPS_32+4) = foo[31:0]
15        .4byte foo
16# rtdyld-check: *{4}(R_MIPS_PC32) = (foo - R_MIPS_PC32)[31:0]
17R_MIPS_PC32:
18        .word foo-.
19# rtdyld-check: *{4}(R_MIPS_PC32 + 4) = (foo - tmp1)[31:0]
20tmp1:
21        .4byte foo-tmp1
22
23	.text
24	.abicalls
25	.nan	legacy
26	.text
27	.set	nomicromips
28	.set	nomips16
29	.set	noreorder
30	.set	nomacro
31	.set	noat
32
33	.align	3
34	.globl	bar
35	.type	bar,@function
36bar:
37# rtdyld-check:  decode_operand(R_MIPS_26, 0)[27:0] = stub_addr(test_ELF_O32.o/.text, foo)[27:0]
38# rtdyld-check:  decode_operand(R_MIPS_26, 0)[1:0] = 0
39R_MIPS_26:
40	j   foo
41	nop
42
43# rtdyld-check:  decode_operand(R_MIPS_PC16, 1)[17:0] = (foo - R_MIPS_PC16)[17:0]
44R_MIPS_PC16:
45	bal   foo
46	nop
47
48# rtdyld-check:  decode_operand(R_MIPS_HI16, 1)[15:0] = foo[31:16]
49R_MIPS_HI16:
50	lui	$1, %hi(foo)
51
52# rtdyld-check:  decode_operand(R_MIPS_LO16, 1)[15:0] = foo[15:0]
53R_MIPS_LO16:
54	lui	$1, %lo(foo)
55
56# rtdyld-check:  decode_operand(R_MIPS_HI16_ADDEND, 1)[15:0] = (var+0x8008)[31:16]
57R_MIPS_HI16_ADDEND:
58	lui	$2, %hi(var+8)
59
60# rtdyld-check:  decode_operand(R_MIPS_LO16_ADDEND, 2)[15:0] = (var+0x8)[15:0]
61R_MIPS_LO16_ADDEND:
62	lb	$2, %lo(var+8)($2)
63
64	.size	bar, .-bar
65	.comm	var,9,1
66