summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-05-07 21:35:14 +0000
committerLang Hames <lhames@gmail.com>2019-05-07 21:35:14 +0000
commit2b09b25e486834634db5eb200fe48576525b4c7d (patch)
treef8a6edb34d514dfef888f6178f4cae7f209b0127 /llvm/test
parentb2fa002c83a4526d8ec860d253e02ac4ecdc8834 (diff)
downloadbcm5719-llvm-2b09b25e486834634db5eb200fe48576525b4c7d.tar.gz
bcm5719-llvm-2b09b25e486834634db5eb200fe48576525b4c7d.zip
[JITLink] Add support for MachO .alt_entry atoms.
The MachO .alt_entry directive is applied to a symbol to indicate that it is locked (in terms of address layout and liveness) to its predecessor atom. I.e. it is an alternate entry point, at a fixed offset, for the previous atom. This patch updates MachOAtomGraphBuilder to check for the .alt_entry flag on symbols and add a corresponding LayoutNext edge to the atom-graph. It also updates MachOAtomGraphBuilder_x86_64 to generalize handling of the X86_64_RELOC_SUBTRACTOR relocation: previously either the minuend or subtrahend of the subtraction had to be the same as the atom being fixed up, now it is only necessary for the minuend or subtrahend to be locked (via any chain of alt_entry directives) to the atom being fixed up. llvm-svn: 360194
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s64
1 files changed, 63 insertions, 1 deletions
diff --git a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
index 6a9f0b48fa5..9ff382dd743 100644
--- a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
+++ b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86-64_relocations.s
@@ -129,13 +129,19 @@ Lanon_minuend_quad:
Lanon_minuend_long:
.long Lanon_minuend_long - named_data + 2
-
# Named quad storage target (first named atom in __data).
.globl named_data
.p2align 3
named_data:
.quad 0x2222222222222222
+# An alt-entry point for named_data
+ .globl named_data_alt_entry
+ .p2align 3
+ .alt_entry named_data_alt_entry
+named_data_alt_entry:
+ .quad 0
+
# Check X86_64_RELOC_UNSIGNED / extern handling by putting the address of a
# local named function in a pointer variable.
#
@@ -201,4 +207,60 @@ minuend_quad3:
minuend_long3:
.long minuend_long3 - named_data + 2
+# Check X86_64_RELOC_SUBTRACTOR handling for exprs of the form
+# "A: .quad/long B - C + D", where 'B' or 'C' is at a fixed offset from 'A'
+# (i.e. is part of an alt_entry chain that includes 'A').
+#
+# Check "A: .long B - C + D" where 'B' is an alt_entry for 'A'.
+# jitlink-check: *{4}subtractor_with_alt_entry_minuend_long = (subtractor_with_alt_entry_minuend_long_B - named_data + 2)[31:0]
+ .globl subtractor_with_alt_entry_minuend_long
+ .p2align 2
+subtractor_with_alt_entry_minuend_long:
+ .long subtractor_with_alt_entry_minuend_long_B - named_data + 2
+
+ .globl subtractor_with_alt_entry_minuend_long_B
+ .p2align 2
+ .alt_entry subtractor_with_alt_entry_minuend_long_B
+subtractor_with_alt_entry_minuend_long_B:
+ .long 0
+
+# Check "A: .quad B - C + D" where 'B' is an alt_entry for 'A'.
+# jitlink-check: *{8}subtractor_with_alt_entry_minuend_quad = (subtractor_with_alt_entry_minuend_quad_B - named_data + 2)
+ .globl subtractor_with_alt_entry_minuend_quad
+ .p2align 3
+subtractor_with_alt_entry_minuend_quad:
+ .quad subtractor_with_alt_entry_minuend_quad_B - named_data + 2
+
+ .globl subtractor_with_alt_entry_minuend_quad_B
+ .p2align 3
+ .alt_entry subtractor_with_alt_entry_minuend_quad_B
+subtractor_with_alt_entry_minuend_quad_B:
+ .quad 0
+
+# Check "A: .long B - C + D" where 'C' is an alt_entry for 'A'.
+# jitlink-check: *{4}subtractor_with_alt_entry_subtrahend_long = (named_data - subtractor_with_alt_entry_subtrahend_long_B + 2)[31:0]
+ .globl subtractor_with_alt_entry_subtrahend_long
+ .p2align 2
+subtractor_with_alt_entry_subtrahend_long:
+ .long named_data - subtractor_with_alt_entry_subtrahend_long_B + 2
+
+ .globl subtractor_with_alt_entry_subtrahend_long_B
+ .p2align 2
+ .alt_entry subtractor_with_alt_entry_subtrahend_long_B
+subtractor_with_alt_entry_subtrahend_long_B:
+ .long 0
+
+# Check "A: .quad B - C + D" where 'B' is an alt_entry for 'A'.
+# jitlink-check: *{8}subtractor_with_alt_entry_subtrahend_quad = (named_data - subtractor_with_alt_entry_subtrahend_quad_B + 2)
+ .globl subtractor_with_alt_entry_subtrahend_quad
+ .p2align 3
+subtractor_with_alt_entry_subtrahend_quad:
+ .quad named_data - subtractor_with_alt_entry_subtrahend_quad_B + 2
+
+ .globl subtractor_with_alt_entry_subtrahend_quad_B
+ .p2align 3
+ .alt_entry subtractor_with_alt_entry_subtrahend_quad_B
+subtractor_with_alt_entry_subtrahend_quad_B:
+ .quad 0
+
.subsections_via_symbols
OpenPOWER on IntegriCloud