1 # RUN: llvm-mc -triple=mips64el-unknown-linux -relocation-model=pic -code-model=small -filetype=obj -o %T/test_ELF_Mips64N64.o %s
2 # RUN: llc -mtriple=mips64el-unknown-linux -relocation-model=pic -filetype=obj -o %T/test_ELF_ExternalFunction_Mips64N64.o %S/Inputs/ExternalFunction.ll
3 # RUN: llvm-rtdyld -triple=mips64el-unknown-linux -verify -map-section test_ELF_Mips64N64.o,.text=0x1000 -map-section test_ELF_ExternalFunction_Mips64N64.o,.text=0x10000 -check=%s %/T/test_ELF_Mips64N64.o %T/test_ELF_ExternalFunction_Mips64N64.o
6 # Test R_MIPS_PC32 relocation.
7 # rtdyld-check: *{4}(R_MIPS_PC32) = (foo - R_MIPS_PC32)[31:0]
10 # rtdyld-check: *{4}(R_MIPS_PC32 + 4) = (foo - tmp1)[31:0]
16 .section .mdebug.abi64,"",@progbits
18 .file "ELF_Mips64N64_PIC_relocations.ll"
41 # Test R_MIPS_26 relocation.
42 # rtdyld-check: decode_operand(insn1, 0)[25:0] = foo
47 # Test R_MIPS_PC16 relocation.
48 # rtdyld-check: decode_operand(insn2, 1)[15:0] = foo - insn2
64 .size bar, ($func_end0)-bar
85 # Check upper 16-bits of offset between the address of main function
86 # and the global offset table.
87 # rtdyld-check: decode_operand(insn3, 1)[15:0] = ((section_addr(test_ELF_Mips64N64.o, .got) + 0x7ff0) - main + 0x8000)[31:16]
89 lui $1, %hi(%neg(%gp_rel(main)))
92 # Check lower 16-bits of offset between the address of main function
93 # and the global offset table.
94 # rtdyld-check: decode_operand(insn4, 2)[15:0] = ((section_addr(test_ELF_Mips64N64.o, .got) + 0x7ff0) - main)[15:0]
96 daddiu $1, $1, %lo(%neg(%gp_rel(main)))
99 # $gp register contains address of the .got section + 0x7FF0. 0x7FF0 is
100 # the offset of $gp from the beginning of the .got section. Check that we are
101 # loading address of the page pointer from correct offset. In this case
102 # the page pointer is the first entry in the .got section, so offset will be
104 # rtdyld-check: decode_operand(insn5, 2)[15:0] = 0x8010
106 # Check that the global offset table contains the page pointer.
107 # rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got)) = (_str + 0x8000) & 0xffffffffffff0000
109 ld $25, %got_page(_str)($1)
111 # Check the offset of _str from the page pointer.
112 # rtdyld-check: decode_operand(insn6, 2)[15:0] = _str[15:0]
114 daddiu $25, $25, %got_ofst(_str)
116 # Check that we are loading address of var from correct offset. In this case
117 # var is the second entry in the .got section, so offset will be 8 - 0x7FF0.
118 # rtdyld-check: decode_operand(insn7, 2)[15:0] = 0x8018
120 # Check that the global offset table contains the address of the var.
121 # rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got) + 8) = var
123 ld $2, %got_disp(var)($1)
126 # Check that we are loading address of bar from correct offset. In this case
127 # bar is the third entry in the .got section, so offset will be 16 - 0x7FF0.
128 # rtdyld-check: decode_operand(insn8, 2)[15:0] = 0x8020
130 # Check that the global offset table contains the address of the bar.
131 # rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got) + 16) = bar
133 ld $2, %call16(bar)($1)
152 .size main, ($func_end1)-main
155 .section .rodata.str1.1,"aMS",@progbits,1
163 .section ".note.GNU-stack","",@progbits