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