brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 18e6867 Raw
172 lines · plain
1# RUN: rm -rf %t && mkdir -p %t2# RUN: llvm-mc -triple=mips64el-unknown-linux -filetype=obj -o %t/test_ELF_Mips64N64.o %s3# RUN: llc -mtriple=mips64el-unknown-linux -filetype=obj -o %t/test_ELF_ExternalFunction_Mips64N64.o %S/Inputs/ExternalFunction.ll4# 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.o5 6# RUN: llvm-mc -triple=mips64-unknown-linux -filetype=obj -o %t/test_ELF_Mips64N64.o %s7# RUN: llc -mtriple=mips64-unknown-linux -filetype=obj -o %t/test_ELF_ExternalFunction_Mips64N64.o %S/Inputs/ExternalFunction.ll8# RUN: llvm-rtdyld -triple=mips64-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.o9 10	.data11# Test R_MIPS_PC32 relocation.12# rtdyld-check: *{4}(R_MIPS_PC32) = (foo - R_MIPS_PC32)[31:0]13R_MIPS_PC32:14	.word foo-.15# rtdyld-check: *{4}(R_MIPS_PC32 + 4) = (foo - tmp1)[31:0]16tmp1:17	.4byte foo-tmp118 19	.text20	.abicalls21	.section	.mdebug.abi64,"",@progbits22	.nan	legacy23	.file	"ELF_Mips64N64_PIC_relocations.ll"24	.text25	.globl	bar26	.align	327	.type	bar,@function28	.set	nomicromips29	.set	nomips1630	.ent	bar31bar:32	.frame	$fp,40,$ra33	.mask 	0x00000000,034	.fmask	0x00000000,035	.set	noreorder36	.set	nomacro37	.set	noat38	daddiu	$sp, $sp, -4039	sd	$ra, 32($sp)40	sd	$fp, 24($sp)41	move	 $fp, $sp42	sd	$4, 16($fp)43	lb	$2, 0($4)44	sd	$4, 8($fp)45 46# Test R_MIPS_26 relocation.47# rtdyld-check:  decode_operand(insn1, 0)[27:0] = stub_addr(test_ELF_Mips64N64.o/.text, foo)[27:0]48insn1:49	.option pic050	jal   foo51	.option pic252	nop53 54# Test R_MIPS_PC16 relocation.55# rtdyld-check:  decode_operand(insn2, 1)[17:0] = (foo - insn2)[17:0]56insn2:57	bal   foo58	nop59 60	move	 $sp, $fp61	ld	$ra, 32($sp)62	ld	$fp, 24($sp)63	daddiu	$sp, $sp, 3264	jr	$ra65	nop66	.set	at67	.set	macro68	.set	reorder69	.end	bar70$func_end0:71	.size	bar, ($func_end0)-bar72 73	.globl	main74	.align	375	.type	main,@function76	.set	nomicromips77	.set	nomips1678	.ent	main79main:80	.frame	$fp,32,$ra81	.mask 	0x00000000,082	.fmask	0x00000000,083	.set	noreorder84	.set	nomacro85	.set	noat86	daddiu	$sp, $sp, -3287	sd	$ra, 24($sp)88	sd	$fp, 16($sp)89	sd	$gp, 8($sp)90	move	 $fp, $sp91 92# Check upper 16-bits of offset between the address of main function93# and the global offset table.94# rtdyld-check:  decode_operand(insn3, 1)[15:0] = ((section_addr(test_ELF_Mips64N64.o, .got) + 0x7ff0) - main + 0x8000)[31:16]95insn3:96	lui	$1, %hi(%neg(%gp_rel(main)))97	daddu	$1, $1, $2598 99# Check lower 16-bits of offset between the address of main function100# and the global offset table.101# rtdyld-check:  decode_operand(insn4, 2)[15:0] = ((section_addr(test_ELF_Mips64N64.o, .got) + 0x7ff0) - main)[15:0]102insn4:103	daddiu	$1, $1, %lo(%neg(%gp_rel(main)))104	sw	$zero, 4($fp)105 106# $gp register contains address of the .got section + 0x7FF0. 0x7FF0 is107# the offset of $gp from the beginning of the .got section. Check that we are108# loading address of the page pointer from correct offset. In this case109# the page pointer is the first entry in the .got section, so offset will be110# 0 - 0x7FF0.111# rtdyld-check:  decode_operand(insn5, 2)[15:0] = 0x8010112#113# Check that the global offset table contains the page pointer.114# rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got)) = (_str + 0x8000) & 0xffffffffffff0000115insn5:116	ld	$25, %got_page(_str)($1)117 118# Check the offset of _str from the page pointer.119# rtdyld-check:  decode_operand(insn6, 2)[15:0] = _str[15:0]120insn6:121	daddiu	$25, $25, %got_ofst(_str)122 123# Check that we are loading address of var from correct offset. In this case124# var is the second entry in the .got section, so offset will be 8 - 0x7FF0.125# rtdyld-check:  decode_operand(insn7, 2)[15:0] = 0x8018126#127# Check that the global offset table contains the address of the var.128# rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got) + 8) = var129insn7:130	ld	$2, %got_disp(var)($1)131	sd	$25, 0($2)132 133# Check that we are loading address of bar from correct offset. In this case134# bar is the third entry in the .got section, so offset will be 16 - 0x7FF0.135# rtdyld-check:  decode_operand(insn8, 2)[15:0] = 0x8020136#137# Check that the global offset table contains the address of the bar.138# rtdyld-check: *{8}(section_addr(test_ELF_Mips64N64.o, .got) + 16) = bar139insn8:140	ld	$2, %call16(bar)($1)141 142	move	 $4, $25143	move	 $gp, $1144	move	 $25, $2145	jalr	$25146	nop147	move	 $sp, $fp148	ld	$gp, 8($sp)149	ld	$fp, 16($sp)150	ld	$ra, 24($sp)151	daddiu	$sp, $sp, 32152	jr	$ra153	nop154	.set	at155	.set	macro156	.set	reorder157	.end	main158$func_end1:159	.size	main, ($func_end1)-main160 161	.type	_str,@object162	.section	.rodata.str1.1,"aMS",@progbits,1163_str:164	.asciz	"test"165	.size	_str, 5166 167	.type	var,@object168	.comm	var,8,8169 170	.section	".note.GNU-stack","",@progbits171	.text172