[llvm] 04c1e52 - [MC][test] Test Mach-O __TEXT,__gcc_except_tab

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 27 23:36:37 PDT 2023


Author: Fangrui Song
Date: 2023-08-27T23:36:32-07:00
New Revision: 04c1e521b9547944333379528e8519f14e4a665c

URL: https://github.com/llvm/llvm-project/commit/04c1e521b9547944333379528e8519f14e4a665c
DIFF: https://github.com/llvm/llvm-project/commit/04c1e521b9547944333379528e8519f14e4a665c.diff

LOG: [MC][test] Test Mach-O __TEXT,__gcc_except_tab

This test is simplified from
lld/test/MachO/compact-unwind-lsda-folding.s, which tests .uleb128 A-B
where A and B are in different fragments (not tested in llvm/).

`.uleb128 Lfunc_end0-Ltmp1` requires evaluateKnownAbsolute in
MCAssembler::relaxLEB to be foldable.

Added: 
    llvm/test/MC/MachO/gcc-except-tab.s

Modified: 
    

Removed: 
    llvm/test/MC/X86/macho-uleb.s


################################################################################
diff  --git a/llvm/test/MC/MachO/gcc-except-tab.s b/llvm/test/MC/MachO/gcc-except-tab.s
new file mode 100644
index 00000000000000..8e29c2adec63d2
--- /dev/null
+++ b/llvm/test/MC/MachO/gcc-except-tab.s
@@ -0,0 +1,35 @@
+# RUN: llvm-mc -triple=x86_64-apple-darwin %s | FileCheck %s --check-prefix=ASM
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t
+# RUN: llvm-objdump -s %t | FileCheck %s
+
+# ASM:      Lexception0:
+# ASM-NEXT: 	.uleb128 Lttbase0-Lttbaseref0
+
+# CHECK:      Contents of section __TEXT,__text:
+# CHECK-NEXT:  0000 e8000000 0090e900 000000             ...........
+# CHECK:      Contents of section __TEXT,__gcc_except_tab:
+# CHECK-NEXT:  000b 020106                               ...
+
+	.section	__TEXT,__text,regular,pure_instructions
+Lfunc_begin0:
+	callq   ___cxa_begin_catch
+Ltmp1:
+	nop
+	jmp	___cxa_end_catch                ## TAILCALL
+Lfunc_end0:
+	.section	__TEXT,__gcc_except_tab
+Lexception0:
+	.uleb128 Lttbase0-Lttbaseref0
+Lttbaseref0:
+	.uleb128 Lcst_end0-Lcst_begin0
+Lcst_begin0:
+	.uleb128 Lfunc_end0-Ltmp1               ##   Call between Ltmp1 and Lfunc_end0
+
+Lcst_end0:
+Lttbase0:
+
+	.section	__TEXT,__text,regular,pure_instructions
+	.globl	__Z1hv
+__Z1hv:
+
+.subsections_via_symbols

diff  --git a/llvm/test/MC/X86/macho-uleb.s b/llvm/test/MC/X86/macho-uleb.s
deleted file mode 100644
index 46d858b8ae20ec..00000000000000
--- a/llvm/test/MC/X86/macho-uleb.s
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: llvm-mc -triple=x86_64-apple-darwin %s | FileCheck %s
-
-a:
-b:
-        .uleb128 a-b
-
-// CHECK:        .uleb128 a-b


        


More information about the llvm-commits mailing list