mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-22 07:32:48 +00:00
4c72ce8cff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213720 91177308-0d34-0410-b5e6-96231b3b80d8
44 lines
1.1 KiB
ArmAsm
44 lines
1.1 KiB
ArmAsm
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -relocation-model=pic -filetype=obj -o %T/foo.o %s
|
|
# RUN: sed "s,<filename>,%/T/foo.o,g" %s > %T/foo.s
|
|
# RUN: llvm-rtdyld -triple=x86_64-apple-macosx10.9 -verify -check=%T/foo.s %T/foo.o
|
|
|
|
.section __TEXT,__text,regular,pure_instructions
|
|
.globl foo
|
|
.align 4, 0x90
|
|
foo:
|
|
retq
|
|
|
|
.globl main
|
|
.align 4, 0x90
|
|
main:
|
|
# Test PC-rel branch.
|
|
# rtdyld-check: decode_operand(insn1, 0) = foo - next_pc(insn1)
|
|
insn1:
|
|
callq foo
|
|
|
|
# Test PC-rel signed.
|
|
# rtdyld-check: decode_operand(insn2, 4) = x - next_pc(insn2)
|
|
insn2:
|
|
movl x(%rip), %eax
|
|
|
|
# Test PC-rel GOT relocation.
|
|
# Verify both the contents of the GOT entry for y, and that the movq instruction
|
|
# references the correct GOT entry address:
|
|
# rtdyld-check: *{8}(stub_addr(<filename>, __text, y)) = y
|
|
# rtdyld-check: decode_operand(insn3, 4) = stub_addr(<filename>, __text, y) - next_pc(insn3)
|
|
insn3:
|
|
movq y@GOTPCREL(%rip), %rax
|
|
|
|
movl $0, %eax
|
|
retq
|
|
|
|
.comm y,4,2
|
|
|
|
.section __DATA,__data
|
|
.globl x
|
|
.align 2
|
|
x:
|
|
.long 5
|
|
|
|
.subsections_via_symbols
|