2014-07-30 03:35:05 +00:00
|
|
|
# RUN: llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o %T/foo.o %s
|
|
|
|
# RUN: llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=%s %/T/foo.o
|
2014-07-10 23:29:11 +00:00
|
|
|
|
2014-09-11 19:21:14 +00:00
|
|
|
.syntax unified
|
|
|
|
.section __TEXT,__text,regular,pure_instructions
|
|
|
|
.globl bar
|
|
|
|
.align 2
|
2014-07-10 23:29:11 +00:00
|
|
|
bar:
|
|
|
|
# Check lower 16-bits of section difference relocation
|
2014-09-11 19:21:14 +00:00
|
|
|
# rtdyld-check: decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]
|
2014-07-10 23:29:11 +00:00
|
|
|
insn1:
|
2014-09-11 19:21:14 +00:00
|
|
|
movw r0, :lower16:(foo$non_lazy_ptr-(nextPC+8))
|
2014-07-10 23:29:11 +00:00
|
|
|
# Check upper 16-bits of section difference relocation
|
2014-09-11 19:21:14 +00:00
|
|
|
# rtdyld-check: decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]
|
2014-07-10 23:29:11 +00:00
|
|
|
insn2:
|
2014-09-11 19:21:14 +00:00
|
|
|
movt r0, :upper16:(foo$non_lazy_ptr-(nextPC+8))
|
2014-07-10 23:29:11 +00:00
|
|
|
nextPC:
|
2014-09-11 19:21:14 +00:00
|
|
|
add r1, r0, r0
|
2014-07-30 03:35:05 +00:00
|
|
|
|
2014-09-11 22:43:36 +00:00
|
|
|
# Check stub generation for external symbols by referencing a common symbol, 'baz'.
|
|
|
|
# Check both the content of the stub, and the reference to the stub.
|
2014-07-30 03:35:05 +00:00
|
|
|
# Stub should contain '0xe51ff004' (ldr pc, [pc, #-4]), followed by the target.
|
|
|
|
#
|
|
|
|
# rtdyld-check: *{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004
|
|
|
|
# rtdyld-check: *{4}(stub_addr(foo.o, __text, baz) + 4) = baz
|
|
|
|
#
|
|
|
|
# rtdyld-check: decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)
|
|
|
|
insn3:
|
|
|
|
bl baz
|
2014-09-11 22:43:36 +00:00
|
|
|
|
|
|
|
# Check stub generation for internal symbols by referencing 'bar'.
|
|
|
|
# rtdyld-check: *{4}(stub_addr(foo.o, __text, bar) + 4) = bar
|
|
|
|
insn4:
|
|
|
|
bl bar
|
2014-09-11 19:21:14 +00:00
|
|
|
bx lr
|
2014-07-10 23:29:11 +00:00
|
|
|
|
2014-09-11 17:27:01 +00:00
|
|
|
# Add 'aaa' to the common symbols to make sure 'baz' isn't at the start of the
|
|
|
|
# section. This ensures that we test VANILLA relocation addends correctly.
|
|
|
|
.comm aaa, 4, 2
|
2014-07-30 03:35:05 +00:00
|
|
|
.comm baz, 4, 2
|
2014-09-11 19:21:14 +00:00
|
|
|
.comm foo, 4, 2
|
|
|
|
|
|
|
|
# Check that the symbol pointer section entries are fixed up properly:
|
|
|
|
# rtdyld-check: *{4}foo$non_lazy_ptr = foo
|
|
|
|
.section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
|
|
|
|
.align 2
|
|
|
|
foo$non_lazy_ptr:
|
|
|
|
.indirect_symbol foo
|
|
|
|
.long 0
|
2014-07-30 03:35:05 +00:00
|
|
|
|
2014-07-10 23:29:11 +00:00
|
|
|
.subsections_via_symbols
|