Home | History | Annotate | Download | only in ARM
      1 # RUN: llvm-mc -triple=armv7s-apple-ios7.0.0 -relocation-model=pic -filetype=obj -o %T/foo.o %s
      2 # RUN: llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=%s %/T/foo.o
      3 
      4         .syntax unified
      5         .section        __TEXT,__text,regular,pure_instructions
      6         .globl  bar
      7         .align  2
      8 bar:
      9 # Check lower 16-bits of section difference relocation
     10 # rtdyld-check: decode_operand(insn1, 1) = (foo$non_lazy_ptr-(nextPC+8))[15:0]
     11 insn1:
     12         movw    r0, :lower16:(foo$non_lazy_ptr-(nextPC+8))
     13 # Check upper 16-bits of section difference relocation
     14 # rtdyld-check: decode_operand(insn2, 2) = (foo$non_lazy_ptr-(nextPC+8))[31:16]
     15 insn2:
     16         movt    r0, :upper16:(foo$non_lazy_ptr-(nextPC+8))
     17 nextPC:
     18         add     r1, r0, r0
     19 
     20 # Check stub generation for external symbols by referencing a common symbol, 'baz'.
     21 # Check both the content of the stub, and the reference to the stub.
     22 # Stub should contain '0xe51ff004' (ldr pc, [pc, #-4]), followed by the target.
     23 #
     24 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz)) = 0xe51ff004
     25 # rtdyld-check: *{4}(stub_addr(foo.o, __text, baz) + 4) = baz
     26 #
     27 # rtdyld-check: decode_operand(insn3, 0) = stub_addr(foo.o, __text, baz) - (insn3 + 8)
     28 insn3:
     29         bl      baz
     30 
     31 # Check stub generation for internal symbols by referencing 'bar'.
     32 # rtdyld-check: *{4}(stub_addr(foo.o, __text, bar) + 4) = bar
     33 insn4:
     34         bl      bar
     35         bx	lr
     36 
     37 # Add 'aaa' to the common symbols to make sure 'baz' isn't at the start of the
     38 # section. This ensures that we test VANILLA relocation addends correctly.
     39         .comm   aaa, 4, 2
     40         .comm   baz, 4, 2
     41         .comm   foo, 4, 2
     42 
     43 	.section        __DATA,__data
     44 	.globl  _a
     45 	.align  2
     46 # rtdyld-check: *{4}bar_ofs = bar + 4
     47 bar_ofs:
     48 	.long   bar + 4
     49 
     50 # Check that the symbol pointer section entries are fixed up properly:
     51 # rtdyld-check: *{4}foo$non_lazy_ptr = foo
     52         .section	__DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
     53   	.align	2
     54 foo$non_lazy_ptr:
     55 	.indirect_symbol	foo
     56 	.long	0
     57 
     58 .subsections_via_symbols
     59