summaryrefslogtreecommitdiff
path: root/test/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-08-09 20:19:27 +0000
committerLang Hames <lhames@gmail.com>2017-08-09 20:19:27 +0000
commit2c350aa3d38481120efa0f609ca3749479d46b4c (patch)
tree543398a18bf1f0daeb60f984cef647a7ab1ce704 /test/ExecutionEngine
parente695a2327694cf391d280d1291aae65f9c98a3b9 (diff)
[RuntimeDyld][ORC] Add support for Thumb mode to RuntimeDyldMachOARM.
This patch adds support for thumb relocations to RuntimeDyldMachOARM, and adds a target-specific flags field to JITSymbolFlags (so that on ARM we can record whether each symbol is Thumb-mode code). RuntimeDyldImpl::emitSection is modified to ensure that stubs memory is correctly aligned based on the size returned by getStubAlignment(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/ExecutionEngine')
-rw-r--r--test/ExecutionEngine/RuntimeDyld/ARM/MachO_Thumb_Relocations.s51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/ExecutionEngine/RuntimeDyld/ARM/MachO_Thumb_Relocations.s b/test/ExecutionEngine/RuntimeDyld/ARM/MachO_Thumb_Relocations.s
new file mode 100644
index 00000000000..8f0e8732d03
--- /dev/null
+++ b/test/ExecutionEngine/RuntimeDyld/ARM/MachO_Thumb_Relocations.s
@@ -0,0 +1,51 @@
+# RUN: llvm-mc -triple=thumbv7s-apple-ios7.0.0 -filetype=obj -o %T/MachO_Thumb.o %s
+# RUN: llvm-rtdyld -triple=thumbv7s-apple-ios7.0.0 -verify -check=%s %/T/MachO_Thumb.o
+
+ .section __TEXT,__text,regular,pure_instructions
+ .syntax unified
+
+# 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
+ .comm baz, 4, 2
+
+
+ .globl bar
+ .p2align 1
+ .code 16 @ @bar
+ .thumb_func bar
+
+bar:
+# Check lower 16-bits of section difference relocation
+# rtdyld-check: decode_operand(insn1, 1) = (foo-(nextPC+8))[15:0]
+insn1:
+ movw r0, :lower16:(foo-(nextPC+8))
+# Check upper 16-bits of section difference relocation
+# rtdyld-check: decode_operand(insn2, 2) = (foo-(nextPC+8))[31:16]
+insn2:
+ movt r0, :upper16:(foo-(nextPC+8))
+nextPC:
+ nop
+
+# 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.
+# Stub should contain '0xf000f8df' (ldr.w pc, [pc]), followed by the target.
+#
+# rtdyld-check: *{4}(stub_addr(MachO_Thumb.o, __text, baz)) = 0xf000f8df
+# rtdyld-check: *{4}(stub_addr(MachO_Thumb.o, __text, baz) + 4) = baz
+#
+# rtdyld-check: decode_operand(insn3, 0) = stub_addr(MachO_Thumb.o, __text, baz) - (insn3 + 4)
+insn3:
+ bl baz
+
+# Check stub generation for internal symbols by referencing 'bar'.
+# rtdyld-check: *{4}(stub_addr(MachO_Thumb.o, __text, bar) + 4) = bar & 0xfffffffffffffffe
+insn4:
+ bl bar
+
+ .section __DATA,__data
+ .align 2
+foo:
+ .long 0
+
+.subsections_via_symbols