brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 9d24903 Raw
48 lines · plain
1# RUN: rm -rf %t && mkdir -p %t2# RUN: llvm-mc -triple=arm64-none-linux-gnu -filetype=obj -o %t/pic-reloc.o %s3# RUN: llvm-rtdyld -triple=arm64-none-linux-gnu -verify  -check=%s %t/pic-reloc.o \4# RUN:    -map-section pic-reloc.o,.got=0x20000 -dummy-extern f=0x1234 -dummy-extern g=0x56785 6_s:7  nop8_a1:9	adrp	x8, :got:f10_a2:11	adrp	x9, :got:g12_a3:13  adrp  x10, :got:_s14_l1:15  ldr x8, [x8, :got_lo12:f]16_l2:17  ldr x9, [x9, :got_lo12:g]18_l3:19  ldr x10, [x10, :got_lo12:_s]20 21 22## We'll end up having two sections .text and .got,23## each is located on the start of a memory page24 25## Test that .got section has three entries pointing to f, g and _s26# *{8}section_addr(pic-reloc.o, .got) = f27# *{8}(section_addr(pic-reloc.o, .got) + 8) = g28# *{8}(section_addr(pic-reloc.o, .got) + 16) = _s29 30## Test that first adrp instruction really takes address of 31## the .got section (_s label is on the start of a page)32# rtdyld-check: _s + (((*{4}_a1)[30:29] + ((*{4}_a1)[23:5] << 2)) << 12) = section_addr(pic-reloc.o, .got)33 34## Test that second adrp takes address of .got35# rtdyld-check: _s + (((*{4}_a2)[30:29] + ((*{4}_a2)[23:5] << 2)) << 12) = section_addr(pic-reloc.o, .got)36 37## Test that third adrp takes address of .got38# rtdyld-check: _s + (((*{4}_a3)[30:29] + ((*{4}_a3)[23:5] << 2)) << 12) = section_addr(pic-reloc.o, .got)39 40## Test that first ldr immediate value is 0 >> 3 = 0 (1st .got entry)41# rtdyld-check: (*{4}_l1)[21:10] = 042 43## Test that second ldr immediate value is 8 >> 3 = 1 (2nd .got entry)44# rtdyld-check: (*{4}_l2)[21:10] = 145 46## Test that third ldr immediate value is 16 >> 3 = 2 (3rd .got entry, addend is 0)47# rtdyld-check: (*{4}_l3)[21:10] = 248