aboutsummaryrefslogtreecommitdiffstats
path: root/test/MC/MachO
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-09-25 18:07:17 +0000
committerJim Grosbach <grosbach@apple.com>2012-09-25 18:07:17 +0000
commitfe2d5f848764dff8f9ba734a5e2438ca1535890e (patch)
treecd42c1e77b5ceae8e0cb49b0892bbf384f286264 /test/MC/MachO
parent13098443994339249fb3f085bbc4fbcdf9f033db (diff)
downloadexternal_llvm-fe2d5f848764dff8f9ba734a5e2438ca1535890e.zip
external_llvm-fe2d5f848764dff8f9ba734a5e2438ca1535890e.tar.gz
external_llvm-fe2d5f848764dff8f9ba734a5e2438ca1535890e.tar.bz2
ARM: Darwin BL/BLX relocations to out-of-range symbols.
When a BL/BLX references a symbol in the same translation unit that is out of range, use an external relocation. The linker will use this to generate a branch island rather than a direct reference, allowing the relocation to resolve correctly. rdar://12359919 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/MC/MachO')
-rw-r--r--test/MC/MachO/ARM/long-call-branch-island-relocation.s43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/MC/MachO/ARM/long-call-branch-island-relocation.s b/test/MC/MachO/ARM/long-call-branch-island-relocation.s
new file mode 100644
index 0000000..8ee7da5
--- /dev/null
+++ b/test/MC/MachO/ARM/long-call-branch-island-relocation.s
@@ -0,0 +1,43 @@
+@ RUN: llvm-mc -n -triple armv7-apple-darwin10 %s -filetype=obj -o %t.o
+@ RUN: macho-dump --dump-section-data < %t.o | FileCheck %s
+
+@ rdar://12359919
+
+ .syntax unified
+ .text
+
+ .globl _bar
+ .align 2
+ .code 16
+ .thumb_func _bar
+_bar:
+ push {r7, lr}
+ mov r7, sp
+ bl _foo
+ pop {r7, pc}
+
+
+_junk:
+@ Make the _foo symbol sufficiently far away to force the 'bl' relocation
+@ above to be out of range. On Darwin, the assembler deals with this by
+@ generating an external relocation so the linker can create a branch
+@ island.
+
+ .space 20000000
+
+ .section __TEXT,initcode,regular,pure_instructions
+
+ .globl _foo
+ .align 2
+ .code 16
+_foo:
+ push {r7, lr}
+ mov r7, sp
+ pop {r7, pc}
+
+
+@ CHECK: ('_relocations', [
+@ CHECK: # Relocation 0
+@ CHECK: (('word-0', 0x4),
+@ CHECK: ('word-1', 0x6d000002)),
+@ CHECK: ])