[llvm] 1f2f1a4 - [JITLink][MachO][x86-64] Add support for splitting compact-unwind sections.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 19:13:01 PDT 2021


Author: Lang Hames
Date: 2021-09-28T19:12:56-07:00
New Revision: 1f2f1a4414f868ddb8f1f4b77aca83c66fa0b48c

URL: https://github.com/llvm/llvm-project/commit/1f2f1a4414f868ddb8f1f4b77aca83c66fa0b48c
DIFF: https://github.com/llvm/llvm-project/commit/1f2f1a4414f868ddb8f1f4b77aca83c66fa0b48c.diff

LOG: [JITLink][MachO][x86-64] Add support for splitting compact-unwind sections.

Follow-up to fc734da7954 to enable compact-unwind splitting on x86-64.

Added: 
    llvm/test/ExecutionEngine/JITLink/X86/MachO_x86_64_compact_unwind.s

Modified: 
    llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
index 5e3b1e7b234f..b860816a889d 100644
--- a/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
@@ -534,6 +534,10 @@ void link_MachO_x86_64(std::unique_ptr<LinkGraph> G,
     Config.PrePrunePasses.push_back(createEHFrameSplitterPass_MachO_x86_64());
     Config.PrePrunePasses.push_back(createEHFrameEdgeFixerPass_MachO_x86_64());
 
+    // Add compact unwind splitter pass.
+    Config.PrePrunePasses.push_back(
+        CompactUnwindSplitter("__LD,__compact_unwind"));
+
     // Add a mark-live pass.
     if (auto MarkLive = Ctx->getMarkLivePass(G->getTargetTriple()))
       Config.PrePrunePasses.push_back(std::move(MarkLive));

diff  --git a/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86_64_compact_unwind.s b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86_64_compact_unwind.s
new file mode 100644
index 000000000000..e57831418304
--- /dev/null
+++ b/llvm/test/ExecutionEngine/JITLink/X86/MachO_x86_64_compact_unwind.s
@@ -0,0 +1,27 @@
+# REQUIRES: asserts
+# RUN: llvm-mc -triple=x86_64-apple-darwin11 -filetype=obj -o %t %s
+# RUN: llvm-jitlink -noexec -debug-only=jitlink %t 2>&1 | FileCheck %s
+#
+# Check that splitting of compact-unwind sections works.
+#
+# CHECK: splitting {{.*}} __LD,__compact_unwind containing 1 initial blocks...
+# CHECK:   Splitting {{.*}} into 1 compact unwind record(s)
+# CHECK:     Updating {{.*}} to point to _main {{.*}}
+
+	.section	__TEXT,__text,regular,pure_instructions
+	.globl	_main
+	.p2align	4, 0x90
+_main:
+	.cfi_startproc
+
+	pushq	%rbp
+	.cfi_def_cfa_offset 16
+	.cfi_offset %rbp, -16
+	movq	%rsp, %rbp
+	.cfi_def_cfa_register %rbp
+	xorl	%eax, %eax
+	popq	%rbp
+	retq
+	.cfi_endproc
+
+.subsections_via_symbols


        


More information about the llvm-commits mailing list