llvm-project
54 строки · 1.5 Кб
1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 -emit-compact-unwind-non-canonical=true %s -o %t.o
3# RUN: %lld -arch x86_64 -dylib %t.o -o %t.dylib
4# RUN: llvm-objdump --macho --syms --unwind-info %t.dylib | FileCheck %s
5
6## Both _f and _g have the same compact unwind encoding,
7## but different stack sizes. So their compact unwindings
8## can't be merged.
9# CHECK: SYMBOL TABLE:
10# CHECK: [[#%x,F:]] g F __TEXT,__text _f
11# CHECK: [[#%x,G:]] g F __TEXT,__text _g
12# CHECK: Number of common encodings in array: 0x1
13# CHECK: Common encodings: (count = 1)
14# CHECK: encoding[0]: 0x03032000
15# CHECK: Second level indices:
16# CHECK: Second level index[0]:
17# CHECK: [0]: function offset=0x[[#%.8x,F]], encoding[0]=0x03032000
18# CHECK: [1]: function offset=0x[[#%.8x,G]], encoding[0]=0x03032000
19
20## Based on compiling
21## int f() {
22## char alloca[3260] = { 0 };
23## return alloca[0];
24## }
25##
26## int g() {
27## char alloca[2560] = { 0 };
28## return alloca[0];
29## }
30## with `-fomit-frame-pointer -fno-stack-protector -S`.
31.section __TEXT,__text,regular,pure_instructions
32.build_version macos, 10, 15 sdk_version 10, 15, 6
33
34.globl _f
35.p2align 4, 0x90
36_f:
37.cfi_startproc
38subq $3272, %rsp
39.cfi_def_cfa_offset 3280
40addq $3272, %rsp
41retq
42.cfi_endproc
43
44.globl _g
45.p2align 4, 0x90
46_g:
47.cfi_startproc
48subq $2568, %rsp
49.cfi_def_cfa_offset 2576
50addq $2568, %rsp
51retq
52.cfi_endproc
53
54.subsections_via_symbols
55